s3cp 1.1.26 → 1.1.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,9 @@
1
+ === 1.1.27 (2013-04-04)
2
+
3
+ * Fixed: Fixed [NoMethodError] undefined method 'exist?' in s3cp when using
4
+ --no-overwrite option (residual bug from RightAWS -> AWS SDK migration).
5
+ s3cp now prints message on STDERR when skipping files that already exists.
6
+
1
7
  === 1.1.26 (2013-03-21)
2
8
 
3
9
  * Fixed: Prevent crash if $terminal.output_rows can't be determined in s3ls/s3tree.
@@ -438,7 +438,7 @@ def s3_to_local(bucket_from, key_from, dest, options = {})
438
438
  end
439
439
 
440
440
  def s3_exist?(bucket, key)
441
- @s3.buckets[bucket].objects[key].exist?
441
+ @s3.buckets[bucket].objects[key].exists?
442
442
  end
443
443
 
444
444
  def s3_checksum(bucket, key)
@@ -486,12 +486,20 @@ def copy(from, to, options)
486
486
  keys.each do |key|
487
487
  if match(key)
488
488
  dest = key_path key_to, relative(key_from, key)
489
- s3_to_s3(bucket_from, key, bucket_to, dest, options) unless !options[:overwrite] && s3_exist?(bucket_to, dest)
489
+ if !options[:overwrite] && s3_exist?(bucket_to, dest)
490
+ STDERR.puts "Skipping s3://#{bucket_to}/#{dest} - already exists."
491
+ else
492
+ s3_to_s3(bucket_from, key, bucket_to, dest, options)
493
+ end
490
494
  end
491
495
  end
492
496
  else
493
497
  key_to += File.basename(key_from) if key_to[-1..-1] == "/"
494
- s3_to_s3(bucket_from, key_from, bucket_to, key_to, options) unless !options[:overwrite] && s3_exist?(bucket_to, key_to)
498
+ if !options[:overwrite] && s3_exist?(bucket_to, key_to)
499
+ STDERR.puts "Skipping s3://#{bucket_to}/#{key_to} - already exists."
500
+ else
501
+ s3_to_s3(bucket_from, key_from, bucket_to, key_to, options)
502
+ end
495
503
  end
496
504
  when :local_to_s3
497
505
  if options[:recursive]
@@ -502,12 +510,20 @@ def copy(from, to, options)
502
510
  #puts "no_slash(key_to) #{no_slash(key_to)}"
503
511
  #puts "relative(from, f) #{relative(from, f)}"
504
512
  key = key_path key_to, relative(from, f)
505
- local_to_s3(bucket_to, key, File.expand_path(f), options) unless !options[:overwrite] && s3_exist?(bucket_to, key)
513
+ if !options[:overwrite] && s3_exist?(bucket_to, key)
514
+ STDERR.puts "Skipping s3://#{bucket_to}/#{key} - already exists."
515
+ else
516
+ local_to_s3(bucket_to, key, File.expand_path(f), options)
517
+ end
506
518
  end
507
519
  end
508
520
  else
509
521
  key_to += File.basename(from) if key_to[-1..-1] == "/"
510
- local_to_s3(bucket_to, key_to, File.expand_path(from), options) unless !options[:overwrite] && s3_exist?(bucket_to, key_to)
522
+ if !options[:overwrite] && s3_exist?(bucket_to, key_to)
523
+ STDERR.puts "Skipping s3://#{bucket_to}/#{key_to} - already exists."
524
+ else
525
+ local_to_s3(bucket_to, key_to, File.expand_path(from), options)
526
+ end
511
527
  end
512
528
  when :s3_to_local
513
529
  if options[:recursive]
@@ -522,13 +538,21 @@ def copy(from, to, options)
522
538
  dir = File.dirname(dest)
523
539
  FileUtils.mkdir_p dir unless File.exist? dir
524
540
  fail "Destination path is not a directory: #{dir}" unless File.directory?(dir)
525
- s3_to_local(bucket_from, key, dest, options) unless !options[:overwrite] && File.exist?(dest)
541
+ if !options[:overwrite] && File.exist?(dest)
542
+ STDERR.puts "Skipping #{dest} - already exists."
543
+ else
544
+ s3_to_local(bucket_from, key, dest, options)
545
+ end
526
546
  end
527
547
  end
528
548
  else
529
549
  dest = File.expand_path(to)
530
550
  dest = File.join(dest, File.basename(key_from)) if File.directory?(dest)
531
- s3_to_local(bucket_from, key_from, dest, options) unless !options[:overwrite] && File.exist?(dest)
551
+ if !options[:overwrite] && File.exist?(dest)
552
+ STDERR.puts "Skipping #{dest} - already exists."
553
+ else
554
+ s3_to_local(bucket_from, key_from, dest, options)
555
+ end
532
556
  end
533
557
  when :local_to_local
534
558
  if options[:include_regex].any? || options[:exclude_regex].any?
@@ -16,5 +16,5 @@
16
16
  # the License.
17
17
 
18
18
  module S3CP
19
- VERSION = "1.1.26"
19
+ VERSION = "1.1.27"
20
20
  end
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: 39
4
+ hash: 37
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 26
10
- version: 1.1.26
9
+ - 27
10
+ version: 1.1.27
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: 2013-03-21 00:00:00 Z
18
+ date: 2013-04-04 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  version_requirements: &id001 !ruby/object:Gem::Requirement