s3_meta_sync 0.8.1 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c7a6e80c1fb50514a2c9b8d3ae92d5b64e36ea04
4
- data.tar.gz: c981a2e2d8f5e66f71ee137fc5fcdd0447536ef0
3
+ metadata.gz: 69de05c47d37f1180bc63baee1e0e6a44ae9b015
4
+ data.tar.gz: 95adb0d72567884df6d36f2de1b98821bfe8f075
5
5
  SHA512:
6
- metadata.gz: f509c31ef5ed0f1ddb956b7b3d7ae8c4e714df69e69502b6f422a5095d4c494b25c128aba169c63dabab33af944504c4f84573bd79012cf0adc7ec7cfe2772f3
7
- data.tar.gz: 2e60e1c6f3b49400c21b4cc25f210f2eec9a7aa1a87f00effdeb0d290bbf1674697b2b2cb46f6a6b2d8a236893800c117221cc966b01c2e928455407154002fa
6
+ metadata.gz: 94f6110520c5bbb3f309436c1fbb8bdae2923298f37c1cfac8d8e0a8f8e36031c1811c7d84f91583f7134908e57559a590f365a69612e519ac2ee7146edce31d
7
+ data.tar.gz: 17bf888f1b3b0f7ed35b6fdd61d183a42487cd0682005a1ba60948b6131b3e6565d385063e91455b1f2b3354d9192a3ecb02edce8b34c51f26f2508889d6766b
@@ -17,13 +17,18 @@ module S3MetaSync
17
17
  end
18
18
 
19
19
  def sync(source, destination)
20
- raise if source.end_with?("/") or destination.end_with?("/")
20
+ raise ArgumentError if source.end_with?("/") or destination.end_with?("/")
21
21
 
22
22
  if destination.include?(":")
23
23
  @bucket, destination = destination.split(":")
24
24
  upload(source, destination)
25
25
  else
26
- @bucket, source = source.split(":")
26
+ if url?(source)
27
+ @bucket = nil
28
+ source = source
29
+ else
30
+ @bucket, source = source.split(":")
31
+ end
27
32
  download(source, destination)
28
33
  end
29
34
  end
@@ -35,7 +40,7 @@ module S3MetaSync
35
40
  remote_meta = begin
36
41
  download_meta(destination)
37
42
  rescue RemoteWithoutMeta
38
- log "Remote has no .s3-meta-sync, uploading everything", true
43
+ log "Remote has no #{META_FILE}, uploading everything", true
39
44
  {files: {}}
40
45
  end
41
46
  local_files = generate_meta(source)[:files]
@@ -232,7 +237,12 @@ module S3MetaSync
232
237
 
233
238
  def download_content(path)
234
239
  log "Downloading #{path}"
235
- url = "https://s3#{"-#{region}" if region}.amazonaws.com/#{@bucket}/#{path}"
240
+ url =
241
+ if url?(path)
242
+ path
243
+ else
244
+ "https://s3#{"-#{region}" if region}.amazonaws.com/#{@bucket}/#{path}"
245
+ end
236
246
  options = (@config[:ssl_none] ? {:ssl_verify_mode => OpenSSL::SSL::VERIFY_NONE} : {})
237
247
  open(url, options)
238
248
  rescue OpenURI::HTTPError
@@ -280,6 +290,10 @@ module S3MetaSync
280
290
  end.each(&:join)
281
291
  end
282
292
 
293
+ def url?(source)
294
+ source.include?("://")
295
+ end
296
+
283
297
  def log(text, important=false)
284
298
  $stderr.puts text if @config[:verbose] or important
285
299
  end
@@ -1,3 +1,3 @@
1
1
  module S3MetaSync
2
- VERSION = "0.8.1"
2
+ VERSION = "0.9.0"
3
3
  end
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.8.1
4
+ version: 0.9.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: 2016-09-18 00:00:00.000000000 Z
11
+ date: 2016-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-core