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.
- data/History.txt +6 -0
- data/bin/clis3 +10 -2
- data/lib/cliaws/version.rb +1 -1
- 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
|
-
|
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
|
-
|
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}"
|
data/lib/cliaws/version.rb
CHANGED