Skip to content

Rails 8.0 + Rails 7.1 support #5

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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: 4 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ jobs:
rubyver: 2.7.6
- gemfile: gemfiles/rails70.gemfile
rubyver: 3.1.2
- gemfile: gemfiles/rails71.gemfile
rubyver: 3.4.2
- gemfile: gemfiles/rails80.gemfile
rubyver: 3.4.2

env:
RAILS_ENV: test
Expand Down
23 changes: 21 additions & 2 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,40 @@ end

appraise 'rails60' do
gem 'rails', '~> 6.0.0'
gem 'sqlite3'
gem 'sqlite3', '~> 1.3.6'
gem 'concurrent-ruby', '= 1.3.4'

gem 'rspec-rails'
end

appraise 'rails61' do
gem 'rails', '~> 6.1.0'
gem 'sqlite3'
gem 'sqlite3', '~> 1.4'
gem 'rake', '< 11.0'
gem 'concurrent-ruby', '= 1.3.4'

gem 'rspec-rails'
end

appraise 'rails70' do
gem 'rails', '~> 7.0.1'
gem 'sqlite3', '~> 1.4'

gem 'concurrent-ruby', '= 1.3.4'
gem 'rspec-rails'
end

appraise 'rails71' do
gem 'rails', '~> 7.1.0'
gem 'sqlite3'

gem 'rspec-rails'
end

appraise 'rails80' do
gem 'rails', '~> 8.0.0'
gem 'sqlite3'

gem 'rspec-rails'
end

3 changes: 2 additions & 1 deletion gemfiles/rails60.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
source "https://rubygems.org"

gem "rails", "~> 6.0.0"
gem "sqlite3"
gem "sqlite3", "~> 1.3.6"
gem "concurrent-ruby", "= 1.3.4"
gem "rspec-rails"

gemspec path: "../"
4 changes: 3 additions & 1 deletion gemfiles/rails61.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
source "https://rubygems.org"

gem "rails", "~> 6.1.0"
gem "sqlite3"
gem "sqlite3", "~> 1.4"
gem "rake", "< 11.0"
gem "concurrent-ruby", "= 1.3.4"
gem "rspec-rails"

gemspec path: "../"
3 changes: 2 additions & 1 deletion gemfiles/rails70.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
source "https://rubygems.org"

gem "rails", "~> 7.0.1"
gem "sqlite3"
gem "sqlite3", "~> 1.4"
gem "concurrent-ruby", "= 1.3.4"
gem "rspec-rails"

gemspec path: "../"
9 changes: 9 additions & 0 deletions gemfiles/rails71.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "rails", "~> 7.1.0"
gem "sqlite3"
gem "rspec-rails"

gemspec path: "../"
9 changes: 9 additions & 0 deletions gemfiles/rails80.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "rails", "~> 8.0.0"
gem "sqlite3"
gem "rspec-rails"

gemspec path: "../"
8 changes: 8 additions & 0 deletions lib/action_dispatch/routing/static_responder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,14 @@ def trigger_file_handler_initialization

def call(env)
env["PATH_INFO"] = path
if Gem::Version.new(Rails.version) >= Gem::Version.new('7.1')
status, headers, body = @file_handler.call(env)
if headers['Cache-Control']
headers.delete('last-modified')
end
return [status, headers, body]
end

@file_handler.call(env)
end

Expand Down
2 changes: 1 addition & 1 deletion rails-static-router.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
spec.summary = spec.description
spec.version = RailsStaticRouter::VERSION

spec.add_dependency 'railties', '>= 5.0', '< 7.1'
spec.add_dependency 'railties', '>= 5.0', '< 8.1'

# Test and build tools
# The test shouldn't broken by the incompatible RSpec version.
Expand Down
6 changes: 5 additions & 1 deletion spec/dummy/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@

module Dummy
class Application < Rails::Application
if Rails.version.match('7.0')
if Rails.version.match('8.0')
config.load_defaults 8.0
elsif Rails.version.match('7.1')
config.load_defaults 7.1
elsif Rails.version.match('7.0')
config.load_defaults 7.0
elsif Rails.version.match('6.1')
config.load_defaults 6.1
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/config/environments/test.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Rails.application.configure do

if Rails.version.match(/^(5|6|7)/)
if Rails.version.match(/^(5|6|7|8)/)
# Settings specified here will take precedence over those in config/application.rb.

# The test environment is used exclusively to run your application's
Expand Down
6 changes: 4 additions & 2 deletions spec/integration/routing_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
expect(response.headers['Cache-Control']).to eq('my-cache-control')
end

it 'cant response via non-defined static routes' do
expect { get '/mantap.txt' }.to raise_exception
if Gem::Version.new(Rails.version) < Gem::Version.new('8.0')
it 'cant response via non-defined static routes' do
expect { get '/mantap.txt' }.to raise_exception
end
end

it 'works with normal controller' do
Expand Down
Loading