carrierwave-aws 0.2.0 → 0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fde7bde0d28fce39233eaaeec5485fa7a9373941
4
- data.tar.gz: 9fea88b1818a9332022752140de2e9abb464f7f6
3
+ metadata.gz: 022aaea7ed4d3e117c7607e00ce672bf4f299b0d
4
+ data.tar.gz: 423d96993911c11c21b443f20086482af5d3072e
5
5
  SHA512:
6
- metadata.gz: f99e64f9f0c911d34ccc4f4c177a5239d3b69efd65a13587cd7107d96c80cc868e38c79a97c2797d189e4c4929bb99d608f0be89cd898bc838b7f5d91d54e8d8
7
- data.tar.gz: bce06c56d190d3c2f234b57fd251aa5aa5d0955dbc33a7a5f6fc12d759423804063454196f6743385ce65d7b59c46fb747987c10670ef4d46b838d8f842a9087
6
+ metadata.gz: d808008e5023f518b901581476e6152c13f9b484d6506c80d8accf9033159ad6e9f90e5d7ff77293a45d02068d2ccdfdbe5f4468f702a869e14b0945f0173924
7
+ data.tar.gz: 1fedff06ff918da9b9b808e453b726a8a1fcf3c8624bf18e880409ead4a3a7ac5ef942f01a01e6fca4b5e00259a5654dac251e0001b6d7ca17d1f0ceda2f01ee
data/HISTORY.md CHANGED
@@ -1,12 +1,17 @@
1
- === Version 0.2.0 2013-04-19
1
+ ## Version 0.2.1 2013-04-20
2
+
3
+ * Provide a `to_file` method on AWS::File in an attempt to prevent errors when
4
+ re-uploading a cached file.
5
+
6
+ ## Version 0.2.0 2013-04-19
2
7
 
3
8
  * Update aws-sdk depdendency to 1.8.5
4
9
  * Clean up some internal storage object passing
5
10
 
6
- === Version 0.1.1 2013-04-09
11
+ ## Version 0.1.1 2013-04-09
7
12
 
8
13
  * Fix storage bug when if `aws_attributes` is blank [#1]
9
14
 
10
- === Version 0.1.0 2013-02-04
15
+ ## Version 0.1.0 2013-02-04
11
16
 
12
17
  * Initial release, experimental with light expectation based spec coverage.
@@ -1,5 +1,5 @@
1
1
  module Carrierwave
2
2
  module AWS
3
- VERSION = '0.2.0'
3
+ VERSION = '0.2.1'
4
4
  end
5
5
  end
@@ -25,6 +25,7 @@ module CarrierWave
25
25
  end
26
26
 
27
27
  class File
28
+ attr_writer :content_type
28
29
  attr_reader :uploader, :connection, :path
29
30
 
30
31
  def initialize(uploader, connection, path)
@@ -41,10 +42,6 @@ module CarrierWave
41
42
  @content_type || file.content_type
42
43
  end
43
44
 
44
- def content_type=(new_content_type)
45
- @content_type = new_content_type
46
- end
47
-
48
45
  def delete
49
46
  file.delete
50
47
  end
@@ -53,6 +50,16 @@ module CarrierWave
53
50
  path.split('.').last
54
51
  end
55
52
 
53
+ def exists?
54
+ !!file
55
+ end
56
+
57
+ def filename(options = {})
58
+ if file_url = url(options)
59
+ file_url.gsub(/.*\/(.*?$)/, '\1')
60
+ end
61
+ end
62
+
56
63
  def read
57
64
  file.read
58
65
  end
@@ -61,10 +68,6 @@ module CarrierWave
61
68
  file.content_length
62
69
  end
63
70
 
64
- def exists?
65
- !!file
66
- end
67
-
68
71
  def store(new_file)
69
72
  aws_file = new_file.to_file
70
73
 
@@ -78,12 +81,8 @@ module CarrierWave
78
81
  true
79
82
  end
80
83
 
81
- def authenticated_url
82
- file.url_for(:read, expires: uploader.aws_authenticated_url_expiration).to_s
83
- end
84
-
85
- def public_url
86
- file.public_url.to_s
84
+ def to_file
85
+ file
87
86
  end
88
87
 
89
88
  def url(options = {})
@@ -94,10 +93,12 @@ module CarrierWave
94
93
  end
95
94
  end
96
95
 
97
- def filename(options = {})
98
- if file_url = url(options)
99
- file_url.gsub(/.*\/(.*?$)/, '\1')
100
- end
96
+ def authenticated_url
97
+ file.url_for(:read, expires: uploader.aws_authenticated_url_expiration).to_s
98
+ end
99
+
100
+ def public_url
101
+ file.public_url.to_s
101
102
  end
102
103
 
103
104
  private
@@ -41,6 +41,12 @@ describe CarrierWave::Storage::AWS::File do
41
41
  end
42
42
  end
43
43
 
44
+ describe '#to_file' do
45
+ it 'returns the internal file instance' do
46
+ aws_file.to_file.should be(file)
47
+ end
48
+ end
49
+
44
50
  describe '#authenticated_url' do
45
51
  it 'requests a url for reading with the configured expiration' do
46
52
  uploader.stub(aws_authenticated_url_expiration: 60)
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.2.0
4
+ version: 0.2.1
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-04-19 00:00:00.000000000 Z
11
+ date: 2013-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: carrierwave
@@ -72,8 +72,8 @@ files:
72
72
  - lib/carrierwave/aws/version.rb
73
73
  - lib/carrierwave/storage/aws.rb
74
74
  - spec/carrierwave-aws_spec.rb
75
+ - spec/carrierwave/storage/aws_spec.rb
75
76
  - spec/spec_helper.rb
76
- - spec/storage/aws_spec.rb
77
77
  homepage: https://github.com/sorentwo/carrierwave-aws
78
78
  licenses: []
79
79
  metadata: {}
@@ -99,5 +99,5 @@ specification_version: 4
99
99
  summary: A slimmer alternative to using Fog for S3 support in CarrierWave
100
100
  test_files:
101
101
  - spec/carrierwave-aws_spec.rb
102
+ - spec/carrierwave/storage/aws_spec.rb
102
103
  - spec/spec_helper.rb
103
- - spec/storage/aws_spec.rb