insxsync 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/cge_backup.rb CHANGED
@@ -129,10 +129,23 @@ class CGEBackup < ErrorHandlingIface
129
129
 
130
130
  # For each dump
131
131
  @dumps.each do |dump|
132
- name = File.basename(dump)
132
+ zd = Zlib::Deflate.new(Zlib::BEST_COMPRESSION,Zlib::MAX_WBITS, Zlib::DEF_MEM_LEVEL, Zlib::HUFFMAN_ONLY)
133
+ open dump, 'r' do |dump_file|
134
+ begin
135
+ open dump + '.deflated', 'w+' do |def_file|
136
+ until dump_file.eof?
137
+ def_file << zd.deflate(dump_file.read(16384))
138
+ end
139
+ end
140
+ ensure
141
+ zd.close
142
+ end
143
+ end
133
144
 
145
+
146
+ name = File.basename(dump)
134
147
  # Deflate the contents of the dump and write them to an S3 object
135
- bucket.objects["#{prefix}/database/#{name}.deflated"].write(Zlib::Deflate.deflate(File.open(dump, 'r').read))
148
+ bucket.objects["#{prefix}/database/#{name}.deflated"].write(Pathname.new(dump + '.deflated'))
136
149
  end
137
150
  end
138
151
 
@@ -1,3 +1,3 @@
1
1
  module InsxSync
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: insxsync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-03-27 00:00:00.000000000 Z
12
+ date: 2014-03-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk