paperclip 4.3.2 → 4.3.3

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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0e139df6e8e24d624d436566d794642b848aba04
4
- data.tar.gz: 4ebe1f32b8ce077f35d56ab232d07f71a3e39267
3
+ metadata.gz: 79d2d73240dea47e979d28e67b670fe4ebe03b1c
4
+ data.tar.gz: 1f826ab0f3018bf26378e9e37eff2280cc8d6ada
5
5
  SHA512:
6
- metadata.gz: 445e6c03d40f5c72e2cc45eb818685917d450607a37c37ecb413be50534036a4606572a2f1990c851705fe5c767e3861700732de81894633bcb54b26ec50b36a
7
- data.tar.gz: 2ab2c5ba3f14288f3e906d7f6410b2a1cc2727ec7adeada4c6fd6ce34b81c2270df75a4391447b047de8ab5797bc3c898ab3181fd03bded34b1329277fa2c30d
6
+ metadata.gz: ebd4d6366d1686162a153b30c68777d9b27a9177e0b00e6a7489091bc0b656e8917fb35840dfe13c873c9e154e7c37fa6c10c4d0d1e409c3e9d2980eef325393
7
+ data.tar.gz: fdc49800c9d04ffef94feb901e46de2481ba3a3eca536551b5afe6cc997e315a1be075ccf48f02ce45cfd1da513bb339e4565c58cff7e546ea7d39494883598e
data/NEWS CHANGED
@@ -1,3 +1,7 @@
1
+ 4.3.3 (1/29/2016):
2
+
3
+ *Improvement: Add deprecation warnings in preparation for release of v5.0
4
+
1
5
  4.3.2 (11/18/2015):
2
6
 
3
7
  * Performance: Reduce memory allocations (#2056)
@@ -56,6 +56,7 @@ require 'paperclip/has_attached_file'
56
56
  require 'paperclip/attachment_registry'
57
57
  require 'paperclip/filename_cleaner'
58
58
  require 'paperclip/rails_environment'
59
+ require "paperclip/deprecations"
59
60
 
60
61
  begin
61
62
  # Use mime/types/columnar if available, for reduced memory usage
@@ -191,6 +192,7 @@ module Paperclip
191
192
  # end
192
193
  # end
193
194
  def has_attached_file(name, options = {})
195
+ Paperclip::Deprecations.check
194
196
  HasAttachedFile.define_on(self, name, options)
195
197
  end
196
198
  end
@@ -0,0 +1,42 @@
1
+ require "active_support/deprecation"
2
+
3
+ module Paperclip
4
+ class Deprecations
5
+ class << self
6
+ def check
7
+ warn_aws_sdk_v1 if aws_sdk_v1?
8
+ warn_outdated_rails if active_record_version < "4.2"
9
+ end
10
+
11
+ private
12
+
13
+ def active_record_version
14
+ ::ActiveRecord::VERSION::STRING
15
+ end
16
+
17
+ def aws_sdk_v1?
18
+ defined?(::AWS) && aws_sdk_version < "2"
19
+ end
20
+
21
+ def warn_aws_sdk_v1
22
+ warn "[paperclip] [deprecation] AWS SDK v1 has been deprecated in " \
23
+ "paperclip 5. Please consider upgrading to AWS 2 before " \
24
+ "upgrading paperclip."
25
+ end
26
+
27
+ def warn_outdated_rails
28
+ warn "[paperclip] [deprecation] Rails 3.2 and 4.1 are unsupported as " \
29
+ "of Rails 5 release. Please upgrade to Rails 4.2 before " \
30
+ "upgrading paperclip."
31
+ end
32
+
33
+ def aws_sdk_version
34
+ ::AWS::VERSION
35
+ end
36
+
37
+ def warn(message)
38
+ ActiveSupport::Deprecation.warn(message)
39
+ end
40
+ end
41
+ end
42
+ end
@@ -1,3 +1,3 @@
1
1
  module Paperclip
2
- VERSION = "4.3.2" unless defined? Paperclip::VERSION
2
+ VERSION = "4.3.3" unless defined? Paperclip::VERSION
3
3
  end
@@ -0,0 +1,65 @@
1
+ require "spec_helper"
2
+ require "aws-sdk"
3
+ require "active_support/testing/deprecation"
4
+
5
+ describe Paperclip::Deprecations do
6
+ include ActiveSupport::Testing::Deprecation
7
+
8
+ describe ".check" do
9
+ before do
10
+ ActiveSupport::Deprecation.silenced = false
11
+ end
12
+
13
+ after do
14
+ ActiveSupport::Deprecation.silenced = true
15
+ end
16
+
17
+ context "when active record version is < 4.2" do
18
+ it "displays deprecation warning" do
19
+ Paperclip::Deprecations.stubs(:active_record_version).returns("4.1")
20
+
21
+ assert_deprecated("Rails 3.2 and 4.1 are unsupported") do
22
+ Paperclip::Deprecations.check
23
+ end
24
+ end
25
+ end
26
+
27
+ context "when active record version is 4.2" do
28
+ it "do not display deprecation warning" do
29
+ Paperclip::Deprecations.stubs(:active_record_version).returns("4.2")
30
+
31
+ assert_not_deprecated do
32
+ Paperclip::Deprecations.check
33
+ end
34
+ end
35
+ end
36
+
37
+ context "when aws sdk version is < 2" do
38
+ before do
39
+ ::AWS.stub! if !defined?(::AWS)
40
+ end
41
+
42
+ it "displays deprecation warning" do
43
+ Paperclip::Deprecations.stubs(:aws_sdk_version).returns("1.68.0")
44
+
45
+ assert_deprecated("AWS SDK v1 has been deprecated") do
46
+ Paperclip::Deprecations.check
47
+ end
48
+ end
49
+ end
50
+
51
+ context "when aws sdk version is 2" do
52
+ before do
53
+ ::AWS.stub! if !defined?(::AWS)
54
+ end
55
+
56
+ it "do not display deprecation warning" do
57
+ Paperclip::Deprecations.stubs(:aws_sdk_version).returns("2.0.0")
58
+
59
+ assert_not_deprecated do
60
+ Paperclip::Deprecations.check
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
@@ -109,6 +109,7 @@ describe Paperclip do
109
109
 
110
110
  context "An ActiveRecord model with an 'avatar' attachment" do
111
111
  before do
112
+ Paperclip::Deprecations.stubs(:check)
112
113
  rebuild_model path: "tmp/:class/omg/:style.:extension"
113
114
  @file = File.new(fixture_file("5k.png"), 'rb')
114
115
  end
@@ -150,6 +151,10 @@ describe Paperclip do
150
151
  end
151
152
  end
152
153
 
154
+ it "calls Paperclip::Deprecations.check" do
155
+ expect(Paperclip::Deprecations).to have_received(:check)
156
+ end
157
+
153
158
  context "with a subclass" do
154
159
  before do
155
160
  class ::SubDummy < Dummy; end
@@ -0,0 +1,9 @@
1
+ RSpec.configure do |config|
2
+ config.before(:all) do
3
+ ActiveSupport::Deprecation.silenced = true
4
+ end
5
+ config.before(:each) do
6
+ Paperclip::Deprecations.stubs(:active_record_version).returns("4.2")
7
+ Paperclip::Deprecations.stubs(:aws_sdk_version).returns("2.0.0")
8
+ end
9
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paperclip
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.2
4
+ version: 4.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Yurek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-19 00:00:00.000000000 Z
11
+ date: 2016-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -429,6 +429,7 @@ files:
429
429
  - lib/paperclip/attachment_registry.rb
430
430
  - lib/paperclip/callbacks.rb
431
431
  - lib/paperclip/content_type_detector.rb
432
+ - lib/paperclip/deprecations.rb
432
433
  - lib/paperclip/errors.rb
433
434
  - lib/paperclip/file_command_content_type_detector.rb
434
435
  - lib/paperclip/filename_cleaner.rb
@@ -499,6 +500,7 @@ files:
499
500
  - spec/paperclip/attachment_registry_spec.rb
500
501
  - spec/paperclip/attachment_spec.rb
501
502
  - spec/paperclip/content_type_detector_spec.rb
503
+ - spec/paperclip/deprecations_spec.rb
502
504
  - spec/paperclip/file_command_content_type_detector_spec.rb
503
505
  - spec/paperclip/filename_cleaner_spec.rb
504
506
  - spec/paperclip/geometry_detector_spec.rb
@@ -550,6 +552,7 @@ files:
550
552
  - spec/paperclip/validators_spec.rb
551
553
  - spec/spec_helper.rb
552
554
  - spec/support/assertions.rb
555
+ - spec/support/deprecations.rb
553
556
  - spec/support/fake_model.rb
554
557
  - spec/support/fake_rails.rb
555
558
  - spec/support/fixtures/12k.png
@@ -600,7 +603,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
600
603
  requirements:
601
604
  - ImageMagick
602
605
  rubyforge_project:
603
- rubygems_version: 2.4.5.1
606
+ rubygems_version: 2.5.1
604
607
  signing_key:
605
608
  specification_version: 4
606
609
  summary: File attachments as attributes for ActiveRecord
@@ -628,6 +631,7 @@ test_files:
628
631
  - spec/paperclip/attachment_registry_spec.rb
629
632
  - spec/paperclip/attachment_spec.rb
630
633
  - spec/paperclip/content_type_detector_spec.rb
634
+ - spec/paperclip/deprecations_spec.rb
631
635
  - spec/paperclip/file_command_content_type_detector_spec.rb
632
636
  - spec/paperclip/filename_cleaner_spec.rb
633
637
  - spec/paperclip/geometry_detector_spec.rb
@@ -679,6 +683,7 @@ test_files:
679
683
  - spec/paperclip/validators_spec.rb
680
684
  - spec/spec_helper.rb
681
685
  - spec/support/assertions.rb
686
+ - spec/support/deprecations.rb
682
687
  - spec/support/fake_model.rb
683
688
  - spec/support/fake_rails.rb
684
689
  - spec/support/fixtures/12k.png
@@ -708,3 +713,4 @@ test_files:
708
713
  - spec/support/rails_helpers.rb
709
714
  - spec/support/test_data.rb
710
715
  - spec/support/version_helper.rb
716
+ has_rdoc: