mirror of
https://github.com/hkalexling/Mango.git
synced 2025-08-02 19:05:32 -04:00
Use Gzip instead of Zip
This commit is contained in:
parent
f5933a48d9
commit
8f1383a818
@ -10,8 +10,9 @@ class Library
|
|||||||
path = Config.current.library_path
|
path = Config.current.library_path
|
||||||
instance_file_path = File.join path, "library.yml.zip"
|
instance_file_path = File.join path, "library.yml.zip"
|
||||||
|
|
||||||
writer = Compress::Zip::Writer.new instance_file_path
|
writer = Compress::Gzip::Writer.new instance_file_path,
|
||||||
writer.add "instance.yml", self.to_yaml
|
Compress::Gzip::BEST_COMPRESSION
|
||||||
|
writer.write self.to_yaml.to_slice
|
||||||
writer.close
|
writer.close
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -22,18 +23,10 @@ class Library
|
|||||||
return unless File.exists? instance_file_path
|
return unless File.exists? instance_file_path
|
||||||
|
|
||||||
Logger.debug "Load library instance"
|
Logger.debug "Load library instance"
|
||||||
zip_file = Compress::Zip::File.new instance_file_path
|
|
||||||
instance_file = zip_file.entries.find do |entry|
|
|
||||||
entry.filename == "instance.yml"
|
|
||||||
end
|
|
||||||
|
|
||||||
if instance_file.nil?
|
|
||||||
zip_file.close
|
|
||||||
return
|
|
||||||
end
|
|
||||||
is_loaded = false
|
is_loaded = false
|
||||||
begin
|
begin
|
||||||
instance_file.open do |content|
|
Compress::Gzip::Reader.open instance_file_path do |content|
|
||||||
@@default = Library.from_yaml content
|
@@default = Library.from_yaml content
|
||||||
end
|
end
|
||||||
is_loaded = true
|
is_loaded = true
|
||||||
@ -41,8 +34,6 @@ class Library
|
|||||||
Logger.error e
|
Logger.error e
|
||||||
end
|
end
|
||||||
|
|
||||||
zip_file.close
|
|
||||||
|
|
||||||
if is_loaded
|
if is_loaded
|
||||||
Library.default.register_jobs
|
Library.default.register_jobs
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user