s3ranger 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- s3ranger (0.2.1)
4
+ s3ranger (0.3.0)
5
5
  aws-sdk
6
6
  cmdparse
7
7
 
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013 Lincoln de Sousa
1
+ Copyright (c) 2013 Lincoln de Sousa <lincoln@clarete.li>
2
2
 
3
3
  MIT License
4
4
 
data/bin/s3ranger CHANGED
@@ -1,4 +1,28 @@
1
1
  #!/usr/bin/env ruby
2
+ #
3
+ # s3ranger - Tool belt for managing your S3 buckets
4
+ #
5
+ # The MIT License (MIT)
6
+ #
7
+ # Copyright (c) 2013 Lincoln de Sousa <lincoln@clarete.li>
8
+ #
9
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ # of this software and associated documentation files (the "Software"), to deal
11
+ # in the Software without restriction, including without limitation the rights
12
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ # copies of the Software, and to permit persons to whom the Software is
14
+ # furnished to do so, subject to the following conditions:
15
+ #
16
+ # The above copyright notice and this permission notice shall be included in
17
+ # all copies or substantial portions of the Software.
18
+ #
19
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
+ # THE SOFTWARE.
2
26
 
3
27
  $:.unshift(File.dirname(__FILE__) + '/../lib') unless $:.include?(File.dirname(__FILE__) + '/../lib')
4
28
 
@@ -13,15 +37,26 @@ begin
13
37
  conf.read
14
38
  rescue S3Ranger::NoConfigFound => exc
15
39
  # We can't proceed without having those two vars set
16
- if not (conf.has_key? "AWS_ACCESS_KEY_ID" and conf.has_key? "AWS_SECRET_ACCESS_KEY")
17
- $stderr.puts "You didn't set up your environment variables :("
18
- $stderr.puts "I tried the following paths:"
19
- exc.paths_checked.each {|path| $stderr.puts " * #{path}/s3config.yml"}
40
+ $stderr.puts "You didn't set up the following environment variables:"
41
+ $stderr.puts
42
+ exc.missing_vars.each {|var| $stderr.puts " * #{var}"}
43
+ $stderr.puts
20
44
 
21
- $stderr.puts "You could try to set the `S3CONF' environment variable."
22
- $stderr.puts "Learn how to do that here: https://github.com/clarete/s3ranger"
23
- exit
24
- end
45
+ $stderr.puts "I tried to load a config file from the following paths:"
46
+ $stderr.puts
47
+ exc.paths_checked.each {|path| $stderr.puts " * #{path}"}
48
+ $stderr.puts
49
+
50
+ $stderr.puts "You could try to set the `S3RANGER_PATH' environment variable"
51
+ $stderr.puts "pointing to a file to be loaded as your config file or just"
52
+ $stderr.puts "export those variables to your environment like this:"
53
+ $stderr.puts
54
+ exc.missing_vars.each {|var|
55
+ $stderr.puts " $ export #{var}=<value-provided-by-amazon>"
56
+ }
57
+ $stderr.puts
58
+ $stderr.puts "Learn how to do that here: https://github.com/clarete/s3ranger"
59
+ exit
25
60
  end
26
61
 
27
62
  # Step aside, the star of this show is here. Let's try to create the
@@ -33,7 +68,6 @@ rescue S3Ranger::FailureFeedback => exc
33
68
  $stderr.puts exc.message
34
69
  exit 1
35
70
  rescue S3Ranger::WrongUsage => exc
36
- name = $0.split('/').last
37
71
  $stderr.puts "Error:\n #{exc.msg}\n" if exc.msg
38
72
  exit exc.error_code
39
73
  end
File without changes
File without changes
data/lib/s3ranger/cli.rb CHANGED
@@ -1,3 +1,27 @@
1
+ # s3ranger - Tool belt for managing your S3 buckets
2
+ #
3
+ # The MIT License (MIT)
4
+ #
5
+ # Copyright (c) 2013 Lincoln de Sousa <lincoln@clarete.li>
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the "Software"), to deal
9
+ # in the Software without restriction, including without limitation the rights
10
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ # copies of the Software, and to permit persons to whom the Software is
12
+ # furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included in
15
+ # all copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ # THE SOFTWARE.
24
+
1
25
  require 's3ranger/version'
2
26
  require 's3ranger/exceptions'
3
27
  require 's3ranger/sync'
@@ -12,7 +36,35 @@ module S3Ranger
12
36
 
13
37
  AVAILABLE_METHODS = ['read', 'get', 'put', 'write', 'delete']
14
38
 
15
- class ListBuckets < CmdParse::Command
39
+ class BaseCmd < CmdParse::Command
40
+
41
+ @has_prefix = false
42
+
43
+ def has_options?
44
+ not options.instance_variables.empty?
45
+ end
46
+
47
+ def has_prefix?
48
+ @has_prefix
49
+ end
50
+
51
+ def usage
52
+ u = []
53
+ u << "Usage: #{File.basename commandparser.program_name} #{name} "
54
+ u << "[options] " if has_options?
55
+ u << "bucket" if has_args?
56
+
57
+ if has_prefix? == 'required'
58
+ u << ':prefix'
59
+ elsif has_prefix?
60
+ u << "[:prefix]"
61
+ end
62
+
63
+ u.join ''
64
+ end
65
+ end
66
+
67
+ class ListBuckets < BaseCmd
16
68
  def initialize
17
69
  super 'listbuckets', false, false, false
18
70
 
@@ -26,7 +78,7 @@ module S3Ranger
26
78
  end
27
79
  end
28
80
 
29
- class CreateBucket < CmdParse::Command
81
+ class CreateBucket < BaseCmd
30
82
  attr_accessor :acl
31
83
 
32
84
  def initialize
@@ -60,7 +112,7 @@ module S3Ranger
60
112
  end
61
113
  end
62
114
 
63
- class DeleteBucket < CmdParse::Command
115
+ class DeleteBucket < BaseCmd
64
116
  attr_accessor :force
65
117
 
66
118
  def initialize
@@ -92,7 +144,7 @@ module S3Ranger
92
144
  end
93
145
  end
94
146
 
95
- class List < CmdParse::Command
147
+ class List < BaseCmd
96
148
  attr_accessor :max_entries
97
149
 
98
150
  def initialize
@@ -102,10 +154,18 @@ module S3Ranger
102
154
 
103
155
  @max_entries = 0
104
156
 
157
+ @delimiter = "\t"
158
+
159
+ @has_prefix = true
160
+
105
161
  self.options = CmdParse::OptionParserWrapper.new do |opt|
106
162
  opt.on("-m", "--max-entries=NUM", "Limit the number of entries to output") {|m|
107
163
  @max_entries = m
108
164
  }
165
+
166
+ opt.on("-d", "--delimiter=D", "Charactere used to separate columns") {|d|
167
+ @delimiter = d
168
+ }
109
169
  end
110
170
  end
111
171
 
@@ -119,16 +179,24 @@ module S3Ranger
119
179
  end
120
180
 
121
181
  collection.each {|object|
122
- puts "#{object.key}\t#{object.content_length}\t#{object.last_modified}"
182
+ o = []
183
+ o << object.key
184
+ o << @delimiter
185
+ o << object.content_length
186
+ o << @delimiter
187
+ o << object.last_modified
188
+ puts o.join
123
189
  }
124
190
  end
125
191
  end
126
192
 
127
- class Delete < CmdParse::Command
193
+ class Delete < BaseCmd
128
194
  def initialize
129
- super 'delete', false, false, false
195
+ super 'delete', false, false
130
196
 
131
197
  @short_desc = "Delete a key from a bucket"
198
+
199
+ @has_prefix = 'required'
132
200
  end
133
201
 
134
202
  def run s3, bucket, key, file, args
@@ -138,23 +206,30 @@ module S3Ranger
138
206
  end
139
207
  end
140
208
 
141
- class Url < CmdParse::Command
209
+ class Url < BaseCmd
142
210
  attr_accessor :method
143
211
  attr_accessor :secure
144
212
 
145
213
  def initialize
146
214
  super 'url', false, false
147
215
 
148
- @short_desc = "Generates a url pointing to the given key"
149
- @method = 'read'
216
+ @short_desc = "Generates public urls or authenticated endpoints for the object"
217
+ @description = "Notice that --method and --public are mutually exclusive"
218
+ @method = false
219
+ @public = false
150
220
  @secure = true
151
221
  @expires_in = false
222
+ @has_prefix = 'required'
152
223
 
153
224
  self.options = CmdParse::OptionParserWrapper.new do |opt|
154
- opt.on("-m", "--method", "Options: #{AVAILABLE_METHODS.join ', '}") {|m|
225
+ opt.on("-m", "--method=METHOD", "Options: #{AVAILABLE_METHODS.join ', '}") {|m|
155
226
  @method = m
156
227
  }
157
228
 
229
+ opt.on("-p", "--public", "Generates a public (not authenticated) URL for the object") {|p|
230
+ @public = p
231
+ }
232
+
158
233
  opt.on("--no-ssl", "Generate an HTTP link, no HTTPS") {
159
234
  @secure = false
160
235
  }
@@ -180,20 +255,29 @@ module S3Ranger
180
255
  def run s3, bucket, key, file, args
181
256
  raise WrongUsage.new(nil, "You need to inform a bucket") if not bucket
182
257
  raise WrongUsage.new(nil, "You need to inform a key") if not key
183
- raise WrongUsage.new(nil, "Unknown method #{@method}") unless AVAILABLE_METHODS.include? @method
258
+ raise WrongUsage.new(nil, "Params --method and --public are mutually exclusive") if (@method and @public)
259
+ if not AVAILABLE_METHODS.include? method = @method || 'read'
260
+ raise WrongUsage.new(nil, "Unknown method #{method}")
261
+ end
184
262
 
185
263
  opts = {}
186
264
  opts.merge!({:secure => @secure})
187
- opts.merge!({:expires => @expires_in}) if @expires_in
188
- puts (s3.buckets[bucket].objects[key].url_for @method.to_sym, opts).to_s
265
+
266
+ if @public
267
+ puts (s3.buckets[bucket].objects[key].public_url opts).to_s
268
+ else
269
+ opts.merge!({:expires => @expires_in}) if @expires_in
270
+ puts (s3.buckets[bucket].objects[key].url_for method.to_sym, opts).to_s
271
+ end
189
272
  end
190
273
  end
191
274
 
192
- class Put < CmdParse::Command
275
+ class Put < BaseCmd
193
276
  def initialize
194
277
  super 'put', false, false
195
278
 
196
279
  @short_desc = 'Upload a file to a bucket under a certain prefix'
280
+ @has_prefix = true
197
281
  end
198
282
 
199
283
  def run s3, bucket, key, file, args
@@ -205,10 +289,11 @@ module S3Ranger
205
289
  end
206
290
  end
207
291
 
208
- class Get < CmdParse::Command
292
+ class Get < BaseCmd
209
293
  def initialize
210
294
  super 'get', false, false
211
295
  @short_desc = "Retrieve an object and save to the specified file"
296
+ @has_prefix = 'required'
212
297
  end
213
298
 
214
299
  def run s3, bucket, key, file, args
@@ -226,7 +311,7 @@ module S3Ranger
226
311
  end
227
312
  end
228
313
 
229
- class Sync < CmdParse::Command
314
+ class Sync < BaseCmd
230
315
  attr_accessor :s3
231
316
  attr_accessor :exclude
232
317
  attr_accessor :keep
@@ -244,7 +329,7 @@ module S3Ranger
244
329
  @verbose = false
245
330
 
246
331
  self.options = CmdParse::OptionParserWrapper.new do |opt|
247
- opt.on("-x EXPR", "--exclude=EXPR", "") {|v|
332
+ opt.on("-x EXPR", "--exclude=EXPR", "Skip copying files that matches this pattern. (Ruby REs)") {|v|
248
333
  @exclude = v
249
334
  }
250
335
 
@@ -263,6 +348,33 @@ module S3Ranger
263
348
  end
264
349
  end
265
350
 
351
+ def usage
352
+ "Usage: #{File.basename commandparser.program_name} #{name} source destination"
353
+ end
354
+
355
+ def description
356
+ @description =<<END.strip
357
+
358
+ Where `source' and `description' might be either local or remote
359
+ addresses. A local address is simply a path in your local file
360
+ system. e.g:
361
+
362
+ /tmp/notes.txt
363
+
364
+ A remote address is a combination of the `bucket` name and
365
+ an optional `prefix`:
366
+
367
+ disc.company.com:reports/2013/08/30.html
368
+
369
+ So, a full example would be something like this
370
+
371
+ $ #{File.basename commandparser.program_name} sync Work/reports disc.company.com:reports/2013/08
372
+
373
+ The above line will update the remote folder `reports/2013/08` with the
374
+ contents of the local folder `Work/reports`.
375
+ END
376
+ end
377
+
266
378
  def run s3, bucket, key, file, args
267
379
  @s3 = s3
268
380
  cmd = SyncCommand.new self, *args
@@ -272,6 +384,7 @@ module S3Ranger
272
384
 
273
385
  def run conf
274
386
  cmd = CmdParse::CommandParser.new true
387
+ cmd.program_name = File.basename $0
275
388
  cmd.program_version = S3Ranger::VERSION
276
389
 
277
390
  cmd.options = CmdParse::OptionParserWrapper.new do |opt|
@@ -279,13 +392,13 @@ module S3Ranger
279
392
  end
280
393
 
281
394
  cmd.main_command.short_desc = 'Tool belt for managing your S3 buckets'
282
- cmd.main_command.description = [] \
283
- << "Below you have a list of commands will allow you to manage your content" \
284
- << "stored in S3 buckets. For more information on each command, you can always" \
285
- << "use the `--help' parameter, just like this:" \
286
- << "" \
287
- << " $ #{$0} sync --help" \
395
+ cmd.main_command.description =<<END.strip
396
+ S3Ranger provides a list of commands that will allow you to manage your content
397
+ stored in S3 buckets. To learn about each feature, please use the `help`
398
+ command:
288
399
 
400
+ $ #{File.basename $0} help sync"
401
+ END
289
402
  # Commands used more often
290
403
  cmd.add_command List.new
291
404
  cmd.add_command Delete.new
@@ -299,7 +412,6 @@ module S3Ranger
299
412
  cmd.add_command CreateBucket.new
300
413
  cmd.add_command DeleteBucket.new
301
414
 
302
-
303
415
  # Built-in commands
304
416
  cmd.add_command CmdParse::HelpCommand.new
305
417
  cmd.add_command CmdParse::VersionCommand.new
@@ -332,6 +444,8 @@ module S3Ranger
332
444
  raise FailureFeedback.new("There's no bucket named `#{bucket}'")
333
445
  rescue AWS::S3::Errors::NoSuchKey
334
446
  raise FailureFeedback.new("There's no key named `#{key}' in the bucket `#{bucket}'")
447
+ rescue AWS::S3::Errors::Base => exc
448
+ raise FailureFeedback.new("Error: `#{exc.message}'")
335
449
  end
336
450
  }
337
451
  end
@@ -1,3 +1,30 @@
1
+ # s3ranger - Tool belt for managing your S3 buckets
2
+ #
3
+ # The MIT License (MIT)
4
+ #
5
+ # Copyright (c) 2013 Lincoln de Sousa <lincoln@clarete.li>
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the "Software"), to deal
9
+ # in the Software without restriction, including without limitation the rights
10
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ # copies of the Software, and to permit persons to whom the Software is
12
+ # furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included in
15
+ # all copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ # THE SOFTWARE.
24
+
25
+ # Part of this software was inspired by the original s3sync, so here's their
26
+ # copyright notice:
27
+
1
28
  # This software code is made available "AS IS" without warranties of any
2
29
  # kind. You may copy, display, modify and redistribute the software
3
30
  # code either by itself or as incorporated into your code; provided that
@@ -15,10 +42,15 @@ require 's3ranger/exceptions'
15
42
  module S3Ranger
16
43
 
17
44
  class Config < Hash
18
- def read
45
+
46
+ REQUIRED_VARS = [:AWS_ACCESS_KEY_ID, :AWS_SECRET_ACCESS_KEY]
47
+
48
+ CONFIG_PATHS = ["#{ENV['S3RANGER_PATH']}", "#{ENV['HOME']}/.s3ranger.yml", "/etc/s3ranger.yml"]
49
+
50
+ def read_from_file
19
51
  paths_checked = []
20
52
 
21
- ["#{ENV['S3CONF']}", "#{ENV['HOME']}/.s3conf", "/etc/s3conf"].each do |path|
53
+ CONFIG_PATHS.each do |path|
22
54
 
23
55
  # Filtering some garbage
24
56
  next if path.nil? or path.strip.empty?
@@ -28,16 +60,39 @@ module S3Ranger
28
60
 
29
61
  # Time for the dirty work, let's parse the config file and feed our
30
62
  # internal hash
31
- if File.exists?("#{path}/s3config.yml")
32
- config = YAML.load_file("#{path}/s3config.yml")
63
+ if File.exists? path
64
+ config = YAML.load_file path
33
65
  config.each_pair do |key, value|
34
66
  self[key.upcase.to_sym] = value
35
67
  end
36
- return
68
+ return
37
69
  end
38
70
  end
39
71
 
40
- raise NoConfigFound.new paths_checked
72
+ return paths_checked
73
+ end
74
+
75
+ def read_from_env
76
+ REQUIRED_VARS.each do |v|
77
+ self[v] = ENV[v.to_s] unless ENV[v.to_s].nil?
78
+ end
79
+ end
80
+
81
+ def read
82
+ # Reading from file and then trying from env
83
+ paths_checked = read_from_file
84
+ read_from_env
85
+
86
+ # Checking which variables we have
87
+ not_found = []
88
+
89
+ REQUIRED_VARS.each {|v|
90
+ not_found << v if self[v].nil?
91
+ }
92
+
93
+ # Cleaning possibly empty env var from CONFIG_PATH
94
+ paths = (paths_checked || CONFIG_PATHS).select {|e| !e.empty?}
95
+ raise NoConfigFound.new(not_found, paths) if not_found.count > 0
41
96
  end
42
97
  end
43
98
  end
@@ -1,11 +1,26 @@
1
- # (c) 2013 Lincoln de Sousa <lincoln@clarete.li>
1
+ # s3ranger - Tool belt for managing your S3 buckets
2
2
  #
3
- # This software code is made available "AS IS" without warranties of any
4
- # kind. You may copy, display, modify and redistribute the software
5
- # code either by itself or as incorporated into your code; provided that
6
- # you do not remove any proprietary notices. Your use of this software
7
- # code is at your own risk and you waive any claim against the author
8
- # with respect to your use of this software code.
3
+ # The MIT License (MIT)
4
+ #
5
+ # Copyright (c) 2013 Lincoln de Sousa <lincoln@clarete.li>
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the "Software"), to deal
9
+ # in the Software without restriction, including without limitation the rights
10
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ # copies of the Software, and to permit persons to whom the Software is
12
+ # furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included in
15
+ # all copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ # THE SOFTWARE.
9
24
 
10
25
  module S3Ranger
11
26
 
@@ -14,9 +29,11 @@ module S3Ranger
14
29
 
15
30
  class NoConfigFound < SyncException
16
31
 
32
+ attr_accessor :missing_vars
17
33
  attr_accessor :paths_checked
18
34
 
19
- def initialize(paths_checked)
35
+ def initialize missing_vars, paths_checked
36
+ @missing_vars = missing_vars
20
37
  @paths_checked = paths_checked
21
38
  end
22
39
  end
data/lib/s3ranger/sync.rb CHANGED
@@ -1,4 +1,30 @@
1
- # (c) 2013 Lincoln de Sousa <lincoln@clarete.li>
1
+ # s3ranger - Tool belt for managing your S3 buckets
2
+ #
3
+ # The MIT License (MIT)
4
+ #
5
+ # Copyright (c) 2013 Lincoln de Sousa <lincoln@clarete.li>
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the "Software"), to deal
9
+ # in the Software without restriction, including without limitation the rights
10
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ # copies of the Software, and to permit persons to whom the Software is
12
+ # furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included in
15
+ # all copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ # THE SOFTWARE.
24
+
25
+ # Part of this software was inspired by the original s3sync, so here's their
26
+ # copyright notice:
27
+
2
28
  # (c) 2007 s3sync.net
3
29
  #
4
30
  # This software code is made available "AS IS" without warranties of any
data/lib/s3ranger/util.rb CHANGED
@@ -1,14 +1,29 @@
1
+ # s3ranger - Tool belt for managing your S3 buckets
2
+ #
3
+ # The MIT License (MIT)
4
+ #
5
+ # Copyright (c) 2013 Lincoln de Sousa <lincoln@clarete.li>
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the "Software"), to deal
9
+ # in the Software without restriction, including without limitation the rights
10
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ # copies of the Software, and to permit persons to whom the Software is
12
+ # furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included in
15
+ # all copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ # THE SOFTWARE.
24
+
1
25
  module S3Ranger
2
26
  def S3Ranger.safe_join(parts)
3
27
  File.join *(parts.select {|v| !v.nil? && !v.empty? })
4
28
  end
5
-
6
- # class Object
7
- # # note that this method is already defined in Ruby 1.9
8
- # def define_singleton_method(name, callable = nil, &block)
9
- # block ||= callable
10
- # metaclass = class << self; self; end
11
- # metaclass.send(:define_method, name, block)
12
- # end
13
- # end
14
29
  end
@@ -1,3 +1,27 @@
1
+ # s3ranger - Tool belt for managing your S3 buckets
2
+ #
3
+ # The MIT License (MIT)
4
+ #
5
+ # Copyright (c) 2013 Lincoln de Sousa <lincoln@clarete.li>
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the "Software"), to deal
9
+ # in the Software without restriction, including without limitation the rights
10
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ # copies of the Software, and to permit persons to whom the Software is
12
+ # furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included in
15
+ # all copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ # THE SOFTWARE.
24
+
1
25
  module S3Ranger
2
- VERSION = "0.2.1"
26
+ VERSION = "0.3.0"
3
27
  end
@@ -0,0 +1,2 @@
1
+ AWS_ACCESS_KEY_ID: 11111111111111111111111
2
+ AWS_SECRET_ACCESS_KEY: 222222222222222222222
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: s3ranger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -136,10 +136,10 @@ files:
136
136
  - Gemfile.lock
137
137
  - LICENSE.txt
138
138
  - README.md
139
- - README.txt
140
- - README_s3cmd.txt
141
139
  - Rakefile
142
140
  - bin/s3ranger
141
+ - doc/old/README.txt
142
+ - doc/old/README_s3cmd.txt
143
143
  - lib/s3ranger.rb
144
144
  - lib/s3ranger/cli.rb
145
145
  - lib/s3ranger/config.rb
@@ -147,8 +147,8 @@ files:
147
147
  - lib/s3ranger/sync.rb
148
148
  - lib/s3ranger/util.rb
149
149
  - lib/s3ranger/version.rb
150
- - s3config.yml.example
151
150
  - s3ranger.gemspec
151
+ - s3ranger.yml.example
152
152
  - spec/fixtures/nodes/1.txt
153
153
  - spec/local_source_spec.rb
154
154
  - spec/main_spec.rb
@@ -168,7 +168,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
168
168
  version: '0'
169
169
  segments:
170
170
  - 0
171
- hash: -4070124136594756981
171
+ hash: 1697485139363659678
172
172
  required_rubygems_version: !ruby/object:Gem::Requirement
173
173
  none: false
174
174
  requirements:
@@ -177,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
177
  version: '0'
178
178
  segments:
179
179
  - 0
180
- hash: -4070124136594756981
180
+ hash: 1697485139363659678
181
181
  requirements: []
182
182
  rubyforge_project:
183
183
  rubygems_version: 1.8.24
data/s3config.yml.example DELETED
@@ -1,3 +0,0 @@
1
- aws_access_key_id: 11111111111111111111111
2
- aws_secret_access_key: 222222222222222222222
3
- ssl_cert_dir: /home/user/s3ranger/certs