s3_meta_sync 0.5.1 → 0.6.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: af37ab3cb7681f53fb7386ab6e5f2cd01ede102e
4
- data.tar.gz: 5e134534e2320694b539f01782fea1ec4cd1a28c
3
+ metadata.gz: 0a33ceb0ed10477f0a45cd231188300ccfde41c3
4
+ data.tar.gz: 19330b094cea80dff0e1a7b3a6ef0a92bc60ac7a
5
5
  SHA512:
6
- metadata.gz: 0857b2fe31a03ee712481464269c98076588cf6c0c09b5cd8b6b8425115440d9b072059b620a268bcfc7c36855e80a040063eed5bc954d733fdd9dc8e5e32abf
7
- data.tar.gz: 8561e7cfa0020541cb912c7f7913a954287b45f47cceb93e7649322a9262b39158ac0ee1936656643f5d518bd019c4ba5c4821b92025f4bc33ed119f0c680639
6
+ metadata.gz: 69f2e949443b2feb0dea0250cf2a463fbc2008522c543a990e2f6fe27ae5a3c765594402e6362079963f377777eff989b9d7ca898d5f48fcd5f2d012dcb8c828
7
+ data.tar.gz: d3fb512003d77ce462c88eda21b1de52a5731fb26d86a7420cf5b4858f5be4e8619c9569d0d00351e6daa4bfd9baaad6f218a673156be2e156c54b366551682b
data/bin/s3-meta-sync CHANGED
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
2
  $LOAD_PATH << File.expand_path("../../lib", __FILE__)
3
- require "rubygems" if RUBY_VERSION < "1.9"
4
3
  require "s3_meta_sync"
5
4
  exit S3MetaSync.run(ARGV)
@@ -4,15 +4,7 @@ require "digest/md5"
4
4
  require "fileutils"
5
5
  require "tmpdir"
6
6
 
7
- require "aws/s3"
8
-
9
- if RUBY_VERSION < "2.0.0"
10
- # need to require these or upload in multiple threads will fail on systems with high load
11
- require "aws/s3/s3_object"
12
- require "aws/core/response"
13
- require "aws/s3/object_collection"
14
- end
15
-
7
+ require "aws-sdk"
16
8
  require "s3_meta_sync/zip"
17
9
 
18
10
  module S3MetaSync
@@ -139,12 +131,17 @@ module S3MetaSync
139
131
  log "Uploading #{path}"
140
132
  content = File.read("#{source}/#{path}")
141
133
  content = Zip.zip(content) if @config[:zip] && path != META_FILE
142
- s3.objects["#{destination}/#{path}"].write content, :acl => :public_read
134
+ s3.object("#{destination}/#{path}").put body: content, :acl => 'public-read'
143
135
  end
144
136
 
145
137
  def delete_remote_files(remote, paths)
146
138
  paths.each { |path| log "Deleting #{@bucket}:#{remote}/#{path}" }
147
- s3.objects.delete paths.map { |path| "#{remote}/#{path}" }
139
+ if paths.any?
140
+ s3.delete_objects(
141
+ delete: { objects: paths.map { |path| {key: "#{remote}/#{path}"} } },
142
+ request_payer: "requester"
143
+ )
144
+ end
148
145
  end
149
146
 
150
147
  def delete_local_files(local, paths)
@@ -154,10 +151,11 @@ module S3MetaSync
154
151
  end
155
152
 
156
153
  def s3
157
- @s3 ||= ::AWS::S3.new(
154
+ @s3 ||= ::Aws::S3::Resource.new(
158
155
  access_key_id: @config[:key],
159
- secret_access_key: @config[:secret]
160
- ).buckets[@bucket]
156
+ secret_access_key: @config[:secret],
157
+ region: @config[:region] || 'us-west-2'
158
+ ).bucket(@bucket)
161
159
  end
162
160
 
163
161
  def generate_meta(source)
@@ -1,3 +1,3 @@
1
1
  module S3MetaSync
2
- VERSION = "0.5.1"
2
+ VERSION = "0.6.0"
3
3
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: s3_meta_sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.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: 2015-09-21 00:00:00.000000000 Z
11
+ date: 2016-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: aws-sdk-v1
14
+ name: aws-sdk
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '2.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '2.0'
27
27
  description:
28
28
  email: michael@grosser.it
29
29
  executables:
@@ -56,7 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
56
56
  version: '0'
57
57
  requirements: []
58
58
  rubyforge_project:
59
- rubygems_version: 2.2.2
59
+ rubygems_version: 2.4.5.1
60
60
  signing_key:
61
61
  specification_version: 4
62
62
  summary: Sync folders with s3 using a metadata file and md5 diffs