s3utils 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -1
- data/lib/s3utils.rb +16 -1
- data/lib/s3utils/version.rb +1 -1
- metadata +4 -4
data/README.md
CHANGED
@@ -49,7 +49,8 @@ Commands available after install
|
|
49
49
|
s3cmd help [TASK] # Describe available tasks or one specific task
|
50
50
|
s3cmd list bucket:prefix # list the keys of a bucket
|
51
51
|
s3cmd listbuckets # lists all of the buckets in your account
|
52
|
-
s3cmd move bucket:key bucket:key # moves a file
|
52
|
+
s3cmd move bucket:key bucket:key # moves a file from one bucket to another
|
53
|
+
s3cmd copy bucket:key bucket:key # copies a file from one bucket to another
|
53
54
|
s3cmd put bucket:key file # puts a file for the key in the bucket
|
54
55
|
s3cmd version # gives the version of s3utils gem
|
55
56
|
|
data/lib/s3utils.rb
CHANGED
@@ -102,7 +102,21 @@ module S3Utils
|
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
105
|
-
desc "
|
105
|
+
desc "copy bucket:key bucket:key", "copy a file from one bucket:key to another bucket:key"
|
106
|
+
def copy(from, to)
|
107
|
+
with_error_handling do
|
108
|
+
abort "Error: incorrect bucket:key format" unless from =~ /(.+):(.+)/ && to =~ /(.+):(.+)/
|
109
|
+
from =~ /(.+):(.+)/
|
110
|
+
o_from = s3.buckets[$1].objects[$2]
|
111
|
+
raise "Object #{from} does not exist" unless o_from.exists?
|
112
|
+
|
113
|
+
to =~ /(.+):(.+)/
|
114
|
+
o_to = s3.buckets[$1].objects.create($2, :data => o_from.read)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
|
119
|
+
desc "move bucket:key bucket:key", "moves a file from one bucket:key to another bucket:key"
|
106
120
|
def move(from, to)
|
107
121
|
with_error_handling do
|
108
122
|
abort "Error: incorrect bucket:key format" unless from =~ /(.+):(.+)/ && to =~ /(.+):(.+)/
|
@@ -112,6 +126,7 @@ module S3Utils
|
|
112
126
|
|
113
127
|
to =~ /(.+):(.+)/
|
114
128
|
o_to = s3.buckets[$1].objects.create($2, :data => o_from.read)
|
129
|
+
o_from.delete
|
115
130
|
end
|
116
131
|
end
|
117
132
|
|
data/lib/s3utils/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: s3utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aws-sdk
|
@@ -74,7 +74,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
74
74
|
version: '0'
|
75
75
|
segments:
|
76
76
|
- 0
|
77
|
-
hash:
|
77
|
+
hash: -1735772303624336136
|
78
78
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
79
|
none: false
|
80
80
|
requirements:
|
@@ -83,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
83
|
version: '0'
|
84
84
|
segments:
|
85
85
|
- 0
|
86
|
-
hash:
|
86
|
+
hash: -1735772303624336136
|
87
87
|
requirements: []
|
88
88
|
rubyforge_project:
|
89
89
|
rubygems_version: 1.8.24
|