From 13c3de23fbbabca5a4b302fdfea75dff7329b0a5 Mon Sep 17 00:00:00 2001 From: Sam Pohlenz Date: Mon, 18 Sep 2023 10:57:31 +0930 Subject: [PATCH] Drop support for Rails versions < 5.2 --- .github/workflows/rspec.yml | 2 +- gemfiles/rails-5.0.gemfile | 20 ---------------- gemfiles/rails-5.1.gemfile | 20 ---------------- lib/trestle/reloader.rb | 13 ++--------- spec/dummy/config/application.rb | 2 -- .../initializers/new_framework_defaults.rb | 23 ------------------- trestle.gemspec | 6 ++--- 7 files changed, 6 insertions(+), 80 deletions(-) delete mode 100644 gemfiles/rails-5.0.gemfile delete mode 100644 gemfiles/rails-5.1.gemfile delete mode 100644 spec/dummy/config/initializers/new_framework_defaults.rb diff --git a/.github/workflows/rspec.yml b/.github/workflows/rspec.yml index b17e65c4..ec4f40bd 100644 --- a/.github/workflows/rspec.yml +++ b/.github/workflows/rspec.yml @@ -7,7 +7,7 @@ jobs: strategy: fail-fast: false matrix: - gemfile: [ rails-5.0, rails-5.1, rails-5.2, rails-6.0, rails-6.1 ] + gemfile: [ rails-5.2, rails-6.0, rails-6.1 ] ruby: [ '2.7' ] include: - gemfile: rails-6.1 diff --git a/gemfiles/rails-5.0.gemfile b/gemfiles/rails-5.0.gemfile deleted file mode 100644 index f5defef4..00000000 --- a/gemfiles/rails-5.0.gemfile +++ /dev/null @@ -1,20 +0,0 @@ -source 'https://rubygems.org' - -group :test do - gem 'coveralls_reborn', require: false - gem 'simplecov', require: false - - gem 'capybara' - gem 'capybara-selenium' - gem 'rexml' - gem 'selenium-webdriver' - gem 'webdrivers' - gem 'puma' - - gem 'haml', '~> 5.0' -end - -gem 'rails', '~> 5.0.0' -gem 'sassc-rails' - -gemspec path: "../" diff --git a/gemfiles/rails-5.1.gemfile b/gemfiles/rails-5.1.gemfile deleted file mode 100644 index 59cba73e..00000000 --- a/gemfiles/rails-5.1.gemfile +++ /dev/null @@ -1,20 +0,0 @@ -source 'https://rubygems.org' - -group :test do - gem 'coveralls_reborn', require: false - gem 'simplecov', require: false - - gem 'capybara' - gem 'capybara-selenium' - gem 'rexml' - gem 'selenium-webdriver' - gem 'webdrivers' - gem 'puma' - - gem 'haml', '~> 5.0' -end - -gem 'rails', '~> 5.1.0' -gem 'sassc-rails' - -gemspec path: "../" diff --git a/lib/trestle/reloader.rb b/lib/trestle/reloader.rb index 54999625..76fb49dc 100644 --- a/lib/trestle/reloader.rb +++ b/lib/trestle/reloader.rb @@ -38,17 +38,8 @@ def install(app) app.reloaders << reloader - if app.respond_to?(:reloader) - # Rails >= 5.0 - app.reloader.to_run do - reloader.execute_if_updated - true # Rails <= 5.1 - end - else - # Rails 4.2 - ActionDispatch::Reloader.to_prepare do - reloader.execute_if_updated - end + app.reloader.to_run do + reloader.execute_if_updated end reloader.execute diff --git a/spec/dummy/config/application.rb b/spec/dummy/config/application.rb index 67e88134..df01fbd3 100644 --- a/spec/dummy/config/application.rb +++ b/spec/dummy/config/application.rb @@ -22,8 +22,6 @@ class Application < Rails::Application config.load_defaults 6.0 when '5.2' config.load_defaults 5.2 - when '5.1' - config.load_defaults 5.1 end # Settings in config/environments/* take precedence over those specified here. diff --git a/spec/dummy/config/initializers/new_framework_defaults.rb b/spec/dummy/config/initializers/new_framework_defaults.rb deleted file mode 100644 index 25d37617..00000000 --- a/spec/dummy/config/initializers/new_framework_defaults.rb +++ /dev/null @@ -1,23 +0,0 @@ -# Be sure to restart your server when you modify this file. -# -# This file contains migration options to ease your Rails 5.0 upgrade. -# -# Read the Rails 5.0 release notes for more info on each option. - -if Rails.version >= '5.0.0' - # Enable per-form CSRF tokens. Previous versions had false. - Rails.application.config.action_controller.per_form_csrf_tokens = true - - # Enable origin-checking CSRF mitigation. Previous versions had false. - Rails.application.config.action_controller.forgery_protection_origin_check = true - - # Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`. - # Previous versions had false. - ActiveSupport.to_time_preserves_timezone = true - - # Require `belongs_to` associations by default. Previous versions had false. - Rails.application.config.active_record.belongs_to_required_by_default = true - - # Configure SSL options to enable HSTS with subdomains. Previous versions had false. - Rails.application.config.ssl_options = { hsts: { subdomains: true } } -end diff --git a/trestle.gemspec b/trestle.gemspec index 79522204..61cc2706 100644 --- a/trestle.gemspec +++ b/trestle.gemspec @@ -20,8 +20,8 @@ Gem::Specification.new do |spec| spec.required_ruby_version = ">= 2.2.2" - spec.add_dependency "railties", ">= 4.2.0" - spec.add_dependency "activemodel", ">= 4.2.0" + spec.add_dependency "railties", ">= 5.2.0" + spec.add_dependency "activemodel", ">= 5.2.0" spec.add_dependency "sprockets-rails", ">= 2.0.0" spec.add_dependency "kaminari", ">= 1.1.0" @@ -32,6 +32,6 @@ Gem::Specification.new do |spec| spec.add_development_dependency "bundler" spec.add_development_dependency "rake" - spec.add_development_dependency "sqlite3", "~> 1.3.6" + spec.add_development_dependency "sqlite3" spec.add_development_dependency "turbolinks" end