s3sync 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/lib/s3sync/sync.rb CHANGED
@@ -112,18 +112,18 @@ module S3Sync
112
112
  def list_files
113
113
  nodes = {}
114
114
  Find.find(@source) do |file|
115
- st = File.stat file
115
+ begin
116
+ st = File.stat file # Might fail
117
+ raise if not st.readable? # We're not interested in things we can't read
118
+ rescue
119
+ $stderr.puts "WARNING: Skipping unreadable file #{file}"
120
+ Find.prune
121
+ end
116
122
 
117
123
  # We don't support following symlinks for now, we don't need to follow
118
124
  # folders and I don't think we care about any other thing, right?
119
125
  next unless st.file?
120
126
 
121
- # Well, we're kinda out of options right now, I'll just yell!
122
- if not st.readable?
123
- $stderr.puts "WARNING: Skipping unreadable file #{file}"
124
- next
125
- end
126
-
127
127
  # We only need the relative path here
128
128
  file_name = file.gsub(/^#{@source}\/?/, '').squeeze('/')
129
129
  node = Node.new(@source.squeeze('/'), file_name, st.size)
@@ -227,7 +227,11 @@ module S3Sync
227
227
  # dst prefix testing for empty isn't good enough here.. needs to be
228
228
  # "empty apart from potentially having 'bucket:'"
229
229
  if source =~ %r{/$}
230
- File.join [destination, file]
230
+ if remote_prefix? destination and destination.end_with? ':'
231
+ S3Sync.safe_join [destination, file]
232
+ else
233
+ File.join [destination, file]
234
+ end
231
235
  else
232
236
  if remote_prefix? source
233
237
  _, name = source.split ":"
@@ -266,6 +270,7 @@ module S3Sync
266
270
  # canonicalize the S3 stuff
267
271
  remote_prefix = source_is_s3 ? source : destination
268
272
  bucket, remote_prefix = remote_prefix.split ":"
273
+
269
274
  remote_prefix ||= ""
270
275
 
271
276
  # Just making sure we preserve the direction
@@ -23,5 +23,5 @@
23
23
  # THE SOFTWARE.
24
24
 
25
25
  module S3Sync
26
- VERSION = "0.3.2"
26
+ VERSION = "0.3.3"
27
27
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: s3sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -170,7 +170,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
170
170
  version: '0'
171
171
  segments:
172
172
  - 0
173
- hash: 4017142764294384593
173
+ hash: 236637635868227634
174
174
  required_rubygems_version: !ruby/object:Gem::Requirement
175
175
  none: false
176
176
  requirements:
@@ -179,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
179
179
  version: '0'
180
180
  segments:
181
181
  - 0
182
- hash: 4017142764294384593
182
+ hash: 236637635868227634
183
183
  requirements: []
184
184
  rubyforge_project:
185
185
  rubygems_version: 1.8.24