s3cp 1.1.16 → 1.1.17

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,7 @@
1
+ === 1.1.17 (2013-02-05)
2
+
3
+ * Fixed: Speed-up `s3du` (same dealio as s3ls -l from version 1.1.14)
4
+
1
5
  === 1.1.16 (2013-01-31)
2
6
 
3
7
  * Fixed: s3ls paging (with > 1000 keys) was broken (bug introduced in s3cp 1.1.14)
@@ -0,0 +1,5 @@
1
+
2
+ 1TB / 3GB
3
+
4
+ 300 splits
5
+
data/lib/s3cp/s3cp.rb CHANGED
@@ -478,7 +478,7 @@ def copy(from, to, options)
478
478
  end
479
479
  end
480
480
  else
481
- key_to += File.basename(key_from) if key_to[-1..-1] == "/"
481
+ key_to += File.basename(from) if key_to[-1..-1] == "/"
482
482
  local_to_s3(bucket_to, key_to, File.expand_path(from), options) unless !options[:overwrite] && s3_exist?(bucket_to, key_to)
483
483
  end
484
484
  when :s3_to_local
data/lib/s3cp/s3du.rb CHANGED
@@ -95,27 +95,39 @@ def print(key, size)
95
95
  end
96
96
 
97
97
  begin
98
- @s3.buckets[@bucket].objects.with_prefix(@prefix).each do |entry|
99
- key = entry.key
100
- size = entry.content_length
101
-
102
- if options[:regex].nil? || options[:regex].match(key)
103
- current_key = if actual_depth
104
- pos = nth_occurrence(key, "/", actual_depth)
105
- (pos != -1) ? key[0..pos-1] : key
98
+ s3_options = Hash.new
99
+ s3_options[:bucket_name] = @bucket
100
+ s3_options[:prefix] = @prefix
101
+
102
+ begin
103
+ response = @s3.client.list_objects(s3_options)
104
+ response[:contents].each do |object|
105
+
106
+ key = object[:key]
107
+ size = object[:size].to_i
108
+
109
+ if options[:regex].nil? || options[:regex].match(key)
110
+ current_key = if actual_depth
111
+ pos = nth_occurrence(key, "/", actual_depth)
112
+ (pos != -1) ? key[0..pos-1] : key
113
+ end
114
+
115
+ if (last_key && last_key != current_key)
116
+ print(last_key, subtotal_size)
117
+ subtotal_size = size
118
+ else
119
+ subtotal_size += size
120
+ end
121
+
122
+ last_key = current_key
123
+ total_size += size
106
124
  end
125
+ end
107
126
 
108
- if (last_key && last_key != current_key)
109
- print(last_key, subtotal_size)
110
- subtotal_size = size
111
- else
112
- subtotal_size += size
113
- end
127
+ break if response[:contents].empty?
114
128
 
115
- last_key = current_key
116
- total_size += size
117
- end
118
- end
129
+ s3_options.merge!(:marker => response[:contents].last[:key])
130
+ end while response[:truncated]
119
131
 
120
132
  if last_key != nil
121
133
  print(last_key, subtotal_size)
data/lib/s3cp/version.rb CHANGED
@@ -16,5 +16,5 @@
16
16
  # the License.
17
17
 
18
18
  module S3CP
19
- VERSION = "1.1.16"
19
+ VERSION = "1.1.17"
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: 51
4
+ hash: 49
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 16
10
- version: 1.1.16
9
+ - 17
10
+ version: 1.1.17
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-01-31 00:00:00 Z
18
+ date: 2013-02-05 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  version_requirements: &id001 !ruby/object:Gem::Requirement
@@ -138,6 +138,7 @@ extra_rdoc_files:
138
138
  files:
139
139
  - lib/s3cp/s3cat.rb
140
140
  - lib/s3cp/s3tree.rb
141
+ - lib/s3cp/#Untitled-5#
141
142
  - lib/s3cp/s3ls.rb
142
143
  - lib/s3cp/s3du.rb
143
144
  - lib/s3cp/s3mod.rb