s3_meta_sync 0.1.6 → 0.1.7
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.tar.gz.sig +0 -0
- data/lib/s3_meta_sync.rb +18 -15
- data/lib/s3_meta_sync/version.rb +1 -1
- metadata +2 -2
- 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: d378c2048e347b69b8163925f00afe0be9fc81e1
|
4
|
+
data.tar.gz: da855bf2005d23ec2b707f12193c208fee1a3054
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a75bf8dbb10772fd13b5eeac525a461a070a2416ee4e49ca608e70154ba33fc9a6aecc81c212d67f92f2b26e1c4dde0696ffdb06eff711d8f08973028d910ab
|
7
|
+
data.tar.gz: 24254882c7a9db8bcfee7a5f9f452ee73dc7cda15f2ea5c99c36b175ec540e17f7d510ecd646c0231ddb5e5c25cbf4c65094bc8b60d59e89b5ce8005eb09b4d7
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/s3_meta_sync.rb
CHANGED
@@ -41,12 +41,28 @@ module S3MetaSync
|
|
41
41
|
local_info = read_meta(source)
|
42
42
|
upload = local_info.select { |path, md5| remote_info[path] != md5 }.map(&:first)
|
43
43
|
delete = remote_info.keys - local_info.keys
|
44
|
+
log "Uploading: #{upload.size} Deleting: #{delete.size}", true
|
44
45
|
|
45
46
|
upload_files(source, destination, upload)
|
46
47
|
delete_remote_files(destination, delete)
|
47
48
|
upload_file(source, META_FILE, destination)
|
48
49
|
end
|
49
50
|
|
51
|
+
def download(source, destination)
|
52
|
+
remote_info = download_meta(source)
|
53
|
+
generate_meta(destination)
|
54
|
+
local_info = read_meta(destination)
|
55
|
+
download = remote_info.select { |path, md5| local_info[path] != md5 }.map(&:first)
|
56
|
+
delete = local_info.keys - remote_info.keys
|
57
|
+
|
58
|
+
log "Downloading: #{download.size} Deleting: #{delete.size}", true
|
59
|
+
|
60
|
+
download_files(source, destination, download)
|
61
|
+
delete_local_files(destination, delete)
|
62
|
+
download_file(source, META_FILE, destination)
|
63
|
+
delete_empty_folders(destination)
|
64
|
+
end
|
65
|
+
|
50
66
|
def upload_file(source, path, destination)
|
51
67
|
log "Uploading #{path}"
|
52
68
|
s3.objects["#{destination}/#{path}"].write File.read("#{source}/#{path}"), :acl => :public_read
|
@@ -103,19 +119,6 @@ module S3MetaSync
|
|
103
119
|
raise "Unable to download #{url} -- #{$!}"
|
104
120
|
end
|
105
121
|
|
106
|
-
def download(source, destination)
|
107
|
-
remote_info = download_meta(source)
|
108
|
-
generate_meta(destination)
|
109
|
-
local_info = read_meta(destination)
|
110
|
-
download = remote_info.select { |path, md5| local_info[path] != md5 }.map(&:first)
|
111
|
-
delete = local_info.keys - remote_info.keys
|
112
|
-
|
113
|
-
download_files(source, destination, download)
|
114
|
-
delete_local_files(destination, delete)
|
115
|
-
download_file(source, META_FILE, destination)
|
116
|
-
delete_empty_folders(destination)
|
117
|
-
end
|
118
|
-
|
119
122
|
def delete_empty_folders(destination)
|
120
123
|
`find #{destination} -depth -empty -delete`
|
121
124
|
end
|
@@ -137,8 +140,8 @@ module S3MetaSync
|
|
137
140
|
Parallel.each(data, :"in_#{way}" => processes, &block) # we tried threads but that blew up with weird errors when having lot's of uploads :/
|
138
141
|
end
|
139
142
|
|
140
|
-
def log(text)
|
141
|
-
$stderr.puts text if @config[:verbose]
|
143
|
+
def log(text, important=false)
|
144
|
+
$stderr.puts text if @config[:verbose] or important
|
142
145
|
end
|
143
146
|
end
|
144
147
|
|
data/lib/s3_meta_sync/version.rb
CHANGED
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.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
@@ -29,7 +29,7 @@ cert_chain:
|
|
29
29
|
y0kCSWmK6D+x/SbfS6r7Ke07MRqziJdB9GuE1+0cIRuFh8EQ+LN6HXCKM5pon/GU
|
30
30
|
ycwMXfl0
|
31
31
|
-----END CERTIFICATE-----
|
32
|
-
date: 2013-
|
32
|
+
date: 2013-10-08 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: aws-sdk
|
metadata.gz.sig
CHANGED
Binary file
|