paperclip 2.7.4 → 2.7.5

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of paperclip might be problematic. Click here for more details.

data/NEWS CHANGED
@@ -1,3 +1,22 @@
1
+ New in 2.7.5:
2
+
3
+ * Feature: :s3_host_name can be a proc
4
+
5
+ New in 2.7.4:
6
+
7
+ * Feature: Allow :escape_url as an option in the defaults
8
+ * Bug fix: Correcting some PATH-based tests.
9
+ * Compatability: Cucumber tests work for Rails 3.2.8
10
+
11
+ New in 2.7.2
12
+
13
+ * Bug fix: Ensured the correct cocaine version.
14
+ * Bug fix: Fixed some tests that shouldn't have been passing.
15
+
16
+ New in 2.7.1:
17
+
18
+ * Bug fix: Fixed the problem with E2BIG errors and an ever-expanding path
19
+
1
20
  New in 2.7.0:
2
21
 
3
22
  * Bug fix: Checking the existence of a file on S3 handles all AWS errors.
@@ -150,7 +150,10 @@ module Paperclip
150
150
  end
151
151
 
152
152
  def s3_host_name
153
- @options[:s3_host_name] || s3_credentials[:s3_host_name] || "s3.amazonaws.com"
153
+ host_name = @options[:s3_host_name]
154
+ host_name = host_name.call(self) if host_name.is_a?(Proc)
155
+
156
+ host_name || s3_credentials[:s3_host_name] || "s3.amazonaws.com"
154
157
  end
155
158
 
156
159
  def s3_host_alias
@@ -1,3 +1,3 @@
1
1
  module Paperclip
2
- VERSION = "2.7.4" unless defined? Paperclip::VERSION
2
+ VERSION = "2.7.5" unless defined? Paperclip::VERSION
3
3
  end
@@ -176,6 +176,26 @@ class S3Test < Test::Unit::TestCase
176
176
  end
177
177
  end
178
178
 
179
+ context "dynamic s3_host_name" do
180
+ setup do
181
+ rebuild_model :storage => :s3,
182
+ :s3_credentials => {},
183
+ :bucket => "bucket",
184
+ :path => ":attachment/:basename.:extension",
185
+ :s3_host_name => lambda {|a| a.instance.value }
186
+ @dummy = Dummy.new
187
+ class << @dummy
188
+ attr_accessor :value
189
+ end
190
+ @dummy.avatar = StringIO.new(".")
191
+ end
192
+
193
+ should "use s3_host_name as a proc if available" do
194
+ @dummy.value = "s3.something.com"
195
+ assert_equal "http://s3.something.com/bucket/avatars/stringio.txt", @dummy.avatar.url(:original, :timestamp => false)
196
+ end
197
+ end
198
+
179
199
  context "An attachment that uses S3 for storage and has styles that return different file types" do
180
200
  setup do
181
201
  rebuild_model :styles => { :large => ['500x500#', :jpg] },
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paperclip
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.4
4
+ version: 2.7.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-08 00:00:00.000000000 Z
12
+ date: 2013-01-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -417,7 +417,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
417
417
  requirements:
418
418
  - ImageMagick
419
419
  rubyforge_project: paperclip
420
- rubygems_version: 1.8.24
420
+ rubygems_version: 1.8.23
421
421
  signing_key:
422
422
  specification_version: 3
423
423
  summary: File attachments as attributes for ActiveRecord