cliaws 1.2.0 → 1.2.1

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.
Files changed (4) hide show
  1. data/History.txt +6 -0
  2. data/bin/clis3 +10 -2
  3. data/lib/cliaws/version.rb +1 -1
  4. metadata +1 -1
data/History.txt CHANGED
@@ -1,3 +1,9 @@
1
+ == 1.2.1 2008-05-30
2
+
3
+ * clis3 put A bucket/ will put to bucket/A, while clis3 put A bucket/B will
4
+ really put to bucket/B. Essentially, the final slash treats the s3_object
5
+ as a directory.
6
+
1
7
  == 1.2.0 2008-05-30
2
8
 
3
9
  * clis3 url returns the authenticated URL to an s3 object
data/bin/clis3 CHANGED
@@ -68,12 +68,14 @@ Main {
68
68
  end
69
69
 
70
70
  def run
71
+ source_name = nil
71
72
  if params["local_files"].given? && params["data"].given? then
72
73
  abort "Cannot give both the --data and local_files parameters at the same time"
73
74
  elsif !params["local_files"].given? && !params["data"].given? then
74
75
  source = STDIN
75
76
  elsif params["local_files"].given? && params["local_files"].values.length == 2 then
76
- source = File.open(params["local_files"].values.shift, "rb")
77
+ source_name = params["local_files"].values.shift
78
+ source = File.open(source_name, "rb")
77
79
  elsif params["local_files"].given? then
78
80
  s3_object = params["local_files"].values.pop
79
81
  targets = params["local_files"].values.map {|filename| filename.to_s}
@@ -90,7 +92,13 @@ Main {
90
92
  source = params["data"].value
91
93
  end
92
94
 
93
- Cliaws.s3.put(source, params["local_files"].values.pop)
95
+ s3_object = params["local_files"].values.pop
96
+ if s3_object =~ /\/$/ then
97
+ raise ArgumentError, "Target is a directory, but input is not a local file -- cannot proceed" if source_name.nil?
98
+ s3_object = File.join(s3_object, File.basename(source_name))
99
+ end
100
+
101
+ Cliaws.s3.put(source, s3_object)
94
102
 
95
103
  rescue Cliaws::S3::UnknownBucket
96
104
  abort "Could not find bucket named #{$!.bucket_name}"
@@ -2,7 +2,7 @@ module Cliaws #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 1
4
4
  MINOR = 2
5
- TINY = 0
5
+ TINY = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cliaws
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Fran\xC3\xA7ois Beausoleil"