s3cp 0.1.5 → 0.1.6

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,4 +1,10 @@
1
- === 0.1.6 / (Pending)
1
+ === 0.1.7 / (Pending)
2
+
3
+ === 0.1.6 / (2011-12-16)
4
+
5
+ * Changed: s3rm now uses multi-object delete operation for faster deletes
6
+ * Changed: dependency on 'aboisvert-aws' instead of 'right-aws' until
7
+ it supports multi-object delete.
2
8
 
3
9
  === 0.1.5 / 2011-10-17
4
10
 
data/README.md CHANGED
@@ -3,10 +3,22 @@ S3CP: Commands-line tools for Amazon S3 file manipulation
3
3
 
4
4
  Just a few simple command-line utilities to list, copy, view S3 files, e.g., `s3cp`, `s3ls`, `s3cat`.
5
5
 
6
+ ### Installing ###
7
+
8
+ Make sure you have Rubygems installed on your system then run:
9
+
10
+ # gem install s3cp
11
+
6
12
  ### Building ###
7
13
 
8
- # rake gem
9
- # gem install s3cp-0.1.0.gem
14
+ If you want to hack on s3cp and build the gem yourself, you will need Bundler (http://gembundler.com/) installed. Here is a typical development setup:
15
+
16
+ # git clone git@github.com:aboisvert/s3cp.git
17
+ # cd s3cp
18
+ (... hack on s3cp ...)
19
+ # bundle install
20
+ # bundle exec rake gem
21
+ # gem install s3cp-*.gem
10
22
 
11
23
  ### Examples ###
12
24
 
@@ -58,7 +70,7 @@ Commands are also TTY-aware; when run in an interactive shell, their behavior w
58
70
  --debug Debug mode
59
71
  -h, --help Show this message
60
72
 
61
- .
73
+ ---
62
74
 
63
75
  $ s3ls
64
76
  s3ls [path]
@@ -69,7 +81,7 @@ Commands are also TTY-aware; when run in an interactive shell, their behavior w
69
81
  --rows ROWS Rows per page
70
82
  -h, --help Show this message
71
83
 
72
- .
84
+ ---
73
85
 
74
86
  $ s3cat
75
87
  s3cat [path]
@@ -78,7 +90,7 @@ Commands are also TTY-aware; when run in an interactive shell, their behavior w
78
90
  --tty TTY mode
79
91
  -h, --help Show this message
80
92
 
81
- .
93
+ ---
82
94
 
83
95
  $ s3mod
84
96
  s3mod [path] [permission]
@@ -92,9 +104,9 @@ Commands are also TTY-aware; when run in an interactive shell, their behavior w
92
104
 
93
105
  -h, --help Show this message
94
106
 
95
- .
107
+ ---
96
108
 
97
- $ ./_s3rm
109
+ $ s3rm
98
110
  s3rm [path]
99
111
 
100
112
  -r, --recursive Delete S3 keys matching provided prefix.
data/lib/s3cp/s3rm.rb CHANGED
@@ -91,7 +91,7 @@ exclude_regex = options[:exclude_regex] ? Regexp.new(options[:exclude_regex]) :
91
91
  @s3 = S3CP.connect()
92
92
 
93
93
  if options[:recursive]
94
- total_matching = 0
94
+ matching_keys = []
95
95
 
96
96
  @s3.interface.incrementally_list_bucket(@bucket, :prefix => @key) do |page|
97
97
  page[:contents].each do |entry|
@@ -104,17 +104,27 @@ if options[:recursive]
104
104
  puts "#{key} => #{matching}" if options[:verbose]
105
105
 
106
106
  if matching
107
- total_matching += 1
107
+ matching_keys << entry[:key]
108
108
  puts key unless options[:silent] || options[:verbose]
109
- @s3.interface.delete(@bucket, entry[:key]) unless options[:test]
110
109
  end
111
110
  end
112
111
  end
113
112
 
114
- if options[:fail_if_not_exist] && total_matching == 0
113
+ if options[:fail_if_not_exist] && matching_keys.length == 0
115
114
  puts "No matching keys."
116
115
  exit(1)
117
116
  end
117
+
118
+ errors = []
119
+ errors = @s3.interface.delete_multiple(@bucket, matching_keys) unless options[:test]
120
+
121
+ if errors.length > 0
122
+ puts "Errors during deletion:"
123
+ errors.each do |error|
124
+ puts "#{error[:key]} #{error[:code]} #{error[:message]}"
125
+ end
126
+ exit(1)
127
+ end
118
128
  else
119
129
  # delete a single file; check if it exists
120
130
  if options[:fail_if_not_exist] && @s3.interface.head(@bucket, @key) == nil
data/lib/s3cp/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
 
2
2
  module S3CP
3
- VERSION = "0.1.5"
3
+ VERSION = "0.1.6"
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: 17
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 5
10
- version: 0.1.5
9
+ - 6
10
+ version: 0.1.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Alex Boisvert
@@ -15,10 +15,10 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-10-18 00:00:00 Z
18
+ date: 2011-12-16 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
- version_requirements: &id001 !ruby/object:Gem::Requirement
21
+ requirement: &id001 !ruby/object:Gem::Requirement
22
22
  none: false
23
23
  requirements:
24
24
  - - ~>
@@ -28,12 +28,12 @@ dependencies:
28
28
  - 0
29
29
  - 6
30
30
  version: "0.6"
31
- requirement: *id001
32
- type: :runtime
33
- name: extensions
31
+ version_requirements: *id001
34
32
  prerelease: false
33
+ name: extensions
34
+ type: :runtime
35
35
  - !ruby/object:Gem::Dependency
36
- version_requirements: &id002 !ruby/object:Gem::Requirement
36
+ requirement: &id002 !ruby/object:Gem::Requirement
37
37
  none: false
38
38
  requirements:
39
39
  - - ~>
@@ -44,28 +44,28 @@ dependencies:
44
44
  - 5
45
45
  - 1
46
46
  version: 1.5.1
47
- requirement: *id002
48
- type: :runtime
49
- name: highline
47
+ version_requirements: *id002
50
48
  prerelease: false
49
+ name: highline
50
+ type: :runtime
51
51
  - !ruby/object:Gem::Dependency
52
- version_requirements: &id003 !ruby/object:Gem::Requirement
52
+ requirement: &id003 !ruby/object:Gem::Requirement
53
53
  none: false
54
54
  requirements:
55
55
  - - ~>
56
56
  - !ruby/object:Gem::Version
57
- hash: 11
57
+ hash: 7
58
58
  segments:
59
- - 2
60
- - 1
59
+ - 3
61
60
  - 0
62
- version: 2.1.0
63
- requirement: *id003
64
- type: :runtime
65
- name: right_aws
61
+ - 0
62
+ version: 3.0.0
63
+ version_requirements: *id003
66
64
  prerelease: false
65
+ name: aboisvert_aws
66
+ type: :runtime
67
67
  - !ruby/object:Gem::Dependency
68
- version_requirements: &id004 !ruby/object:Gem::Requirement
68
+ requirement: &id004 !ruby/object:Gem::Requirement
69
69
  none: false
70
70
  requirements:
71
71
  - - ~>
@@ -76,12 +76,12 @@ dependencies:
76
76
  - 3
77
77
  - 0
78
78
  version: 1.3.0
79
- requirement: *id004
80
- type: :runtime
81
- name: right_http_connection
79
+ version_requirements: *id004
82
80
  prerelease: false
81
+ name: right_http_connection
82
+ type: :runtime
83
83
  - !ruby/object:Gem::Dependency
84
- version_requirements: &id005 !ruby/object:Gem::Requirement
84
+ requirement: &id005 !ruby/object:Gem::Requirement
85
85
  none: false
86
86
  requirements:
87
87
  - - ~>
@@ -92,12 +92,12 @@ dependencies:
92
92
  - 5
93
93
  - 0
94
94
  version: 2.5.0
95
- requirement: *id005
96
- type: :development
97
- name: rspec
95
+ version_requirements: *id005
98
96
  prerelease: false
97
+ name: rspec
98
+ type: :development
99
99
  - !ruby/object:Gem::Dependency
100
- version_requirements: &id006 !ruby/object:Gem::Requirement
100
+ requirement: &id006 !ruby/object:Gem::Requirement
101
101
  none: false
102
102
  requirements:
103
103
  - - ~>
@@ -108,10 +108,10 @@ dependencies:
108
108
  - 8
109
109
  - 7
110
110
  version: 0.8.7
111
- requirement: *id006
112
- type: :development
113
- name: rake
111
+ version_requirements: *id006
114
112
  prerelease: false
113
+ name: rake
114
+ type: :development
115
115
  description:
116
116
  email:
117
117
  - alex.boisvert@gmail.com
@@ -127,19 +127,19 @@ extra_rdoc_files:
127
127
  - README.md
128
128
  - History.txt
129
129
  files:
130
+ - lib/s3cp/s3rm.rb
130
131
  - lib/s3cp/s3ls.rb
131
- - lib/s3cp/s3mod.rb
132
- - lib/s3cp/s3cp.rb
133
132
  - lib/s3cp/version.rb
133
+ - lib/s3cp/s3cp.rb
134
134
  - lib/s3cp/utils.rb
135
- - lib/s3cp/s3rm.rb
135
+ - lib/s3cp/s3mod.rb
136
136
  - lib/s3cp/s3cat.rb
137
137
  - History.txt
138
138
  - README.md
139
+ - bin/s3mod
140
+ - bin/s3ls
139
141
  - bin/s3cp
140
142
  - bin/s3cat
141
- - bin/s3ls
142
- - bin/s3mod
143
143
  - bin/s3rm
144
144
  homepage:
145
145
  licenses: []
@@ -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.10
175
+ rubygems_version: 1.8.12
176
176
  signing_key:
177
177
  specification_version: 3
178
178
  summary: Amazon S3 tools to, e.g., list, copy, delete S3 files