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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b2ae988de36b8fabaa5dfa6f19726fc971b46133
4
- data.tar.gz: 50e7f0a149cb5ed3bd3d6c09c9b32e2998118996
3
+ metadata.gz: d378c2048e347b69b8163925f00afe0be9fc81e1
4
+ data.tar.gz: da855bf2005d23ec2b707f12193c208fee1a3054
5
5
  SHA512:
6
- metadata.gz: fa22acee1c5ecac7af983b52fa856948fb7c98f8b66bd374f5f869b24d08d725f6c083ebd89c6c440df3cd14ec50cfa0603546c8bfe899cf3bf1e5ddd09428fb
7
- data.tar.gz: c6e7d3927654ec728757431865ced2cd2a08db8f5b78e9fe9a306f55a9b4c3527af8d114dffd5c2d3aa1fb92d5efdef22682787597bbf3a62270dcc71d3b42de
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
 
@@ -1,3 +1,3 @@
1
1
  module S3MetaSync
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
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.6
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-09-27 00:00:00.000000000 Z
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