s3_meta_sync 0.4.6 → 0.5.0
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.
- checksums.yaml +4 -4
- data/lib/s3_meta_sync/syncer.rb +13 -6
- data/lib/s3_meta_sync/version.rb +1 -1
- 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: 76bef3c6abd828c51f0d655a70cb20ddc105eda9
|
4
|
+
data.tar.gz: 031cf9ab48d0a25d92c2bbca7dad0a26ed33f83a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6bb3dd0b41a96d4792a3d352d30f02c43e37383a9222e820c7b5a6ca8cbd915db5a5009bfb5fac2d1cbc70f64324e1b57516af896ddad48948ac348ecb505b9c
|
7
|
+
data.tar.gz: b814848c48971212b05c08fb50f5232c0bb661ba1a31640c5b38d13b4b439c49514ec1e8b5037678edcf6e1bd64d25fdfc3c8d75ba988b0829010e6ac6c39259
|
data/lib/s3_meta_sync/syncer.rb
CHANGED
@@ -17,6 +17,8 @@ require "s3_meta_sync/zip"
|
|
17
17
|
|
18
18
|
module S3MetaSync
|
19
19
|
class Syncer
|
20
|
+
DEFAULT_REGION = 'us-east-1'
|
21
|
+
|
20
22
|
def initialize(config)
|
21
23
|
@config = config
|
22
24
|
end
|
@@ -67,7 +69,7 @@ module S3MetaSync
|
|
67
69
|
|
68
70
|
log "Downloading: #{download.size} Deleting: #{delete.size}", true
|
69
71
|
|
70
|
-
|
72
|
+
if download.any? || delete.any?
|
71
73
|
Dir.mktmpdir do |staging_area|
|
72
74
|
FileUtils.mkdir_p(destination)
|
73
75
|
copy_content(destination, staging_area)
|
@@ -148,7 +150,7 @@ module S3MetaSync
|
|
148
150
|
def delete_local_files(local, paths)
|
149
151
|
paths = paths.map { |path| "#{local}/#{path}" }
|
150
152
|
paths.each { |path| log "Deleting #{path}" }
|
151
|
-
|
153
|
+
FileUtils.rm_f(paths)
|
152
154
|
end
|
153
155
|
|
154
156
|
def s3
|
@@ -185,17 +187,21 @@ module S3MetaSync
|
|
185
187
|
|
186
188
|
def read_meta(source)
|
187
189
|
file = "#{source}/#{META_FILE}"
|
188
|
-
|
190
|
+
parse_yaml_content(File.read(file)) if File.exist?(file)
|
189
191
|
end
|
190
192
|
|
191
193
|
def download_meta(destination)
|
192
194
|
content = download_content("#{destination}/#{META_FILE}")
|
193
|
-
|
194
|
-
result.key?(:files) ? result : {files: result} # support new an old format
|
195
|
+
parse_yaml_content(content)
|
195
196
|
rescue
|
196
197
|
raise RemoteWithoutMeta
|
197
198
|
end
|
198
199
|
|
200
|
+
def parse_yaml_content(content)
|
201
|
+
result = YAML.load(content)
|
202
|
+
result.key?(:files) ? result : {files: result} # support new and old format
|
203
|
+
end
|
204
|
+
|
199
205
|
def download_file(source, path, destination, zip)
|
200
206
|
content = download_content("#{source}/#{path}")
|
201
207
|
content = Zip.unzip(content) if zip
|
@@ -237,7 +243,8 @@ module S3MetaSync
|
|
237
243
|
end
|
238
244
|
|
239
245
|
def region
|
240
|
-
|
246
|
+
region = @config[:region]
|
247
|
+
region if region != DEFAULT_REGION
|
241
248
|
end
|
242
249
|
|
243
250
|
def in_multiple_threads(data)
|
data/lib/s3_meta_sync/version.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.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-v1
|