s3_meta_sync 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/s3_meta_sync/version.rb +1 -1
- data/lib/s3_meta_sync.rb +11 -11
- data.tar.gz.sig +2 -1
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bc2ead8352facf03905523f316efb8827d64270
|
4
|
+
data.tar.gz: 96c0d85c43b8a7d5517208572c79ce7a46b765bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a25db49ef16ab09c129ea91ba21ff29041bf4b409a3cc2b53b8db5962d13507b542245b0e8ec5acec45084167fe9786b1321174cfca9b4e601db9e731b444680
|
7
|
+
data.tar.gz: 77c699d52a21ad63e7fdb39b0bd842b86defc325d7965b863a64b6dec412bd3c13d5edcbe7e01251d6fa0a261f22f8a1ac2e408aed3a45a41fc0f7e3e83b6c9d
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/s3_meta_sync/version.rb
CHANGED
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)
|
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
|
58
|
-
s3.objects
|
55
|
+
def delete_remote_files(remote, paths)
|
56
|
+
s3.objects.delete paths.map { |path| "#{remote}/#{path}" }
|
59
57
|
end
|
60
58
|
|
61
|
-
def
|
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)
|
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
|
-
�
|
1
|
+
�!K,�o�h��-��p}�q�hߘ�- ��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
metadata.gz.sig
CHANGED
Binary file
|