s3utils 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -49,7 +49,9 @@ 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 or multiple files from one bucket to another
52
53
  s3cmd put bucket:key file # puts a file for the key in the bucket
54
+ s3cmd version # gives the version of s3utils gem
53
55
 
54
56
 
55
57
 
data/lib/s3utils.rb CHANGED
@@ -6,6 +6,11 @@ module S3Utils
6
6
  require "s3utils/version"
7
7
 
8
8
  class Main < Thor
9
+
10
+ desc "version", " gives the version of s3utils gem"
11
+ def version
12
+ puts S3Utils::VERSION
13
+ end
9
14
  desc "listbuckets", "lists all of the buckets in your account"
10
15
  def listbuckets
11
16
  with_error_handling do
@@ -89,8 +94,6 @@ module S3Utils
89
94
  end
90
95
  end
91
96
 
92
-
93
-
94
97
  desc "put bucket:key file", "puts a file for the key in the bucket"
95
98
  def put(bucket_key, file)
96
99
  with_error_handling do
@@ -99,6 +102,19 @@ module S3Utils
99
102
  end
100
103
  end
101
104
 
105
+ desc "move bucket:key bucket:key", "moves a file or multiple files from one bucket to another"
106
+ def move(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
+
102
118
  private
103
119
  def with_error_handling
104
120
  begin
@@ -1,3 +1,3 @@
1
1
  module S3Utils
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
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.0.4
4
+ version: 0.0.5
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-09-21 00:00:00.000000000 Z
12
+ date: 2012-09-26 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: -1794552953186680554
77
+ hash: -1659763447913432824
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: -1794552953186680554
86
+ hash: -1659763447913432824
87
87
  requirements: []
88
88
  rubyforge_project:
89
89
  rubygems_version: 1.8.24