s3cp 0.1.9 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,4 +1,10 @@
1
- === 0.2.0 / (Pending)
1
+ === 0.1.11 / (Pending)
2
+
3
+ === 0.1.10 / (2012-01-24)
4
+
5
+ * Fixed: --max-keys now works correctly with --delimiter
6
+ * Fixed: do not display any keys if there are no common-prefix
7
+ delimiter-matching keys
2
8
 
3
9
  === 0.1.9 / (2012-01-23)
4
10
 
data/lib/s3cp/s3ls.rb CHANGED
@@ -69,18 +69,19 @@ end
69
69
 
70
70
  @s3 = S3CP.connect()
71
71
 
72
+ keys = 0
72
73
  rows = 0
73
74
 
74
75
  s3_options = Hash.new
75
76
  s3_options[:prefix] = @key
76
- s3_options["max-keys"] = options[:max_keys] if options[:max_keys]
77
+ s3_options["max-keys"] = options[:max_keys] if options[:max_keys] && !options[:delimiter]
77
78
  s3_options[:delimiter] = options[:delimiter] if options[:delimiter]
78
79
 
79
80
  @s3.interface.incrementally_list_bucket(@bucket, s3_options) do |page|
80
81
  entries = page[:contents]
81
82
  if options[:delimiter]
82
83
  entries = page[:common_prefixes]
83
- entries << page[:contents][0][:key] if page[:contents].length > 0
84
+ entries << page[:contents][0][:key] if page[:contents].length > 0 && entries.length > 0
84
85
  end
85
86
  entries.each do |entry|
86
87
  key = "s3://#{@bucket}/#{options[:delimiter] ? entry : entry[:key]}"
@@ -91,6 +92,10 @@ s3_options[:delimiter] = options[:delimiter] if options[:delimiter]
91
92
  puts key
92
93
  end
93
94
  rows += 1
95
+ keys += 1
96
+ if options[:max_keys] && keys >= options[:max_keys]
97
+ exit
98
+ end
94
99
  if options[:rows_per_page] && (rows % options[:rows_per_page] == 0)
95
100
  begin
96
101
  print "Continue? (Y/n) "
data/lib/s3cp/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
 
2
2
  module S3CP
3
- VERSION = "0.1.9"
3
+ VERSION = "0.1.10"
4
4
  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
  - 0
8
8
  - 1
9
- - 9
10
- version: 0.1.9
9
+ - 10
10
+ version: 0.1.10
11
11
  platform: ruby
12
12
  authors:
13
13
  - Alex Boisvert