From 9690846a8140d6fe6977b52281a30bad53994513 Mon Sep 17 00:00:00 2001 From: aki Date: Fri, 23 Aug 2024 07:00:35 +0900 Subject: [PATCH] Drop support for Rails versions below 7.1.4 --- .github/workflows/rspec.yml | 4 +-- CHANGELOG.md | 5 ++++ csb.gemspec | 4 +-- gemfiles/rails71.gemfile | 2 +- gemfiles/{rails70.gemfile => rails72.gemfile} | 2 +- lib/csb/railtie.rb | 28 ------------------- lib/csb/version.rb | 2 +- 7 files changed, 12 insertions(+), 35 deletions(-) rename gemfiles/{rails70.gemfile => rails72.gemfile} (68%) diff --git a/.github/workflows/rspec.yml b/.github/workflows/rspec.yml index e03e9aa..49563b9 100644 --- a/.github/workflows/rspec.yml +++ b/.github/workflows/rspec.yml @@ -15,8 +15,8 @@ jobs: strategy: fail-fast: false matrix: - ruby: ["3.0", "3.1", "3.2", "3.3"] - gemfile: ["rails70", "rails71"] + ruby: ["3.1", "3.2", "3.3"] + gemfile: ["rails71", "rails72"] steps: - uses: actions/checkout@v4 diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e46e02..505e84d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.12.0 + +- Drop support for Rails versions below 7.1.4 +- Drop support for ruby 3.0 + ## 0.11.0 - Consider `Csb.configuration` as initial value for `Csb::Builder` diff --git a/csb.gemspec b/csb.gemspec index 787e65d..c40bd1f 100644 --- a/csb.gemspec +++ b/csb.gemspec @@ -22,9 +22,9 @@ Gem::Specification.new do |spec| spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] - spec.required_ruby_version = '>= 3.0.0' + spec.required_ruby_version = '>= 3.1.0' - spec.add_dependency "rails", ">= 7.0.0" + spec.add_dependency "rails", ">= 7.1.4" spec.add_dependency "csv" spec.add_development_dependency "bundler", "~> 2.0" diff --git a/gemfiles/rails71.gemfile b/gemfiles/rails71.gemfile index 2c3e697..65f1f08 100644 --- a/gemfiles/rails71.gemfile +++ b/gemfiles/rails71.gemfile @@ -1,5 +1,5 @@ source "http://rubygems.org" -gem 'rails', '~> 7.1.0' +gem 'rails', '~> 7.1.4' gemspec path: '../' diff --git a/gemfiles/rails70.gemfile b/gemfiles/rails72.gemfile similarity index 68% rename from gemfiles/rails70.gemfile rename to gemfiles/rails72.gemfile index 4b80410..721906b 100644 --- a/gemfiles/rails70.gemfile +++ b/gemfiles/rails72.gemfile @@ -1,5 +1,5 @@ source "http://rubygems.org" -gem 'rails', '~> 7.0.0' +gem 'rails', '~> 7.2.0' gemspec path: '../' diff --git a/lib/csb/railtie.rb b/lib/csb/railtie.rb index 6bca950..0e892c5 100644 --- a/lib/csb/railtie.rb +++ b/lib/csb/railtie.rb @@ -6,34 +6,6 @@ class Railtie < Rails::Railtie ActiveSupport.on_load :action_view do require 'csb/handler' ActionView::Template.register_template_handler :csb, Csb::Handler - - # SEE: https://github.com/rails/rails/pull/51023 - rails_version = Gem::Version.new(Rails.version) - if rails_version >= Gem::Version.new('7.1.0') && rails_version < Gem::Version.new('7.1.4') - ActionView::Template.prepend(Module.new do - # SEE: https://github.com/Shopify/rails/blob/0601929486398954a17b1985fcf7f9f0611d2d55/actionview/lib/action_view/template.rb#L262C5-L281C8 - def render(view, locals, buffer = nil, implicit_locals: [], add_to_stack: true, &block) - instrument_render_template do - compile!(view) - - if strict_locals? && @strict_local_keys && !implicit_locals.empty? - locals_to_ignore = implicit_locals - @strict_local_keys - locals.except!(*locals_to_ignore) - end - - if buffer - view._run(method_name, self, locals, buffer, add_to_stack: add_to_stack, has_strict_locals: strict_locals?, &block) - nil - else - result = view._run(method_name, self, locals, ActionView::OutputBuffer.new, add_to_stack: add_to_stack, has_strict_locals: strict_locals?, &block) - result.is_a?(ActionView::OutputBuffer) ? result.to_s : result - end - end - rescue => e - handle_render_error(view, e) - end - end) - end end end end diff --git a/lib/csb/version.rb b/lib/csb/version.rb index 859efaf..3c901ad 100644 --- a/lib/csb/version.rb +++ b/lib/csb/version.rb @@ -1,3 +1,3 @@ module Csb - VERSION = '0.11.0' + VERSION = '0.12.0' end