This repository has been archived by the owner on Jul 13, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2161 from thoughtbot/tc-release
Release version 4.3.7
- Loading branch information
Showing
7 changed files
with
128 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
require "active_support/deprecation" | ||
|
||
module Paperclip | ||
class Deprecations | ||
class << self | ||
def check | ||
warn_aws_sdk_v1 if aws_sdk_v1? | ||
warn_outdated_rails if active_model_version < "4.2" | ||
end | ||
|
||
private | ||
|
||
def active_model_version | ||
::ActiveModel::VERSION::STRING | ||
end | ||
|
||
def aws_sdk_v1? | ||
defined?(::AWS) && aws_sdk_version < "2" | ||
end | ||
|
||
def warn_aws_sdk_v1 | ||
warn "[paperclip] [deprecation] AWS SDK v1 has been deprecated in " \ | ||
"paperclip 5. Please consider upgrading to AWS 2 before " \ | ||
"upgrading paperclip." | ||
end | ||
|
||
def warn_outdated_rails | ||
warn "[paperclip] [deprecation] Rails 3.2 and 4.1 are unsupported as " \ | ||
"of Rails 5 release. Please upgrade to Rails 4.2 before " \ | ||
"upgrading paperclip." | ||
end | ||
|
||
def aws_sdk_version | ||
::AWS::VERSION | ||
end | ||
|
||
def warn(message) | ||
ActiveSupport::Deprecation.warn(message) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module Paperclip | ||
VERSION = "4.3.6" unless defined? Paperclip::VERSION | ||
VERSION = "4.3.7".freeze unless defined? Paperclip::VERSION | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
require "spec_helper" | ||
require "aws-sdk" | ||
require "active_support/testing/deprecation" | ||
|
||
describe Paperclip::Deprecations do | ||
include ActiveSupport::Testing::Deprecation | ||
|
||
describe ".check" do | ||
before do | ||
ActiveSupport::Deprecation.silenced = false | ||
end | ||
|
||
after do | ||
ActiveSupport::Deprecation.silenced = true | ||
end | ||
|
||
context "when active model version is < 4.2" do | ||
it "displays deprecation warning" do | ||
Paperclip::Deprecations.stubs(:active_model_version).returns("4.1") | ||
|
||
assert_deprecated("Rails 3.2 and 4.1 are unsupported") do | ||
Paperclip::Deprecations.check | ||
end | ||
end | ||
end | ||
|
||
context "when active model version is 4.2" do | ||
it "do not display deprecation warning" do | ||
Paperclip::Deprecations.stubs(:active_model_version).returns("4.2") | ||
|
||
assert_not_deprecated do | ||
Paperclip::Deprecations.check | ||
end | ||
end | ||
end | ||
|
||
context "when aws sdk version is < 2" do | ||
before do | ||
::AWS.stub! if !defined?(::AWS) | ||
end | ||
|
||
it "displays deprecation warning" do | ||
Paperclip::Deprecations.stubs(:aws_sdk_version).returns("1.68.0") | ||
|
||
assert_deprecated("AWS SDK v1 has been deprecated") do | ||
Paperclip::Deprecations.check | ||
end | ||
end | ||
end | ||
|
||
context "when aws sdk version is 2" do | ||
before do | ||
::AWS.stub! if !defined?(::AWS) | ||
end | ||
|
||
it "do not display deprecation warning" do | ||
Paperclip::Deprecations.stubs(:aws_sdk_version).returns("2.0.0") | ||
|
||
assert_not_deprecated do | ||
Paperclip::Deprecations.check | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
RSpec.configure do |config| | ||
config.before(:all) do | ||
ActiveSupport::Deprecation.silenced = true | ||
end | ||
config.before(:each) do | ||
Paperclip::Deprecations.stubs(:active_model_version).returns("4.2") | ||
Paperclip::Deprecations.stubs(:aws_sdk_version).returns("2.0.0") | ||
end | ||
end |