s3_meta_sync 0.7.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/s3_meta_sync/syncer.rb +10 -7
- data/lib/s3_meta_sync/version.rb +1 -1
- data/lib/s3_meta_sync/zip.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7a6e80c1fb50514a2c9b8d3ae92d5b64e36ea04
|
4
|
+
data.tar.gz: c981a2e2d8f5e66f71ee137fc5fcdd0447536ef0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f509c31ef5ed0f1ddb956b7b3d7ae8c4e714df69e69502b6f422a5095d4c494b25c128aba169c63dabab33af944504c4f84573bd79012cf0adc7ec7cfe2772f3
|
7
|
+
data.tar.gz: 2e60e1c6f3b49400c21b4cc25f210f2eec9a7aa1a87f00effdeb0d290bbf1674697b2b2cb46f6a6b2d8a236893800c117221cc966b01c2e928455407154002fa
|
data/lib/s3_meta_sync/syncer.rb
CHANGED
@@ -201,7 +201,7 @@ module S3MetaSync
|
|
201
201
|
end
|
202
202
|
|
203
203
|
def download_meta(destination)
|
204
|
-
content = download_content("#{destination}/#{META_FILE}")
|
204
|
+
content = download_content("#{destination}/#{META_FILE}") { |io| io.read }
|
205
205
|
parse_yaml_content(content)
|
206
206
|
rescue OpenURI::HTTPError
|
207
207
|
retries ||= 1
|
@@ -220,18 +220,21 @@ module S3MetaSync
|
|
220
220
|
end
|
221
221
|
|
222
222
|
def download_file(source, path, destination, zip)
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
FileUtils.mkdir_p(File.dirname(
|
227
|
-
|
223
|
+
download = download_content("#{source}/#{path}") # warning: using block form consumes more ram
|
224
|
+
download = Zip.unzip(download) if zip
|
225
|
+
path = "#{destination}/#{path}"
|
226
|
+
FileUtils.mkdir_p(File.dirname(path))
|
227
|
+
|
228
|
+
# consumes less ram then File.write(path, content), possibly also faster
|
229
|
+
File.open(path, 'wb') { |f| IO.copy_stream(download, f) }
|
230
|
+
download.close
|
228
231
|
end
|
229
232
|
|
230
233
|
def download_content(path)
|
231
234
|
log "Downloading #{path}"
|
232
235
|
url = "https://s3#{"-#{region}" if region}.amazonaws.com/#{@bucket}/#{path}"
|
233
236
|
options = (@config[:ssl_none] ? {:ssl_verify_mode => OpenSSL::SSL::VERIFY_NONE} : {})
|
234
|
-
open(url, options)
|
237
|
+
open(url, options)
|
235
238
|
rescue OpenURI::HTTPError
|
236
239
|
$!.message << " -- while trying to download #{url}"
|
237
240
|
raise
|
data/lib/s3_meta_sync/version.rb
CHANGED
data/lib/s3_meta_sync/zip.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: s3_meta_sync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-core
|