s3cp 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/History.txt +5 -1
  2. data/lib/s3cp/s3ls.rb +23 -4
  3. data/lib/s3cp/version.rb +1 -1
  4. metadata +17 -17
@@ -1,4 +1,8 @@
1
- === 0.1.9 / (Pending)
1
+ === 0.2.0 / (Pending)
2
+
3
+ === 0.1.9 / (2012-01-23)
4
+
5
+ * Added: s3ls now accepts --max-keys and --delimiter parameters.
2
6
 
3
7
  === 0.1.8 / (2011-12-29)
4
8
 
@@ -32,6 +32,14 @@ op = OptionParser.new do |opts|
32
32
  options[:rows_per_page] = rows.to_i
33
33
  end
34
34
 
35
+ opts.on("--max-keys KEYS", "Maximum number of keys to display") do |keys|
36
+ options[:max_keys] = keys.to_i
37
+ end
38
+
39
+ opts.on("--delimiter CHAR", "Display keys starting with given path prefix and up to delimiter character") do |delimiter|
40
+ options[:delimiter] = delimiter
41
+ end
42
+
35
43
  opts.on_tail("-h", "--help", "Show this message") do
36
44
  puts op
37
45
  exit
@@ -62,11 +70,22 @@ end
62
70
  @s3 = S3CP.connect()
63
71
 
64
72
  rows = 0
65
- @s3.interface.incrementally_list_bucket(@bucket, :prefix => @key) do |page|
66
- page[:contents].each do |entry|
67
- key = "s3://#{@bucket}/#{entry[:key]}"
68
- last_modified = DateTime.parse(entry[:last_modified])
73
+
74
+ s3_options = Hash.new
75
+ s3_options[:prefix] = @key
76
+ s3_options["max-keys"] = options[:max_keys] if options[:max_keys]
77
+ s3_options[:delimiter] = options[:delimiter] if options[:delimiter]
78
+
79
+ @s3.interface.incrementally_list_bucket(@bucket, s3_options) do |page|
80
+ entries = page[:contents]
81
+ if options[:delimiter]
82
+ entries = page[:common_prefixes]
83
+ entries << page[:contents][0][:key] if page[:contents].length > 0
84
+ end
85
+ entries.each do |entry|
86
+ key = "s3://#{@bucket}/#{options[:delimiter] ? entry : entry[:key]}"
69
87
  if options[:long_format]
88
+ last_modified = DateTime.parse(entry[:last_modified])
70
89
  puts "#{last_modified.strftime(options[:date_format])} #{key}"
71
90
  else
72
91
  puts key
@@ -1,4 +1,4 @@
1
1
 
2
2
  module S3CP
3
- VERSION = "0.1.8"
3
+ VERSION = "0.1.9"
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: 11
4
+ hash: 9
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 8
10
- version: 0.1.8
9
+ - 9
10
+ version: 0.1.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Alex Boisvert
@@ -15,9 +15,11 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-12-29 00:00:00 Z
18
+ date: 2012-01-24 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
+ prerelease: false
22
+ type: :runtime
21
23
  requirement: &id001 !ruby/object:Gem::Requirement
22
24
  none: false
23
25
  requirements:
@@ -29,10 +31,10 @@ dependencies:
29
31
  - 6
30
32
  version: "0.6"
31
33
  version_requirements: *id001
32
- prerelease: false
33
34
  name: extensions
34
- type: :runtime
35
35
  - !ruby/object:Gem::Dependency
36
+ prerelease: false
37
+ type: :runtime
36
38
  requirement: &id002 !ruby/object:Gem::Requirement
37
39
  none: false
38
40
  requirements:
@@ -45,10 +47,10 @@ dependencies:
45
47
  - 1
46
48
  version: 1.5.1
47
49
  version_requirements: *id002
48
- prerelease: false
49
50
  name: highline
50
- type: :runtime
51
51
  - !ruby/object:Gem::Dependency
52
+ prerelease: false
53
+ type: :runtime
52
54
  requirement: &id003 !ruby/object:Gem::Requirement
53
55
  none: false
54
56
  requirements:
@@ -61,10 +63,10 @@ dependencies:
61
63
  - 0
62
64
  version: 3.0.0
63
65
  version_requirements: *id003
64
- prerelease: false
65
66
  name: aboisvert_aws
66
- type: :runtime
67
67
  - !ruby/object:Gem::Dependency
68
+ prerelease: false
69
+ type: :runtime
68
70
  requirement: &id004 !ruby/object:Gem::Requirement
69
71
  none: false
70
72
  requirements:
@@ -77,10 +79,10 @@ dependencies:
77
79
  - 0
78
80
  version: 1.3.0
79
81
  version_requirements: *id004
80
- prerelease: false
81
82
  name: right_http_connection
82
- type: :runtime
83
83
  - !ruby/object:Gem::Dependency
84
+ prerelease: false
85
+ type: :development
84
86
  requirement: &id005 !ruby/object:Gem::Requirement
85
87
  none: false
86
88
  requirements:
@@ -93,10 +95,10 @@ dependencies:
93
95
  - 0
94
96
  version: 2.5.0
95
97
  version_requirements: *id005
96
- prerelease: false
97
98
  name: rspec
98
- type: :development
99
99
  - !ruby/object:Gem::Dependency
100
+ prerelease: false
101
+ type: :development
100
102
  requirement: &id006 !ruby/object:Gem::Requirement
101
103
  none: false
102
104
  requirements:
@@ -109,9 +111,7 @@ dependencies:
109
111
  - 7
110
112
  version: 0.8.7
111
113
  version_requirements: *id006
112
- prerelease: false
113
114
  name: rake
114
- type: :development
115
115
  description:
116
116
  email:
117
117
  - alex.boisvert@gmail.com
@@ -172,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
172
172
  requirements: []
173
173
 
174
174
  rubyforge_project:
175
- rubygems_version: 1.8.12
175
+ rubygems_version: 1.8.15
176
176
  signing_key:
177
177
  specification_version: 3
178
178
  summary: Amazon S3 tools to, e.g., list, copy, delete S3 files