Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop support for Rails versions below 7.1.4 #23

Merged
merged 1 commit into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/rspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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`
Expand Down
4 changes: 2 additions & 2 deletions csb.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion gemfiles/rails71.gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
source "http://rubygems.org"

gem 'rails', '~> 7.1.0'
gem 'rails', '~> 7.1.4'

gemspec path: '../'
2 changes: 1 addition & 1 deletion gemfiles/rails70.gemfile → gemfiles/rails72.gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
source "http://rubygems.org"

gem 'rails', '~> 7.0.0'
gem 'rails', '~> 7.2.0'

gemspec path: '../'
28 changes: 0 additions & 28 deletions lib/csb/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/csb/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Csb
VERSION = '0.11.0'
VERSION = '0.12.0'
end