s3cp 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +10 -0
- data/README.md +30 -19
- data/lib/s3cp/completion.rb +2 -0
- data/lib/s3cp/s3buckets.rb +2 -0
- data/lib/s3cp/s3cat.rb +2 -0
- data/lib/s3cp/s3cp.rb +8 -6
- data/lib/s3cp/s3du.rb +2 -0
- data/lib/s3cp/s3ls.rb +2 -0
- data/lib/s3cp/s3mod.rb +2 -0
- data/lib/s3cp/s3rm.rb +2 -0
- data/lib/s3cp/s3stat.rb +4 -0
- data/lib/s3cp/s3up.rb +2 -0
- data/lib/s3cp/utils.rb +10 -0
- data/lib/s3cp/version.rb +1 -1
- metadata +5 -4
data/History.txt
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
=== 1.1.2 / (2012-08-22)
|
2
|
+
|
3
|
+
* Added: All commands now execute an init script ($HOME/.s3cp by default,
|
4
|
+
or $S3CP_CONFIG if defined) allowing customization, such as
|
5
|
+
setting up the AWS.config parameters such as S3 endpoints, max retries,
|
6
|
+
credentials, etc.
|
7
|
+
|
8
|
+
See http://docs.amazonwebservices.com/AWSRubySDK/latest/AWS.html#config-class_method
|
9
|
+
for details.
|
10
|
+
|
1
11
|
=== 1.1.1 / (2012-08-22)
|
2
12
|
|
3
13
|
* Fixed: Invalid break (SyntaxError) in s3ls.
|
data/README.md
CHANGED
@@ -9,17 +9,6 @@ Make sure you have Rubygems installed on your system then run:
|
|
9
9
|
|
10
10
|
# gem install s3cp
|
11
11
|
|
12
|
-
### Building ###
|
13
|
-
|
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
|
22
|
-
|
23
12
|
### Examples ###
|
24
13
|
|
25
14
|
export AWS_ACCESS_KEY_ID=...
|
@@ -39,13 +28,15 @@ All commands support both `s3://bucket/path/to/file` and the legacy `bucket:path
|
|
39
28
|
|
40
29
|
Commands are also TTY-aware; when run in an interactive shell, their behavior will change. For example, `s3cat` will launch your favorite `PAGER` or `less` (the default pager) whereas `s3ls` will display N items at a time, where N is the number of display lines on your terminal and pause between pages.
|
41
30
|
|
42
|
-
###
|
31
|
+
### Security / Credentials ###
|
43
32
|
|
44
|
-
|
33
|
+
Starting with v1.1.0, S3CP uses the default credential provider from the aws-sdk which makes a best effort to locate your AWS credentials. It checks a variety of locations in the following order:
|
45
34
|
|
46
|
-
|
47
|
-
|
48
|
-
|
35
|
+
* Static credentials from AWS.config (e.g. AWS.config.access_key_id, AWS.config.secret_access_key)
|
36
|
+
|
37
|
+
* The environment (e.g. ENV['AWS_ACCESS_KEY_ID'] or ENV['AMAZON_ACCESS_KEY_ID'])
|
38
|
+
|
39
|
+
* EC2 metadata service (checks for credentials provided by roles for instances).
|
49
40
|
|
50
41
|
### Usage ###
|
51
42
|
|
@@ -139,16 +130,36 @@ To install Bash completion for S3 URLs, add the following to ~/.bashrc:
|
|
139
130
|
--verbose Verbose mode
|
140
131
|
-h, --help Show this message
|
141
132
|
|
133
|
+
### Bash completion for S3 URLs ###
|
134
|
+
|
135
|
+
To install Bash completion for S3 URLs, add the following to ~/.bashrc:
|
136
|
+
|
137
|
+
for cmd in [ s3cat s3cp s3dir s3ls s3mod s3rm s3stat ]; do
|
138
|
+
complete -C s3cp_complete $cmd
|
139
|
+
done
|
140
|
+
|
142
141
|
### Dependencies ###
|
143
142
|
|
144
|
-
*
|
145
|
-
*
|
146
|
-
*
|
143
|
+
* extensions '~> 0.6' (portability between Ruby 1.8.7/1.9.2)
|
144
|
+
* highline `>=1.5.1` (console/terminal size guessing)
|
145
|
+
* aws-sdk '~> 1.6.3' (underlying Amazon S3 API)
|
146
|
+
* progressbar '~> 0.10.0' (nice console progress output)
|
147
147
|
|
148
148
|
### Target platform ###
|
149
149
|
|
150
150
|
* Ruby 1.8.7 / 1.9.2
|
151
151
|
|
152
|
+
### Development ###
|
153
|
+
|
154
|
+
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:
|
155
|
+
|
156
|
+
# git clone git@github.com:aboisvert/s3cp.git
|
157
|
+
# cd s3cp
|
158
|
+
# bundle install
|
159
|
+
(... hack on s3cp ...)
|
160
|
+
# bundle exec rake gem
|
161
|
+
# gem install s3cp-*.gem
|
162
|
+
|
152
163
|
### License ###
|
153
164
|
|
154
165
|
S3CP is is licensed under the terms of the Apache Software License v2.0.
|
data/lib/s3cp/completion.rb
CHANGED
data/lib/s3cp/s3buckets.rb
CHANGED
data/lib/s3cp/s3cat.rb
CHANGED
data/lib/s3cp/s3cp.rb
CHANGED
@@ -188,12 +188,7 @@ end
|
|
188
188
|
@includes = options[:include_regex].map { |s| Regexp.new(s) }
|
189
189
|
@excludes = options[:exclude_regex].map { |s| Regexp.new(s) }
|
190
190
|
|
191
|
-
|
192
|
-
matching = true
|
193
|
-
return false if @includes.any? && !@includes.any? { |regex| regex.match(path) }
|
194
|
-
return false if @excludes.any? && @excludes.any? { |regex| regex.match(path) }
|
195
|
-
true
|
196
|
-
end
|
191
|
+
S3CP.load_config()
|
197
192
|
|
198
193
|
@s3 = S3CP.connect()
|
199
194
|
|
@@ -209,6 +204,13 @@ def direction(from, to)
|
|
209
204
|
end
|
210
205
|
end
|
211
206
|
|
207
|
+
def match(path)
|
208
|
+
matching = true
|
209
|
+
return false if @includes.any? && !@includes.any? { |regex| regex.match(path) }
|
210
|
+
return false if @excludes.any? && @excludes.any? { |regex| regex.match(path) }
|
211
|
+
true
|
212
|
+
end
|
213
|
+
|
212
214
|
def no_slash(path)
|
213
215
|
path = path.match(/\/$/) ? path[0..-2] : path
|
214
216
|
path.match(/^\//) ? path[1..-1] : path
|
data/lib/s3cp/s3du.rb
CHANGED
data/lib/s3cp/s3ls.rb
CHANGED
data/lib/s3cp/s3mod.rb
CHANGED
data/lib/s3cp/s3rm.rb
CHANGED
@@ -98,6 +98,8 @@ end
|
|
98
98
|
include_regex = options[:include_regex] ? Regexp.new(options[:include_regex]) : nil
|
99
99
|
exclude_regex = options[:exclude_regex] ? Regexp.new(options[:exclude_regex]) : nil
|
100
100
|
|
101
|
+
S3CP.load_config()
|
102
|
+
|
101
103
|
@s3 = S3CP.connect()
|
102
104
|
|
103
105
|
if options[:recursive]
|
data/lib/s3cp/s3stat.rb
CHANGED
@@ -37,6 +37,10 @@ source = ARGV[0]
|
|
37
37
|
permission = ARGV.last
|
38
38
|
|
39
39
|
@bucket, @key = S3CP.bucket_and_key(source)
|
40
|
+
fail "Your URL looks funny, doesn't it?" unless @bucket
|
41
|
+
|
42
|
+
S3CP.load_config()
|
43
|
+
|
40
44
|
@s3 = S3CP.connect().buckets[@bucket]
|
41
45
|
|
42
46
|
metadata = @s3.objects[@key].head
|
data/lib/s3cp/s3up.rb
CHANGED
data/lib/s3cp/utils.rb
CHANGED
@@ -21,6 +21,7 @@ require 'aws/s3'
|
|
21
21
|
require 'optparse'
|
22
22
|
require 'date'
|
23
23
|
require 'highline/import'
|
24
|
+
require 's3cp/version'
|
24
25
|
|
25
26
|
module S3CP
|
26
27
|
extend self
|
@@ -42,6 +43,15 @@ module S3CP
|
|
42
43
|
::AWS::S3.new()
|
43
44
|
end
|
44
45
|
|
46
|
+
# Load user-defined configuration file (e.g. to initialize AWS.config object)
|
47
|
+
def load_config()
|
48
|
+
aws_config = File.join(ENV['HOME'], '.s3cp')
|
49
|
+
aws_config = ENV['S3CP_CONFIG'] if ENV['S3CP_CONFIG']
|
50
|
+
if File.exist?(aws_config)
|
51
|
+
load aws_config
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
45
55
|
# Parse URL and return bucket and key.
|
46
56
|
#
|
47
57
|
# e.g. s3://bucket/path/to/key => ["bucket", "path/to/key"]
|
data/lib/s3cp/version.rb
CHANGED
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:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 1.1.
|
9
|
+
- 2
|
10
|
+
version: 1.1.2
|
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: 2012-08-
|
18
|
+
date: 2012-08-23 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
prerelease: false
|
@@ -116,6 +116,7 @@ description:
|
|
116
116
|
email:
|
117
117
|
- alex.boisvert@gmail.com
|
118
118
|
executables:
|
119
|
+
- s3buckets
|
119
120
|
- s3cat
|
120
121
|
- s3cp
|
121
122
|
- s3cp_complete
|