s3_meta_sync 0.1.3 → 0.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f72d988a3a404a58e749915b38e9c2ed43cbe9b0
4
- data.tar.gz: 738a73009650bdecb6d1f1415e69e9d470a144bf
3
+ metadata.gz: 7bc2ead8352facf03905523f316efb8827d64270
4
+ data.tar.gz: 96c0d85c43b8a7d5517208572c79ce7a46b765bd
5
5
  SHA512:
6
- metadata.gz: 9a984069ff2ca37eb0d6efb26dd962a18475f11bc2228c9e53ce592fca7fe81dcb5bc967406f2e975cde933d7df56daf41d94be3d1e47a87a5b3e3b047e41321
7
- data.tar.gz: aaff0c25b3bcf278c6288b0bb5cc336858bc45c87cb6a16729fca7e7d51628e2efe5399a34e8b9f5df2936578bef7b1750ca125c9892d24491f57b06bb69e72c
6
+ metadata.gz: a25db49ef16ab09c129ea91ba21ff29041bf4b409a3cc2b53b8db5962d13507b542245b0e8ec5acec45084167fe9786b1321174cfca9b4e601db9e731b444680
7
+ data.tar.gz: 77c699d52a21ad63e7fdb39b0bd842b86defc325d7965b863a64b6dec412bd3c13d5edcbe7e01251d6fa0a261f22f8a1ac2e408aed3a45a41fc0f7e3e83b6c9d
checksums.yaml.gz.sig CHANGED
Binary file
@@ -1,3 +1,3 @@
1
1
  module S3MetaSync
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
data/lib/s3_meta_sync.rb CHANGED
@@ -43,9 +43,7 @@ module S3MetaSync
43
43
  upload_file(source, path, destination)
44
44
  end
45
45
 
46
- (remote_info.keys - local_info.keys).each do |path|
47
- delete_remote_file(destination, path)
48
- end
46
+ delete_remote_files(destination, remote_info.keys - local_info.keys)
49
47
 
50
48
  upload_file(source, META_FILE, destination)
51
49
  end
@@ -54,12 +52,12 @@ module S3MetaSync
54
52
  s3.objects["#{destination}/#{path}"].write File.read("#{source}/#{path}"), :acl => :public_read
55
53
  end
56
54
 
57
- def delete_remote_file(remote, path)
58
- s3.objects["#{remote}/#{path}"].delete
55
+ def delete_remote_files(remote, paths)
56
+ s3.objects.delete paths.map { |path| "#{remote}/#{path}" }
59
57
  end
60
58
 
61
- def delete_local_file(local, path)
62
- File.delete("#{local}/#{path}")
59
+ def delete_local_files(local, paths)
60
+ File.delete(*paths.map { |path| "#{local}/#{path}" })
63
61
  end
64
62
 
65
63
  def s3
@@ -111,9 +109,7 @@ module S3MetaSync
111
109
  download_file(source, path, destination)
112
110
  end
113
111
 
114
- (local_info.keys - remote_info.keys).each do |path|
115
- delete_local_file(destination, path)
116
- end
112
+ delete_local_files(destination, local_info.keys - remote_info.keys)
117
113
 
118
114
  download_file(source, META_FILE, destination)
119
115
 
@@ -138,7 +134,10 @@ module S3MetaSync
138
134
  end
139
135
 
140
136
  def parse_options(argv)
141
- options = {}
137
+ options = {
138
+ :key => ENV["AWS_ACCESS_KEY_ID"],
139
+ :secret => ENV["AWS_SECRET_ACCESS_KEY"]
140
+ }
142
141
  OptionParser.new do |opts|
143
142
  opts.banner = <<-BANNER.gsub(/^ {10}/, "")
144
143
  Sync folders with s3 using a metadata file with md5 sums.
@@ -149,6 +148,7 @@ module S3MetaSync
149
148
  # download files and remove everything that is not remote
150
149
  s3-meta-sync <bucket:folder> <local> # no credentials required
151
150
 
151
+ Key and secret can also be supplied using AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY
152
152
 
153
153
  Options:
154
154
  BANNER
data.tar.gz.sig CHANGED
@@ -1 +1,2 @@
1
- g�}��ן�S�����W������"�@�{R�a��ڛ4I �Ro���V����O�� ���rl�^F�ƙ��lY2yӍ�@�|� �7�ߙ�&7���.}%Y�7�X [��/��K1�>�br ��̱N��ǣ�F�a QD?��2]������n��A�f�����M�L� ����u�&�J�9�5�r(��a*3H��rR�gP�Tą��bAxY����G��/"�}�6�?T�����]��P�֥��
1
+ �!K,�oh��-��p}�qhߘ�- ��L�I�^guR��J@��ǘ%�6#��bӗm�<Y��fЌ��^�W
2
+ i� 0h@� �H�r�HX �M3�_r����7nYM/+߉�$O(4t��,�/u�he��B�D��!��AE�=��O :��r~=4Vc��ݹ�[��6���TS'}DE����<-.��]Y<�
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: s3_meta_sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
metadata.gz.sig CHANGED
Binary file