Skip to content

Commit

Permalink
Add Rails 8 compatibility
Browse files Browse the repository at this point in the history
Remove upper constraint as per
svenfuchs/rails-i18n#1130 (comment)
  • Loading branch information
tagliala committed Nov 8, 2024
1 parent 5b5476b commit 91c0e80
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ jobs:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true
- name: Ruby linter
run: bundle exec rubocop
run: bundle exec rubocop --format github
11 changes: 10 additions & 1 deletion .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
matrix:
ruby-version: ['2.7', '3.0', '3.1', '3.2', '3.3']
gemfile: [rails_6.1, rails_7.0, rails_7.1, rails_7.2]
gemfile: [rails_6.1, rails_7.0, rails_7.1, rails_7.2, rails_8.0]
channel: ['stable']

include:
Expand All @@ -32,15 +32,24 @@ jobs:
- ruby-version: 'head'
gemfile: rails_7.2
channel: 'experimental'
- ruby-version: 'head'
gemfile: rails_8.0
channel: 'experimental'
- ruby-version: 'head'
gemfile: rails_edge
channel: 'experimental'

exclude:
- ruby-version: '2.7'
gemfile: rails_7.2
- ruby-version: '2.7'
gemfile: rails_8.0
- ruby-version: '3.0'
gemfile: rails_7.2
- ruby-version: '3.0'
gemfile: rails_8.0
- ruby-version: '3.1'
gemfile: rails_8.0
- ruby-version: '3.2'
gemfile: rails_6.1
- ruby-version: '3.3'
Expand Down
6 changes: 5 additions & 1 deletion Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ appraise 'rails-7.1' do
end

appraise 'rails-7.2' do
gem 'rails', '~> 7.2.0.beta2'
gem 'rails', '~> 7.2.0'
end

appraise 'rails-8.0' do
gem 'rails', '~> 8.0.0'
end

appraise 'rails-edge' do
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 14.2.0 / 2024-11-08

* [FEATURE] Rails 8.0 compatibility

## 14.1.2 / 2024-05-27

* [ENHANCEMENT] Test against Ruby 3.3
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RouteTranslator is a gem to allow you to manage the translations of your app rou

It started as a fork of the awesome [translate_routes](https://github.com/raul/translate_routes) plugin by [Raúl Murciano](https://github.com/raul).

Right now it works with Rails 6.1 and 7.x
Right now it works with Rails 6.1, 7.x, and 8.0

## Quick Start

Expand Down
2 changes: 1 addition & 1 deletion gemfiles/rails_7.2.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ source "https://rubygems.org"
gem "appraisal"
gem "byebug"
gem "minitest"
gem "rails", "~> 7.2.0.beta2"
gem "rails", "~> 7.2.0"
gem "rake"
gem "rubocop"
gem "rubocop-minitest"
Expand Down
19 changes: 19 additions & 0 deletions gemfiles/rails_8.0.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "appraisal"
gem "byebug"
gem "minitest"
gem "rails", "~> 8.0.0"
gem "rake"
gem "rubocop"
gem "rubocop-minitest"
gem "rubocop-packaging"
gem "rubocop-performance"
gem "rubocop-rails"
gem "rubocop-rake"
gem "simplecov"
gem "simplecov-lcov"

gemspec path: "../"
4 changes: 2 additions & 2 deletions lib/route_translator/translator/path/segment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ def translate_resource(str, locale, scope)
handler = proc { |exception| exception }
opts = { locale: locale, scope: scope }

if I18n.t(str, **opts.merge(exception_handler: handler)).is_a?(I18n::MissingTranslation)
I18n.t! str, **opts.merge(fallback_options(str, locale))
if I18n.t(str, **opts, exception_handler: handler).is_a?(I18n::MissingTranslation)
I18n.t! str, **opts, **fallback_options(str, locale)
else
I18n.t str, **opts
end
Expand Down
2 changes: 1 addition & 1 deletion lib/route_translator/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module RouteTranslator
VERSION = '14.1.2'
VERSION = '14.2.0'
end
4 changes: 2 additions & 2 deletions route_translator.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ Gem::Specification.new do |spec|

spec.required_ruby_version = '>= 2.7'

spec.add_dependency 'actionpack', '>= 6.1', '< 8.0'
spec.add_dependency 'activesupport', '>= 6.1', '< 8.0'
spec.add_dependency 'actionpack', '>= 6.1'
spec.add_dependency 'activesupport', '>= 6.1'
end

0 comments on commit 91c0e80

Please sign in to comment.