s3cp 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -1
- data/lib/s3cp/s3cp.rb +19 -10
- data/lib/s3cp/version.rb +1 -1
- metadata +4 -4
data/History.txt
CHANGED
data/lib/s3cp/s3cp.rb
CHANGED
@@ -138,6 +138,12 @@ end
|
|
138
138
|
destination = ARGV.last
|
139
139
|
sources = ARGV[0..-2]
|
140
140
|
|
141
|
+
if options[:debug]
|
142
|
+
puts "sources: #{sources.inspect}"
|
143
|
+
puts "destination: #{destination}"
|
144
|
+
puts "Options: \n#{options.inspect}"
|
145
|
+
end
|
146
|
+
|
141
147
|
class Proxy
|
142
148
|
instance_methods.each { |m| undef_method m unless m =~ /(^__|^send$|^object_id$)/ }
|
143
149
|
|
@@ -157,18 +163,10 @@ def s3?(url)
|
|
157
163
|
S3CP.bucket_and_key(url)[0]
|
158
164
|
end
|
159
165
|
|
160
|
-
if options[:debug]
|
161
|
-
puts "URL: #{url}"
|
162
|
-
puts "Options: \n#{options.inspect}"
|
163
|
-
end
|
164
|
-
|
165
166
|
if options[:verbose]
|
166
167
|
@verbose = true
|
167
168
|
end
|
168
169
|
|
169
|
-
@bucket = $1
|
170
|
-
@prefix = $2
|
171
|
-
|
172
170
|
@includes = options[:include_regex].map { |s| Regexp.new(s) }
|
173
171
|
@excludes = options[:exclude_regex].map { |s| Regexp.new(s) }
|
174
172
|
|
@@ -419,6 +417,14 @@ def s3_checksum(bucket, key)
|
|
419
417
|
md5
|
420
418
|
end
|
421
419
|
|
420
|
+
def key_path(prefix, key)
|
421
|
+
if (prefix.nil? || prefix.strip == '')
|
422
|
+
key
|
423
|
+
else
|
424
|
+
no_slash(prefix) + '/' + key
|
425
|
+
end
|
426
|
+
end
|
427
|
+
|
422
428
|
def s3_size(bucket, key)
|
423
429
|
metadata = @s3.interface.head(bucket, key)
|
424
430
|
metadata["content-length"].to_i
|
@@ -437,7 +443,7 @@ def copy(from, to, options)
|
|
437
443
|
end
|
438
444
|
keys.each do |key|
|
439
445
|
if match(key)
|
440
|
-
dest =
|
446
|
+
dest = key_path key_to, relative(key_from, key)
|
441
447
|
s3_to_s3(bucket_from, key, bucket_to, dest) unless !options[:overwrite] && s3_exist?(bucket_to, dest)
|
442
448
|
end
|
443
449
|
end
|
@@ -449,7 +455,10 @@ def copy(from, to, options)
|
|
449
455
|
files = Dir[from + "/**/*"]
|
450
456
|
files.each do |f|
|
451
457
|
if File.file?(f) && match(f)
|
452
|
-
|
458
|
+
puts "bucket_to #{bucket_to}"
|
459
|
+
puts "no_slash(key_to) #{no_slash(key_to)}"
|
460
|
+
puts "relative(from, f) #{relative(from, f)}"
|
461
|
+
key = key_path key_to, relative(from, f)
|
453
462
|
local_to_s3(bucket_to, key, File.expand_path(f), options) unless !options[:overwrite] && s3_exist?(bucket_to, key)
|
454
463
|
end
|
455
464
|
end
|
data/lib/s3cp/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: s3cp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 7
|
10
|
+
version: 0.2.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Alex Boisvert
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-03-
|
18
|
+
date: 2012-03-09 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
prerelease: false
|