s3cp 1.1.13 → 1.1.14

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.
data/History.txt CHANGED
@@ -1,3 +1,16 @@
1
+ === 1.1.14 (2013-01-27)
2
+
3
+ * Changed: s3cp now adds source file basename to destination path if destination
4
+ path ends with '/'.
5
+
6
+ e.g. s3cp s3://bucket/path/to/file.ext s3://bucket/some/other/path/
7
+ will copy the file to s3://bucket/some/other/path/file.ext
8
+
9
+ * Changed: Speed-up s3ls -l (long-listing format with date + size). Performance
10
+ has regressed since migrating to AWS SDK (from right-aws) since
11
+ high-level AWS SDK API doesn't support memoization of S3 objects --
12
+ back to using low-level API.
13
+
1
14
  === 1.1.13 (2013-01-27)
2
15
 
3
16
  * Added: s3stat --acl option to display associated access-control list XML document.
data/lib/s3cp/s3cp.rb CHANGED
@@ -462,6 +462,7 @@ def copy(from, to, options)
462
462
  end
463
463
  end
464
464
  else
465
+ key_to += File.basename(key_from) if key_to[-1..-1] == "/"
465
466
  s3_to_s3(bucket_from, key_from, bucket_to, key_to, options) unless !options[:overwrite] && s3_exist?(bucket_to, key_to)
466
467
  end
467
468
  when :local_to_s3
@@ -477,6 +478,7 @@ def copy(from, to, options)
477
478
  end
478
479
  end
479
480
  else
481
+ key_to += File.basename(key_from) if key_to[-1..-1] == "/"
480
482
  local_to_s3(bucket_to, key_to, File.expand_path(from), options) unless !options[:overwrite] && s3_exist?(bucket_to, key_to)
481
483
  end
482
484
  when :s3_to_local
data/lib/s3cp/s3ls.rb CHANGED
@@ -88,7 +88,7 @@ end
88
88
 
89
89
  S3CP.load_config()
90
90
 
91
- @s3 = S3CP.connect().buckets[@bucket]
91
+ @s3 = S3CP.connect()
92
92
 
93
93
  keys = 0
94
94
  rows = 0
@@ -124,15 +124,27 @@ begin
124
124
  end
125
125
 
126
126
  if options[:delimiter]
127
- @s3.objects.with_prefix(@key).as_tree(:delimier => options[:delimiter], :append => false).children.each do |entry|
127
+ @s3.buckets[@bucket].objects.with_prefix(@key).as_tree(:delimier => options[:delimiter], :append => false).children.each do |entry|
128
128
  break if display.call(entry)
129
129
  end
130
130
  else
131
+ Struct.new("S3Entry", :key, :last_modified, :content_length)
132
+
131
133
  s3_options = Hash.new
132
134
  s3_options[:limit] = options[:max_keys] if options[:max_keys]
133
- @s3.objects.with_prefix(@key).each(s3_options) do |entry|
134
- break if display.call(entry)
135
- end
135
+
136
+ stop = false
137
+
138
+ begin
139
+ response = @s3.client.list_objects(:bucket_name => @bucket, :prefix => @key)
140
+ response[:contents].each do |object|
141
+ entry = Struct::S3Entry.new(object[:key], object[:last_modified], object[:size].to_i)
142
+ stop = display.call(entry)
143
+ break if stop
144
+ end
145
+ break if stop
146
+ s3_options.merge!(:marker => response[:contents].last[:key])
147
+ end while response[:truncated]
136
148
  end
137
149
  rescue Errno::EPIPE
138
150
  # ignore
data/lib/s3cp/version.rb CHANGED
@@ -16,5 +16,5 @@
16
16
  # the License.
17
17
 
18
18
  module S3CP
19
- VERSION = "1.1.13"
19
+ VERSION = "1.1.14"
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: 9
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 13
10
- version: 1.1.13
9
+ - 14
10
+ version: 1.1.14
11
11
  platform: ruby
12
12
  authors:
13
13
  - Alex Boisvert