From f76821bf373cf7df983e3febacb571c674281fa6 Mon Sep 17 00:00:00 2001 From: Andrew Clemons Date: Tue, 7 May 2019 13:44:14 +1200 Subject: [PATCH] Relax active record/support constraints to support Rails 6. --- .travis.yml | 12 ++++++++++++ Gemfile | 2 +- flipper-active_record.gemspec | 2 +- flipper-active_support_cache_store.gemspec | 2 +- lib/generators/flipper/active_record_generator.rb | 6 +++--- script/test | 9 +++++++++ 6 files changed, 27 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 211afc5f2..747dd2c67 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,8 @@ services: - mongodb - memcached env: + - RAILS_VERSION=6.0.0.rc1 SQLITE3_VERSION=1.4.1 + - RAILS_VERSION=5.2.3 - RAILS_VERSION=5.1.4 - RAILS_VERSION=5.0.0 - RAILS_VERSION=4.2.5 @@ -25,3 +27,13 @@ matrix: env: RAILS_VERSION=5.0.0 - rvm: 2.1 env: RAILS_VERSION=5.1.4 + - rvm: 2.1 + env: RAILS_VERSION=5.2.3 + - rvm: 2.1 + env: RAILS_VERSION=6.0.0.rc1 SQLITE3_VERSION=1.4.1 + - rvm: 2.2 + env: RAILS_VERSION=6.0.0.rc1 SQLITE3_VERSION=1.4.1 + - rvm: 2.3 + env: RAILS_VERSION=6.0.0.rc1 SQLITE3_VERSION=1.4.1 + - rvm: 2.4 + env: RAILS_VERSION=6.0.0.rc1 SQLITE3_VERSION=1.4.1 diff --git a/Gemfile b/Gemfile index 648083eaa..da1d086b4 100644 --- a/Gemfile +++ b/Gemfile @@ -12,7 +12,7 @@ gem 'shotgun', '~> 0.9' gem 'statsd-ruby', '~> 1.2.1' gem 'rspec', '~> 3.0' gem 'rack-test', '~> 0.6.3' -gem 'sqlite3', '~> 1.3.11' +gem 'sqlite3', "~> #{ENV['SQLITE3_VERSION'] || '1.3.11'}" gem 'rails', "~> #{ENV['RAILS_VERSION'] || '5.1.4'}" gem 'minitest', '~> 5.8.0' gem 'rubocop', '~> 0.45.0' diff --git a/flipper-active_record.gemspec b/flipper-active_record.gemspec index df6cf40db..7cb391a8a 100644 --- a/flipper-active_record.gemspec +++ b/flipper-active_record.gemspec @@ -26,5 +26,5 @@ Gem::Specification.new do |gem| gem.metadata = Flipper::METADATA gem.add_dependency 'flipper', "~> #{Flipper::VERSION}" - gem.add_dependency 'activerecord', '>= 3.2', '< 6' + gem.add_dependency 'activerecord', '>= 3.2', '< 7' end diff --git a/flipper-active_support_cache_store.gemspec b/flipper-active_support_cache_store.gemspec index 500fc8d18..32ddfb41a 100644 --- a/flipper-active_support_cache_store.gemspec +++ b/flipper-active_support_cache_store.gemspec @@ -22,5 +22,5 @@ Gem::Specification.new do |gem| gem.metadata = Flipper::METADATA gem.add_dependency 'flipper', "~> #{Flipper::VERSION}" - gem.add_dependency 'activesupport', '>= 3.2', '< 6' + gem.add_dependency 'activesupport', '>= 3.2', '< 7' end diff --git a/lib/generators/flipper/active_record_generator.rb b/lib/generators/flipper/active_record_generator.rb index 212a5e2a9..13751e0f2 100644 --- a/lib/generators/flipper/active_record_generator.rb +++ b/lib/generators/flipper/active_record_generator.rb @@ -13,11 +13,11 @@ def self.next_migration_number(dirname) end def self.migration_version - "[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]" if rails5? + "[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]" if requires_migration_number? end - def self.rails5? - Rails.version.start_with?('5') + def self.requires_migration_number? + Rails::VERSION::MAJOR.to_i >= 5 end def create_migration_file diff --git a/script/test b/script/test index 1a0661ab5..392da08ee 100755 --- a/script/test +++ b/script/test @@ -27,3 +27,12 @@ bundle exec rake export RAILS_VERSION=5.1.4 script/bootstrap || bundle update bundle exec rake + +export RAILS_VERSION=5.2.3 +script/bootstrap || bundle update +bundle exec rake + +export RAILS_VERSION=6.0.0.rc1 +export SQLITE3_VERSION=1.4.1 +script/bootstrap || bundle update +bundle exec rake