carrierwave-aws 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f9be17289878c899ad526a81fcb3313bdf15f1ca
4
- data.tar.gz: f0e6f3c4095ad304a3130e5695af7eff750ff01a
3
+ metadata.gz: a92faaa25331fa4e10ea844d8fe5b90519c4ae87
4
+ data.tar.gz: 68352ca1f0ee3f20985a3c0063b360698d56566c
5
5
  SHA512:
6
- metadata.gz: 87c746d630232b56ac8a36e8bbbd2cad987ad04422c73fc089daf19d359a448750a5d6dc936b741df502e252684bcebc47ab1c3f93889feb023b27facdbe0c09
7
- data.tar.gz: 1c09c4a9ae97ca158460ff80988dfb07bdda401604589e43f947f1d59ab767a29e7d95bbca21854dc81c6be23eb807298f2081ee1f06935e1f305c17a2b552ba
6
+ metadata.gz: f9fddccad1b717d22910f426930192bbad53b65e1fc88d979d912893f68e1ee2e088e39c9c4e3209d3a6eafcc6a948fd53764e9f563c64f7ffd7d5adc826aadc
7
+ data.tar.gz: 07b0a3b8e7c45b095842d15238f660accd2893c75a6ced507809d5049a00668dcf0257b8ada8c6d580f627114862c018778a3f53364744001a2300857ebe01d8
data/.travis.yml CHANGED
@@ -1,5 +1,20 @@
1
+ ---
1
2
  language: ruby
2
3
  rvm:
3
- - 1.9.3
4
- - 2.0.0
4
+ - 1.9.3
5
+ - 2.0.0
5
6
  script: bundle exec rspec spec
7
+ env:
8
+ global:
9
+ - secure: |-
10
+ A6i5I0Y+ifiJr2yotcjMBOZxRnhaPbuDTuMW3PMMUaqHsCc2A5Tqemenb7WG
11
+ awCHOE6i9fuO/qAOPR3iKVdkR7Qv//CDtFZ9pZ7uiqVxfz1kYbv4aoPm1IvJ
12
+ Kd6Nons/AjkD+yhobP8WgiIZI/QcSylDZYNCasTwQlfOCdYLnag=
13
+ - secure: |-
14
+ IE4oVY30L0OH10J/poiEZ1PyFZgPY7dH1FneJI5OeYJJ8GfEHoLuMJXgBmyX
15
+ mC2v2PGK0pQTKGKFVV1mLhKdCzeLRCSMFqNvVo6blSoMLZoM1kj3sbU0kiIW
16
+ qAgafLka3iyxQnPsvfmjLVei3h+HOUIUV6QmagjcMfZREHfTDZk=
17
+ - secure: |-
18
+ B75vnSCFTnQgCP4dmz78VN/WWj88Tpnh4cjUCU0cQjQ5M7oQ0KTbM0d7WDyf
19
+ rf0F+B9OihBtLNQWqjocRvNH0dU5OzBLCC9DVolUgNwOdNTHW2I7CwlxJ5t7
20
+ ljQTxzPP+tFASwzBHjywbo7n0EX3efT5UOZhbD9LZL93X4SOlyU=
data/HISTORY.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## Version 0.3.2 2013-08-06
2
+
3
+ * And we're back to passing the path. An updated integration test confirms it
4
+ is working properly.
5
+
1
6
  ## Version 0.3.1 2013-05-23
2
7
 
3
8
  * Use the "alternate" object writing syntax. The primary method (as documented)
data/README.md CHANGED
@@ -3,6 +3,7 @@
3
3
  [![Build Status](https://travis-ci.org/sorentwo/carrierwave-aws.png?branch=master)](https://travis-ci.org/sorentwo/carrierwave-aws)
4
4
  [![Code Climate](https://codeclimate.com/github/sorentwo/carrierwave-aws.png)](https://codeclimate.com/github/sorentwo/carrierwave-aws)
5
5
  [![Gem Version](https://badge.fury.io/rb/carrierwave-aws.png)](http://badge.fury.io/rb/carrierwave-aws)
6
+ [![Dependency Status](https://gemnasium.com/sorentwo/carrierwave-aws.png)](https://gemnasium.com/sorentwo/carrierwave-aws)
6
7
 
7
8
  Use the officially supported AWS-SDK library for S3 storage rather than relying
8
9
  on fog. There are several things going for it:
@@ -12,12 +13,12 @@ on fog. There are several things going for it:
12
13
  * Fewer dependencies
13
14
  * Clear documentation
14
15
 
15
- Here is a simple comparison table [02/04/2013]
16
+ Here is a simple comparison table [07/17/2013]
16
17
 
17
18
  | Library | Disk Space | Lines of Code | Boot Time | Runtime Deps | Develop Deps |
18
19
  | ------- | ---------- | ------------- | --------- | ------------ | ------------ |
19
20
  | fog | 28.0M | 133469 | 0.693 | 9 | 11 |
20
- | aws-sdk | 4.4M | 80017 | 0.098 | 3 | 8 |
21
+ | aws-sdk | 5.4M | 90290 | 0.098 | 3 | 8 |
21
22
 
22
23
  ## Installation
23
24
 
@@ -38,6 +39,7 @@ CarrierWave.configure do |config|
38
39
  config.storage = :aws
39
40
  config.aws_bucket = ENV['S3_BUCKET_NAME']
40
41
  config.aws_acl = :public_read
42
+ config.asset_host = 'http://example.com'
41
43
  config.aws_authenticated_url_expiration = 60 * 60 * 24 * 365
42
44
 
43
45
  config.aws_credentials = {
@@ -17,7 +17,7 @@ Gem::Specification.new do |gem|
17
17
  gem.require_paths = ['lib']
18
18
 
19
19
  gem.add_dependency 'carrierwave', '>= 0.7.0'
20
- gem.add_dependency 'aws-sdk', '~> 1.8.5'
20
+ gem.add_dependency 'aws-sdk', '>= 1.8.0'
21
21
 
22
- gem.add_development_dependency 'rspec', '~> 2.12.0'
22
+ gem.add_development_dependency 'rspec', '~> 2.14.0'
23
23
  end
@@ -1,5 +1,5 @@
1
1
  module Carrierwave
2
2
  module AWS
3
- VERSION = '0.3.1'
3
+ VERSION = '0.3.2'
4
4
  end
5
5
  end
@@ -76,7 +76,7 @@ module CarrierWave
76
76
  @file = bucket.objects[path].write({
77
77
  acl: uploader.aws_acl,
78
78
  content_type: new_file.content_type,
79
- file: new_file.file
79
+ file: new_file.path
80
80
  }.merge(uploader.aws_attributes || {}))
81
81
 
82
82
  true
@@ -99,7 +99,11 @@ module CarrierWave
99
99
  end
100
100
 
101
101
  def public_url
102
- file.public_url.to_s
102
+ if uploader.asset_host
103
+ "#{uploader.asset_host}/#{path}"
104
+ else
105
+ file.public_url.to_s
106
+ end
103
107
  end
104
108
 
105
109
  private
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe CarrierWave::Storage::AWS do
4
4
  let(:credentials) { { access_key_id: 'abc', secret_access_key: '123' } }
5
- let(:uploader) { mock(:uploader, aws_credentials: credentials) }
5
+ let(:uploader) { double(:uploader, aws_credentials: credentials) }
6
6
 
7
7
  subject(:storage) do
8
8
  CarrierWave::Storage::AWS.new(uploader)
@@ -20,7 +20,7 @@ describe CarrierWave::Storage::AWS do
20
20
  end
21
21
 
22
22
  it 'caches connections by credentials' do
23
- AWS::S3.should_receive(:new).with(credentials).and_return(mock)
23
+ AWS::S3.should_receive(:new).with(credentials).and_return(double)
24
24
 
25
25
  storage.connection.should === storage.connection
26
26
  end
@@ -29,10 +29,10 @@ end
29
29
 
30
30
  describe CarrierWave::Storage::AWS::File do
31
31
  let(:objects) { { 'files/1/file.txt' => file } }
32
- let(:bucket) { mock(:bucket, objects: objects) }
33
- let(:connection) { mock(:connection, buckets: { 'example-com' => bucket }) }
34
- let(:file) { mock(:file, read: '0101010') }
35
- let(:uploader) { mock(:uploader, aws_bucket: 'example-com') }
32
+ let(:bucket) { double(:bucket, objects: objects) }
33
+ let(:connection) { double(:connection, buckets: { 'example-com' => bucket }) }
34
+ let(:file) { double(:file, read: '0101010') }
35
+ let(:uploader) { double(:uploader, aws_bucket: 'example-com', asset_host: nil) }
36
36
  let(:path) { 'files/1/file.txt' }
37
37
 
38
38
  subject(:aws_file) do
@@ -76,5 +76,12 @@ describe CarrierWave::Storage::AWS::File do
76
76
 
77
77
  aws_file.url
78
78
  end
79
+
80
+ it 'uses the asset_host and file path if asset_host is set' do
81
+ uploader.stub(aws_acl: :public_read)
82
+ uploader.stub(asset_host: 'http://example.com')
83
+
84
+ aws_file.url.should eql 'http://example.com/files/1/file.txt'
85
+ end
79
86
  end
80
87
  end
@@ -16,14 +16,18 @@ if ENV['S3_BUCKET_NAME']
16
16
  end
17
17
 
18
18
  it 'uploads the file to the configured bucket' do
19
+ uploader = Class.new(CarrierWave::Uploader::Base) do
20
+ def filename; 'image.png'; end
21
+ end
22
+
19
23
  image = File.open('spec/fixtures/image.png', 'r')
20
- uploader = Class.new(CarrierWave::Uploader::Base)
21
24
  instance = uploader.new
22
25
 
23
- expect {
24
- instance.store!(image)
25
- instance.retrieve_from_store!('image_file.png')
26
- }.to_not raise_error
26
+ instance.store!(image)
27
+ instance.retrieve_from_store!('image.png')
28
+
29
+ expect(instance.file.size).to be_nonzero
30
+ expect(image.size).to eq(instance.file.size)
27
31
  end
28
32
  end
29
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carrierwave-aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Parker Selbert
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-23 00:00:00.000000000 Z
11
+ date: 2013-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: carrierwave
@@ -28,30 +28,30 @@ dependencies:
28
28
  name: aws-sdk
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
- version: 1.8.5
33
+ version: 1.8.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
- version: 1.8.5
40
+ version: 1.8.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ~>
46
46
  - !ruby/object:Gem::Version
47
- version: 2.12.0
47
+ version: 2.14.0
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ~>
53
53
  - !ruby/object:Gem::Version
54
- version: 2.12.0
54
+ version: 2.14.0
55
55
  description: Use aws-sdk for S3 support in CarrierWave
56
56
  email:
57
57
  - parker@sorentwo.com