From 0a454d1f68b6f99b667ba765ed67737d5dd8619b Mon Sep 17 00:00:00 2001 From: Michael Grosser Date: Sun, 1 Apr 2018 12:25:20 -0700 Subject: [PATCH] drop support for deprecated rails versions --- .travis.yml | 14 -------------- Appraisals | 11 ----------- CHANGELOG.md | 2 ++ README.md | 2 +- audited.gemspec | 5 ++--- gemfiles/rails40.gemfile | 9 --------- gemfiles/rails41.gemfile | 8 -------- lib/audited/auditor.rb | 5 ----- spec/audited/auditor_spec.rb | 2 +- 9 files changed, 6 insertions(+), 52 deletions(-) delete mode 100644 gemfiles/rails40.gemfile delete mode 100644 gemfiles/rails41.gemfile diff --git a/.travis.yml b/.travis.yml index bc111c075..0f6537102 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,8 +18,6 @@ before_install: - "travis_retry gem update --system" - "travis_retry gem install bundler" gemfile: - - gemfiles/rails40.gemfile - - gemfiles/rails41.gemfile - gemfiles/rails42.gemfile - gemfiles/rails50.gemfile - gemfiles/rails51.gemfile @@ -34,18 +32,6 @@ matrix: gemfile: gemfiles/rails51.gemfile - rvm: 2.1 gemfile: gemfiles/rails52.gemfile - - rvm: 2.4.3 - gemfile: gemfiles/rails40.gemfile - - rvm: 2.4.3 - gemfile: gemfiles/rails41.gemfile - - rvm: 2.5.0 - gemfile: gemfiles/rails40.gemfile - - rvm: 2.5.0 - gemfile: gemfiles/rails41.gemfile - - rvm: ruby-head - gemfile: gemfiles/rails40.gemfile - - rvm: ruby-head - gemfile: gemfiles/rails41.gemfile fast_finish: true branches: only: diff --git a/Appraisals b/Appraisals index 9e8ef4cf3..189cf4aff 100644 --- a/Appraisals +++ b/Appraisals @@ -1,14 +1,3 @@ -appraise 'rails40' do - gem 'rails', '~> 4.0.0' - gem 'protected_attributes' - gem 'test-unit' -end - -appraise 'rails41' do - gem 'rails', '~> 4.1.0' - gem 'protected_attributes' -end - appraise 'rails42' do gem 'rails', '~> 4.2.0' gem 'protected_attributes' diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f885fe61..d19a9e564 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ Breaking changes - removed `audited_columns`, `non_audited_columns`, `auditing_enabled=` instance methods, use class methods instead [#424](https://github.com/collectiveidea/audited/pull/424) +- removed rails 4.1 and 4.0 support + [#431](https://github.com/collectiveidea/audited/pull/431) Added diff --git a/README.md b/README.md index 680886732..9a483501a 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Audited [![Build Status](https://secure.travis-ci.org/collectiveidea/audited.svg **Audited** (previously acts_as_audited) is an ORM extension that logs all changes to your models. Audited can also record who made those changes, save comments and associate models related to the changes. -Audited currently (4.x) works with Rails 5.1, 5.0 and 4.2. It may work with 4.1 and 4.0, but this is not guaranteed. +Audited currently (4.x) works with Rails 5.1, 5.0 and 4.2. For Rails 3, use gem version 3.0 or see the [3.0-stable branch](https://github.com/collectiveidea/audited/tree/3.0-stable). diff --git a/audited.gemspec b/audited.gemspec index 99527a8b6..adb0ff88e 100644 --- a/audited.gemspec +++ b/audited.gemspec @@ -15,12 +15,11 @@ Gem::Specification.new do |gem| gem.license = 'MIT' gem.files = `git ls-files`.split($\).reject{|f| f =~ /(\.gemspec)/ } - gem.require_paths = ['lib'] - gem.add_dependency 'activerecord', '>= 4.0', '< 5.2' + gem.add_dependency 'activerecord', '>= 4.2', '< 5.2' gem.add_development_dependency 'appraisal' - gem.add_development_dependency 'rails', '>= 4.0', '< 5.2' + gem.add_development_dependency 'rails', '>= 4.2', '< 5.2' gem.add_development_dependency 'rspec-rails', '~> 3.5' # JRuby support for the test ENV diff --git a/gemfiles/rails40.gemfile b/gemfiles/rails40.gemfile deleted file mode 100644 index 3748cc964..000000000 --- a/gemfiles/rails40.gemfile +++ /dev/null @@ -1,9 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "rails", "~> 4.0.0" -gem "protected_attributes" -gem "test-unit" - -gemspec name: "audited", path: "../" diff --git a/gemfiles/rails41.gemfile b/gemfiles/rails41.gemfile deleted file mode 100644 index 31512f1cd..000000000 --- a/gemfiles/rails41.gemfile +++ /dev/null @@ -1,8 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "rails", "~> 4.1.0" -gem "protected_attributes" - -gemspec name: "audited", path: "../" diff --git a/lib/audited/auditor.rb b/lib/audited/auditor.rb index c3c692135..c4b1981fa 100644 --- a/lib/audited/auditor.rb +++ b/lib/audited/auditor.rb @@ -162,7 +162,6 @@ def combine_audits(audits_to_combine) def revision_with(attributes) dup.tap do |revision| revision.id = id - revision.send :instance_variable_set, '@attributes', self.attributes if rails_below?('4.2.0') revision.send :instance_variable_set, '@new_record', destroyed? revision.send :instance_variable_set, '@persisted', !destroyed? revision.send :instance_variable_set, '@readonly', false @@ -185,10 +184,6 @@ def revision_with(attributes) end end - def rails_below?(rails_version) - Gem::Version.new(Rails::VERSION::STRING) < Gem::Version.new(rails_version) - end - private def audited_changes diff --git a/spec/audited/auditor_spec.rb b/spec/audited/auditor_spec.rb index 45fc72695..50c8aea21 100644 --- a/spec/audited/auditor_spec.rb +++ b/spec/audited/auditor_spec.rb @@ -192,7 +192,7 @@ def non_column_attr=(val) expect(user.audits.last.audited_changes.keys).to eq(%w{non_column_attr}) end - if ActiveRecord::Base.connection.adapter_name == 'PostgreSQL' && Rails.version >= "4.2.0.0" # Postgres json and jsonb support was added in Rails 4.2 + if ActiveRecord::Base.connection.adapter_name == 'PostgreSQL' describe "'json' and 'jsonb' audited_changes column type" do let(:migrations_path) { SPEC_ROOT.join("support/active_record/postgres") }