s4 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/CHANGELOG +5 -0
  2. data/lib/s4.rb +2 -2
  3. data/test/s4_test.rb +11 -1
  4. metadata +8 -8
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ 0.0.5 - 2011-10-18
2
+
3
+ * Allow spaces in filenames when uploading files.
4
+ * Fix various issues when running tests.
5
+
1
6
  0.0.4 - 2011-09-20
2
7
 
3
8
  * S4#put now returns the URL to the uploaded file.
data/lib/s4.rb CHANGED
@@ -6,7 +6,7 @@ require "json"
6
6
 
7
7
  # Simpler AWS S3 library
8
8
  class S4
9
- VERSION = "0.0.4"
9
+ VERSION = "0.0.5"
10
10
 
11
11
  # sub-resource names which may appear in the query string and also must be
12
12
  # signed against.
@@ -175,7 +175,7 @@ class S4
175
175
  uri = uri(name)
176
176
  req = Net::HTTP::Put.new(uri.request_uri)
177
177
 
178
- content_type = `file -ib #{io.path}`.chomp if !content_type && io.respond_to?(:path)
178
+ content_type = `file -ib '#{io.path}'`.chomp if !content_type && io.respond_to?(:path)
179
179
 
180
180
  req.add_field "Content-Type", content_type
181
181
  req.add_field "Content-Length", io.size
@@ -1,5 +1,6 @@
1
1
  raise "You need to have ENV[\"S3_URL\"] set for the tests to connect to your testing bucket on S3. Format is: 's3://<access key id>:<secret access key>@s3.amazonaws.com/<s4 test bucket>'." unless ENV["S3_URL"]
2
- raise "You need to have ENV[\"S4_NEW_BUCKET\"], which will be dynamically created and destroyed for testing bucket creation. i.e.: 's4-test-bucketthatdoesntexist'." unless ENV["S3_NEW_BUCKET"]
2
+ raise "You need to have ENV[\"S4_NEW_BUCKET\"], which will be dynamically created and destroyed for testing bucket creation, e.g. 's4-test-bucketthatdoesntexist'." unless ENV["S4_NEW_BUCKET"]
3
+ raise "You need to install the command line client for S3 (s3cmd) in order to run the tests" unless system("which s3cmd")
3
4
 
4
5
  require "contest"
5
6
  require "timecop"
@@ -174,6 +175,15 @@ class S4Test < Test::Unit::TestCase
174
175
  assert_equal "text/plain", foo.content_type
175
176
  end
176
177
 
178
+ should "upload foo bar.txt" do
179
+ @s4.upload(fixture("foo bar.txt"))
180
+
181
+ foo = open("http://s3.amazonaws.com/#{TestBucket}/foo%20bar.txt")
182
+
183
+ assert_equal "abc123", foo.read
184
+ assert_equal "text/plain", foo.content_type
185
+ end
186
+
177
187
  should "use given content_type" do
178
188
  @s4.put StringIO.new("abcdef", "r"), "bar.txt", "text/foobar"
179
189
  assert_equal "text/foobar", open("http://s3.amazonaws.com/#{TestBucket}/bar.txt").content_type
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: s4
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,12 +9,12 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-20 00:00:00.000000000 -03:00
12
+ date: 2011-10-18 00:00:00.000000000 -03:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: net-http-persistent
17
- requirement: &2153639160 !ruby/object:Gem::Requirement
17
+ requirement: &2156443380 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '1.7'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2153639160
25
+ version_requirements: *2156443380
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: cutest
28
- requirement: &2153638740 !ruby/object:Gem::Requirement
28
+ requirement: &2156442320 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *2153638740
36
+ version_requirements: *2156442320
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: timecop
39
- requirement: &2153638200 !ruby/object:Gem::Requirement
39
+ requirement: &2156439240 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ~>
@@ -44,7 +44,7 @@ dependencies:
44
44
  version: '0.3'
45
45
  type: :development
46
46
  prerelease: false
47
- version_requirements: *2153638200
47
+ version_requirements: *2156439240
48
48
  description: Simple API for AWS S3
49
49
  email:
50
50
  - ben.alavi@citrusbyte.com