s3cmd 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/s3cmd +2 -1
- data/lib/s3cmd.rb +45 -32
- data/lib/s3cmd/version.rb +1 -1
- metadata +57 -24
- data/LICENSE +0 -19
- data/README.md +0 -23
data/bin/s3cmd
CHANGED
data/lib/s3cmd.rb
CHANGED
@@ -1,13 +1,18 @@
|
|
1
|
-
require "rubygems"
|
2
1
|
require "aws"
|
2
|
+
require "logger"
|
3
3
|
require "mime/types"
|
4
4
|
require "proxifier/env"
|
5
|
+
require "rubygems"
|
5
6
|
require "thor"
|
6
7
|
|
7
8
|
module S3Cmd
|
8
9
|
require "s3cmd/version"
|
9
10
|
|
10
|
-
class
|
11
|
+
class CLI < Thor
|
12
|
+
class_option :access_key, :aliases => :a, :desc => "AWS access key to use"
|
13
|
+
class_option :credentials_file, :aliases => :c, :desc => "AWS credentials file containing the access and secret key", :default => File.expand_path("~/.aws-credentials")
|
14
|
+
class_option :secret_key, :aliases => :s, :desc => "AWS secret key to use"
|
15
|
+
|
11
16
|
desc "list-buckets", "lists all of your buckets"
|
12
17
|
def list_buckets
|
13
18
|
puts s3.buckets
|
@@ -16,7 +21,7 @@ module S3Cmd
|
|
16
21
|
desc "create-bucket name", "creates a bucket"
|
17
22
|
method_option :region, :default => "US"
|
18
23
|
def create_bucket(name)
|
19
|
-
|
24
|
+
s3.bucket(name, true)
|
20
25
|
end
|
21
26
|
|
22
27
|
desc "list-keys bucket", "list the keys of a bucket"
|
@@ -26,12 +31,11 @@ module S3Cmd
|
|
26
31
|
|
27
32
|
desc "get bucket key", "get the file for the key from the bucket"
|
28
33
|
def get(bucket, key)
|
29
|
-
|
30
|
-
$stdout << bucket.get(key)
|
34
|
+
puts s3.bucket(bucket).get(key)
|
31
35
|
end
|
32
36
|
|
33
37
|
desc "put bucket key file", "puts a file for the key in the bucket"
|
34
|
-
|
38
|
+
option :type, :desc => "override the content type of the file"
|
35
39
|
def put(bucket, key, file)
|
36
40
|
bucket = s3.bucket(bucket)
|
37
41
|
type = options[:type] || MIME::Types.of(file).first.to_s
|
@@ -39,36 +43,45 @@ module S3Cmd
|
|
39
43
|
end
|
40
44
|
|
41
45
|
private
|
42
|
-
|
43
|
-
|
44
|
-
access_key, secret_key = nil, nil
|
45
|
-
|
46
|
-
if ENV["AWS_CREDENTIAL_FILE"]
|
47
|
-
File.open(ENV["AWS_CREDENTIAL_FILE"]) do |file|
|
48
|
-
file.lines.each do |line|
|
49
|
-
access_key = $1 if line =~ /^AWSAccessKeyId=(.*)$/
|
50
|
-
secret_key = $1 if line =~ /^AWSSecretKey=(.*)$/
|
51
|
-
end
|
52
|
-
end
|
53
|
-
elsif ENV["AWS_ACCESS_KEY"] || ENV["AWS_SECRET_KEY"]
|
54
|
-
access_key = ENV["AWS_ACCESS_KEY"]
|
55
|
-
secret_key = ENV["AWS_SECRET_KEY"]
|
56
|
-
end
|
46
|
+
def credentials
|
47
|
+
return @credentials if defined?(@credentials)
|
57
48
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
49
|
+
access_key = secret_key = nil
|
50
|
+
|
51
|
+
if options[:access_key] || options[:secret_key]
|
52
|
+
access_key = options[:access_key]
|
53
|
+
secret_key = options[:secret_key]
|
54
|
+
else
|
55
|
+
File.open(options[:credentials_file]) do |file|
|
56
|
+
file.lines.each do |line|
|
57
|
+
access_key = $1 if line =~ /^AWSAccessKeyId=(.*)$/
|
58
|
+
secret_key = $1 if line =~ /^AWSSecretKey=(.*)$/
|
65
59
|
end
|
60
|
+
end
|
61
|
+
end
|
66
62
|
|
67
|
-
|
68
|
-
|
63
|
+
@credentials = [access_key, secret_key]
|
64
|
+
end
|
69
65
|
|
70
|
-
|
71
|
-
|
66
|
+
def s3
|
67
|
+
return @s3 if defined?(@s3)
|
68
|
+
|
69
|
+
access_key, secret_key = credentials
|
70
|
+
|
71
|
+
unless access_key
|
72
|
+
$stderr.puts("No access key provided")
|
73
|
+
exit 1
|
72
74
|
end
|
75
|
+
|
76
|
+
unless secret_key
|
77
|
+
$stderr.puts("No secret key provided")
|
78
|
+
exit 1
|
79
|
+
end
|
80
|
+
|
81
|
+
logger = Logger.new(STDERR)
|
82
|
+
logger.level = Logger::FATAL
|
83
|
+
|
84
|
+
@s3 = Aws::S3.new(access_key, secret_key, :logger => logger)
|
85
|
+
end
|
73
86
|
end
|
74
87
|
end
|
data/lib/s3cmd/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: s3cmd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,58 +9,90 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-04-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aws
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 2.
|
21
|
+
version: 2.8.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 2.8.0
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: mime-types
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ~>
|
31
36
|
- !ruby/object:Gem::Version
|
32
|
-
version: '1.
|
37
|
+
version: '1.22'
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '1.22'
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: proxifier
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ~>
|
42
52
|
- !ruby/object:Gem::Version
|
43
|
-
version: 1.0.
|
53
|
+
version: 1.0.3
|
44
54
|
type: :runtime
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.0.3
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: thor
|
49
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
67
|
- - ~>
|
53
68
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
69
|
+
version: 0.18.1
|
55
70
|
type: :runtime
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 0.18.1
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rake
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ~>
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 10.0.4
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 10.0.4
|
94
|
+
description: Provides a s3cmd executable that allows you to create and list buckets
|
95
|
+
as well as list the keys of a bucket and get and upload files to S3.
|
64
96
|
email:
|
65
97
|
- samuel@kadolph.com
|
66
98
|
executables:
|
@@ -71,8 +103,6 @@ files:
|
|
71
103
|
- bin/s3cmd
|
72
104
|
- lib/s3cmd/version.rb
|
73
105
|
- lib/s3cmd.rb
|
74
|
-
- LICENSE
|
75
|
-
- README.md
|
76
106
|
homepage: https://github.com/samuelkadolph/s3cmd
|
77
107
|
licenses: []
|
78
108
|
post_install_message:
|
@@ -91,10 +121,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
121
|
- - ! '>='
|
92
122
|
- !ruby/object:Gem::Version
|
93
123
|
version: '0'
|
124
|
+
segments:
|
125
|
+
- 0
|
126
|
+
hash: -435846521099755325
|
94
127
|
requirements: []
|
95
128
|
rubyforge_project:
|
96
|
-
rubygems_version: 1.8.
|
129
|
+
rubygems_version: 1.8.25
|
97
130
|
signing_key:
|
98
131
|
specification_version: 3
|
99
|
-
summary:
|
132
|
+
summary: s3cmd is simple cli tool for interacting with S3.
|
100
133
|
test_files: []
|
data/LICENSE
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
Copyright (C) 2011 by Samuel Kadolph
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
-
of this software and associated documentation files (the "Software"), to deal
|
5
|
-
in the Software without restriction, including without limitation the rights
|
6
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
copies of the Software, and to permit persons to whom the Software is
|
8
|
-
furnished to do so, subject to the following conditions:
|
9
|
-
|
10
|
-
The above copyright notice and this permission notice shall be included in
|
11
|
-
all copies or substantial portions of the Software.
|
12
|
-
|
13
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
THE SOFTWARE.
|
data/README.md
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
# s3cmd
|
2
|
-
|
3
|
-
## Installing
|
4
|
-
|
5
|
-
### Recommended
|
6
|
-
|
7
|
-
```
|
8
|
-
gem install s3cmd
|
9
|
-
```
|
10
|
-
|
11
|
-
### Edge
|
12
|
-
|
13
|
-
```
|
14
|
-
git clone https://github.com/samuelkadolph/s3cmd
|
15
|
-
cd s3cmd && rake install
|
16
|
-
```
|
17
|
-
|
18
|
-
## Usage
|
19
|
-
|
20
|
-
```
|
21
|
-
s3cmd create-bucket foo
|
22
|
-
s3cmd put foo abc/def somefile
|
23
|
-
```
|