mirror of
https://github.com/paper-trail-gem/paper_trail.git
synced 2022-11-09 11:33:19 -05:00
Drop support for rails 4.0 and 4.1
EoL for both was 2016-06-30 http://weblog.rubyonrails.org/2016/6/30/Rails-5-0-final/ PT continued to support them for 15 months after EoL.
This commit is contained in:
parent
3dccd02db7
commit
408aa74dc6
9 changed files with 14 additions and 49 deletions
|
@ -24,7 +24,6 @@ before_script:
|
||||||
- sh -c "if [ \"$DB\" = 'postgres' ]; then psql -c 'create database paper_trail_foo;' -U postgres; fi"
|
- sh -c "if [ \"$DB\" = 'postgres' ]; then psql -c 'create database paper_trail_foo;' -U postgres; fi"
|
||||||
|
|
||||||
gemfile:
|
gemfile:
|
||||||
- gemfiles/ar_4.0.gemfile
|
|
||||||
- gemfiles/ar_4.2.gemfile
|
- gemfiles/ar_4.2.gemfile
|
||||||
- gemfiles/ar_5.0.gemfile
|
- gemfiles/ar_5.0.gemfile
|
||||||
- gemfiles/ar_5.1.gemfile
|
- gemfiles/ar_5.1.gemfile
|
||||||
|
|
10
Appraisals
10
Appraisals
|
@ -7,20 +7,16 @@
|
||||||
# > the version from the appraisal takes precedence.
|
# > the version from the appraisal takes precedence.
|
||||||
# > https://github.com/thoughtbot/appraisal
|
# > https://github.com/thoughtbot/appraisal
|
||||||
|
|
||||||
appraise "ar-4.0" do
|
|
||||||
gem "activerecord", "~> 4.0"
|
|
||||||
end
|
|
||||||
|
|
||||||
appraise "ar-4.2" do
|
appraise "ar-4.2" do
|
||||||
gem "activerecord", "~> 4.2"
|
gem "activerecord", "~> 4.2.9"
|
||||||
end
|
end
|
||||||
|
|
||||||
appraise "ar-5.0" do
|
appraise "ar-5.0" do
|
||||||
gem "activerecord", "~> 5.0.3"
|
gem "activerecord", "~> 5.0.6"
|
||||||
gem "rails-controller-testing"
|
gem "rails-controller-testing"
|
||||||
end
|
end
|
||||||
|
|
||||||
appraise "ar-5.1" do
|
appraise "ar-5.1" do
|
||||||
gem "rails", "5.1.1"
|
gem "activerecord", "~> 5.1.4"
|
||||||
gem "rails-controller-testing"
|
gem "rails-controller-testing"
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,7 +7,9 @@ recommendations of [keepachangelog.com](http://keepachangelog.com/).
|
||||||
|
|
||||||
### Breaking Changes
|
### Breaking Changes
|
||||||
|
|
||||||
- Drop support for ruby 2.1, whose EoL was 2017-04-01
|
- Drop support for rails 4.0 and 4.1, whose EoL was
|
||||||
|
[2016-06-30](http://weblog.rubyonrails.org/2016/6/30/Rails-5-0-final/)
|
||||||
|
- Drop support for ruby 2.1, whose EoL was [2017-04-01](http://bit.ly/2ppWDYa)
|
||||||
- [#803](https://github.com/airblade/paper_trail/issues/803) -
|
- [#803](https://github.com/airblade/paper_trail/issues/803) -
|
||||||
where_object_changes no longer supports reading json from a text column
|
where_object_changes no longer supports reading json from a text column
|
||||||
|
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
# This file was generated by Appraisal
|
|
||||||
|
|
||||||
source "https://rubygems.org"
|
|
||||||
|
|
||||||
gem "activerecord", "~> 4.0"
|
|
||||||
|
|
||||||
gemspec path: "../"
|
|
|
@ -1,9 +0,0 @@
|
||||||
# This file was generated by Appraisal
|
|
||||||
|
|
||||||
source "https://rubygems.org"
|
|
||||||
|
|
||||||
gem "rails", github: "rails/rails"
|
|
||||||
gem "rspec-rails", "~> 3.5.1"
|
|
||||||
gem "rails-controller-testing"
|
|
||||||
|
|
||||||
gemspec path: "../"
|
|
|
@ -1,10 +1,7 @@
|
||||||
module PaperTrail
|
module PaperTrail
|
||||||
# Represents the "paper trail" for a single record.
|
# Represents the "paper trail" for a single record.
|
||||||
class RecordTrail
|
class RecordTrail
|
||||||
# The respond_to? check here is specific to ActiveRecord 4.0 and can be
|
RAILS_GTE_5_1 = ::ActiveRecord.gem_version >= ::Gem::Version.new("5.1.0.beta1")
|
||||||
# removed when support for ActiveRecord < 4.2 is dropped.
|
|
||||||
RAILS_GTE_5_1 = ::ActiveRecord.respond_to?(:gem_version) &&
|
|
||||||
::ActiveRecord.gem_version >= ::Gem::Version.new("5.1.0.beta1")
|
|
||||||
|
|
||||||
def initialize(record)
|
def initialize(record)
|
||||||
@record = record
|
@record = record
|
||||||
|
@ -477,9 +474,7 @@ module PaperTrail
|
||||||
if @in_after_callback && RAILS_GTE_5_1
|
if @in_after_callback && RAILS_GTE_5_1
|
||||||
@record.attribute_before_last_save(attr_name.to_s)
|
@record.attribute_before_last_save(attr_name.to_s)
|
||||||
else
|
else
|
||||||
# TODO: after dropping support for rails 4.0, remove send, because
|
@record.attribute_was(attr_name.to_s)
|
||||||
# attribute_was is no longer private.
|
|
||||||
@record.send(:attribute_was, attr_name.to_s)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -12,10 +12,7 @@ module PaperTrail
|
||||||
extend ::ActiveSupport::Concern
|
extend ::ActiveSupport::Concern
|
||||||
|
|
||||||
included do
|
included do
|
||||||
# The respond_to? check here is specific to ActiveRecord 4.0 and can be
|
if ::ActiveRecord.gem_version >= Gem::Version.new("5.0")
|
||||||
# removed when support for ActiveRecord < 4.2 is dropped.
|
|
||||||
if ::ActiveRecord.respond_to?(:gem_version) &&
|
|
||||||
::ActiveRecord.gem_version >= Gem::Version.new("5.0")
|
|
||||||
belongs_to :item, polymorphic: true, optional: true
|
belongs_to :item, polymorphic: true, optional: true
|
||||||
else
|
else
|
||||||
belongs_to :item, polymorphic: true
|
belongs_to :item, polymorphic: true
|
||||||
|
|
|
@ -26,7 +26,7 @@ has been destroyed.
|
||||||
s.required_ruby_version = ">= 2.2.0"
|
s.required_ruby_version = ">= 2.2.0"
|
||||||
|
|
||||||
# Rails does not follow semver, makes breaking changes in minor versions.
|
# Rails does not follow semver, makes breaking changes in minor versions.
|
||||||
s.add_dependency "activerecord", [">= 4.0", "< 5.2"]
|
s.add_dependency "activerecord", [">= 4.2", "< 5.2"]
|
||||||
s.add_dependency "request_store", "~> 1.1"
|
s.add_dependency "request_store", "~> 1.1"
|
||||||
|
|
||||||
s.add_development_dependency "appraisal", "~> 2.1"
|
s.add_development_dependency "appraisal", "~> 2.1"
|
||||||
|
@ -34,7 +34,7 @@ has been destroyed.
|
||||||
s.add_development_dependency "ffaker", "~> 2.5"
|
s.add_development_dependency "ffaker", "~> 2.5"
|
||||||
|
|
||||||
# Why `railties`? Possibly used by `spec/dummy_app` boot up?
|
# Why `railties`? Possibly used by `spec/dummy_app` boot up?
|
||||||
s.add_development_dependency "railties", [">= 4.0", "< 5.2"]
|
s.add_development_dependency "railties", [">= 4.2", "< 5.2"]
|
||||||
|
|
||||||
s.add_development_dependency "rack-test", "~> 0.6.3"
|
s.add_development_dependency "rack-test", "~> 0.6.3"
|
||||||
s.add_development_dependency "rspec-rails", "~> 3.5"
|
s.add_development_dependency "rspec-rails", "~> 3.5"
|
||||||
|
|
|
@ -1,16 +1,8 @@
|
||||||
require "rubygems"
|
require "rubygems"
|
||||||
|
|
||||||
# We normally use the root project Gemfile (and gemspec), but when we run rake
|
# When you run rake locally (not on travis) in this dummy app, set the
|
||||||
# locally (not on travis) in this dummy app, we set the BUNDLE_GEMFILE env.
|
# BUNDLE_GEMFILE env. variable to ensure that the correct version of AR is used
|
||||||
# variable. The project Gemfile/gemspec allows AR 4.0, which is a problem
|
# for e.g. migrations. See examples in CONTRIBUTING.md.
|
||||||
# because this dummy app uses `enum` in some of its models, and `enum` was
|
|
||||||
# introduced in AR 4.1. So, when we run rake here, we use:
|
|
||||||
#
|
|
||||||
# BUNDLE_GEMFILE=../../gemfiles/ar_4.2.gemfile bundle exec rake
|
|
||||||
#
|
|
||||||
# Once we drop support for AR 4.0 and 4.1 this will be less of a problem, but
|
|
||||||
# we should keep the ability to specify BUNDLE_GEMFILE because the same
|
|
||||||
# situation could come up in the future.
|
|
||||||
unless ENV.key?("BUNDLE_GEMFILE")
|
unless ENV.key?("BUNDLE_GEMFILE")
|
||||||
gemfile = File.expand_path("../../../../Gemfile", __FILE__)
|
gemfile = File.expand_path("../../../../Gemfile", __FILE__)
|
||||||
if File.exist?(gemfile)
|
if File.exist?(gemfile)
|
||||||
|
|
Loading…
Reference in a new issue