s3cp 0.1.4 → 0.1.5
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 +5 -1
- data/README.md +82 -0
- data/lib/s3cp/s3cat.rb +1 -0
- data/lib/s3cp/s3cp.rb +12 -5
- data/lib/s3cp/s3mod.rb +16 -6
- data/lib/s3cp/version.rb +1 -1
- metadata +3 -3
data/History.txt
CHANGED
data/README.md
CHANGED
@@ -24,6 +24,88 @@ All commands support both `s3://bucket/path/to/file` and the legacy `bucket:path
|
|
24
24
|
|
25
25
|
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.
|
26
26
|
|
27
|
+
### Usage ###
|
28
|
+
|
29
|
+
$ s3cp
|
30
|
+
s3cp supports 4 copying use cases:
|
31
|
+
1. Copy from local machine to S3
|
32
|
+
2. Copy from S3 to local machine
|
33
|
+
3. Copy from S3 to S3
|
34
|
+
4. Copy from local machine to another path on local machine (for completeness)
|
35
|
+
|
36
|
+
Local to S3:
|
37
|
+
s3cp LOCAL_PATH S3_PATH
|
38
|
+
|
39
|
+
S3 to Local:
|
40
|
+
s3cp S3_PATH LOCAL_PATH
|
41
|
+
|
42
|
+
S3 to S3:
|
43
|
+
s3cp S3_PATH S3_PATH2
|
44
|
+
|
45
|
+
Local to Local:
|
46
|
+
s3cp LOCAL_PATH LOCAL_PATH2
|
47
|
+
|
48
|
+
|
49
|
+
-r, --recursive Recursive mode
|
50
|
+
|
51
|
+
--headers 'Header1: Header1Value','Header2: Header2Value'
|
52
|
+
Headers to set on the item in S3.
|
53
|
+
e.g.,
|
54
|
+
HTTP headers: 'Content-Type: image/jpg'
|
55
|
+
AMZ headers: 'x-amz-acl: public-read'
|
56
|
+
|
57
|
+
--verbose Verbose mode
|
58
|
+
--debug Debug mode
|
59
|
+
-h, --help Show this message
|
60
|
+
|
61
|
+
.
|
62
|
+
|
63
|
+
$ s3ls
|
64
|
+
s3ls [path]
|
65
|
+
|
66
|
+
-l Long listing format
|
67
|
+
--date-format FORMAT Date format (see http://strfti.me/)
|
68
|
+
--verbose Verbose mode
|
69
|
+
--rows ROWS Rows per page
|
70
|
+
-h, --help Show this message
|
71
|
+
|
72
|
+
.
|
73
|
+
|
74
|
+
$ s3cat
|
75
|
+
s3cat [path]
|
76
|
+
|
77
|
+
--debug Debug mode
|
78
|
+
--tty TTY mode
|
79
|
+
-h, --help Show this message
|
80
|
+
|
81
|
+
.
|
82
|
+
|
83
|
+
$ s3mod
|
84
|
+
s3mod [path] [permission]
|
85
|
+
|
86
|
+
where [permission] is one of:
|
87
|
+
|
88
|
+
* private
|
89
|
+
* authenticated-read
|
90
|
+
* public-read
|
91
|
+
* public-read-write
|
92
|
+
|
93
|
+
-h, --help Show this message
|
94
|
+
|
95
|
+
.
|
96
|
+
|
97
|
+
$ ./_s3rm
|
98
|
+
s3rm [path]
|
99
|
+
|
100
|
+
-r, --recursive Delete S3 keys matching provided prefix.
|
101
|
+
-i, --include REGEX Delete only S3 objects matching the following regular expression.
|
102
|
+
-x, --exclude REGEX Do not delete any S3 objects matching provided regular expression.
|
103
|
+
-F, --fail-if-not-exist Fail if no S3 object match provided key, prefix and/or regex
|
104
|
+
-t, --test Only display matching keys; do not actually delete anything.
|
105
|
+
--silent Do not display keys as they are deleted.
|
106
|
+
--verbose Verbose mode
|
107
|
+
-h, --help Show this message
|
108
|
+
|
27
109
|
### Dependencies ###
|
28
110
|
|
29
111
|
* highline `>=1.5.1` (console/terminal size guessing)
|
data/lib/s3cp/s3cat.rb
CHANGED
data/lib/s3cp/s3cp.rb
CHANGED
@@ -15,7 +15,7 @@ options[:headers] = []
|
|
15
15
|
|
16
16
|
op = OptionParser.new do |opts|
|
17
17
|
opts.banner = <<-BANNER
|
18
|
-
s3cp supports 4
|
18
|
+
s3cp supports 4 copying use cases:
|
19
19
|
1. Copy from local machine to S3
|
20
20
|
2. Copy from S3 to local machine
|
21
21
|
3. Copy from S3 to S3
|
@@ -36,14 +36,21 @@ op = OptionParser.new do |opts|
|
|
36
36
|
BANNER
|
37
37
|
opts.separator ''
|
38
38
|
|
39
|
-
opts.on("-
|
40
|
-
options[:
|
39
|
+
opts.on("-r", "--recursive", "Recursive mode") do
|
40
|
+
options[:recursive] = true
|
41
41
|
end
|
42
42
|
|
43
|
-
opts.
|
44
|
-
|
43
|
+
opts.separator ""
|
44
|
+
|
45
|
+
opts.on('--headers \'Header1: Header1Value\',\'Header2: Header2Value\'', Array, "Headers to set on the item in S3." ) do |h|
|
46
|
+
options[:headers] = h
|
45
47
|
end
|
46
48
|
|
49
|
+
opts.separator " e.g.,"
|
50
|
+
opts.separator " HTTP headers: \'Content-Type: image/jpg\'"
|
51
|
+
opts.separator " AMZ headers: \'x-amz-acl: public-read\'"
|
52
|
+
opts.separator ""
|
53
|
+
|
47
54
|
opts.on("--verbose", "Verbose mode") do
|
48
55
|
options[:verbose] = true
|
49
56
|
end
|
data/lib/s3cp/s3mod.rb
CHANGED
@@ -1,11 +1,21 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require '
|
1
|
+
require 'rubygems'
|
2
|
+
require 'extensions/kernel' if RUBY_VERSION =~ /1.8/
|
3
|
+
require 'right_aws'
|
3
4
|
require 'optparse'
|
4
5
|
require 's3cp/utils'
|
5
6
|
|
6
7
|
op = OptionParser.new do |opts|
|
7
8
|
opts.banner = "s3mod [path] [permission]"
|
8
9
|
|
10
|
+
opts.separator ""
|
11
|
+
opts.separator "where [permission] is one of:"
|
12
|
+
opts.separator ""
|
13
|
+
opts.separator " * private"
|
14
|
+
opts.separator " * authenticated-read"
|
15
|
+
opts.separator " * public-read"
|
16
|
+
opts.separator " * public-read-write"
|
17
|
+
opts.separator ""
|
18
|
+
|
9
19
|
opts.on_tail("-h", "--help", "Show this message") do
|
10
20
|
puts op
|
11
21
|
exit
|
@@ -19,10 +29,10 @@ if ARGV.size < 2
|
|
19
29
|
exit
|
20
30
|
end
|
21
31
|
|
22
|
-
def update_permissions(s3, bucket, key, permission)
|
32
|
+
def update_permissions(s3, bucket, key, permission)
|
23
33
|
puts "Setting #{permission} on s3://#{bucket}/#{key}"
|
24
|
-
s3.interface.copy(bucket, key, bucket, key, :replace, {"x-amz-acl" => permission })
|
25
|
-
end
|
34
|
+
s3.interface.copy(bucket, key, bucket, key, :replace, {"x-amz-acl" => permission })
|
35
|
+
end
|
26
36
|
|
27
37
|
source = ARGV[0]
|
28
38
|
permission = ARGV.last
|
@@ -32,4 +42,4 @@ raise "Permissions must be one of the following values: #{LEGAL_MODS}" unless LE
|
|
32
42
|
|
33
43
|
@s3 = S3CP.connect()
|
34
44
|
bucket,key = S3CP.bucket_and_key(source)
|
35
|
-
update_permissions(@s3, bucket, key, permission)
|
45
|
+
update_permissions(@s3, bucket, key, permission)
|
data/lib/s3cp/version.rb
CHANGED
metadata
CHANGED