Skip to content

Commit d155fff

Browse files
authored
Merge pull request #770 from talkable/master
Support Rails 7.2 and 8.0
2 parents 8e3debe + 318c758 commit d155fff

16 files changed

+87
-57
lines changed

Diff for: .github/workflows/test.yml

+18-14
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323

2424
# The test job is a matrix of ruby/rails versions.
2525
gha-job-authlogic-test:
26-
name: Ruby ${{ matrix.ruby }}, ${{ matrix.gemfile }}.rb
26+
name: Ruby ${{ matrix.ruby }}, Rails ${{ matrix.rails }}
2727
runs-on: ubuntu-latest
2828
services:
2929
gha-service-authlogic-mysql:
@@ -50,28 +50,32 @@ jobs:
5050
ports:
5151
- 5432:5432
5252
strategy:
53+
fail-fast: false
5354
# Unlike TravisCI, the database will not be part of the matrix. Each
5455
# sub-job in the matrix tests all three databases. Alternatively, we could
5556
# have set this up with each database as a separate job, but then we'd be
5657
# duplicating the matrix configuration three times.
5758
matrix:
58-
gemfile:
59-
["rails_5.2", "rails_6.0", "rails_6.1", "rails_7.0", "rails_7.1"]
60-
6159
# To keep matrix size down, only test highest and lowest rubies. In
62-
# `.rubocopy.yml`, set `TargetRubyVersion`, to the lowest ruby version
60+
# `.rubocop.yml`, set `TargetRubyVersion`, to the lowest ruby version
6361
# tested here.
64-
ruby: ["2.6", "2.7"]
65-
62+
ruby: ["2.6", "3.3"]
63+
rails: ["5.2", "6.0", "6.1", "7.0", "7.1", "7.2", "8.0"]
6664
exclude:
6765
# rails 7 requires ruby >= 2.7.0
6866
- ruby: "2.6"
69-
gemfile: "rails_7.0"
67+
rails: "7.0"
68+
- ruby: "2.6"
69+
rails: "7.1"
7070
- ruby: "2.6"
71-
gemfile: "rails_7.1"
71+
rails: "7.2"
72+
- ruby: "2.6"
73+
rails: "8.0"
74+
- ruby: "3.3"
75+
rails: "5.2"
7276
steps:
7377
- name: Checkout source
74-
uses: actions/checkout@v2
78+
uses: actions/checkout@v4
7579
- name: Setup ruby
7680
uses: ruby/setup-ruby@v1
7781
with:
@@ -81,7 +85,7 @@ jobs:
8185
gem install bundler -v 2.4.22
8286
bundle install --jobs 4 --retry 3
8387
env:
84-
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.rb
88+
BUNDLE_GEMFILE: gemfiles/rails_${{ matrix.rails }}.rb
8589

8690
# MySQL db was created above, sqlite will be created during test suite,
8791
# when migrations occur, so we only need to create the postgres db. I
@@ -105,13 +109,13 @@ jobs:
105109
- name: Test, sqlite
106110
run: bundle exec rake test
107111
env:
108-
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.rb
112+
BUNDLE_GEMFILE: gemfiles/rails_${{ matrix.rails }}.rb
109113
DB: sqlite
110114
- name: Test, mysql
111115
run: bundle exec rake test
112116
env:
113117
BACKTRACE: 1
114-
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.rb
118+
BUNDLE_GEMFILE: gemfiles/rails_${{ matrix.rails }}.rb
115119
DB: mysql
116120
AUTHLOGIC_DB_NAME: authlogic
117121
AUTHLOGIC_DB_USER: root
@@ -121,7 +125,7 @@ jobs:
121125
run: bundle exec rake test
122126
env:
123127
BACKTRACE: 1
124-
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.rb
128+
BUNDLE_GEMFILE: gemfiles/rails_${{ matrix.rails }}.rb
125129
DB: postgres
126130
AUTHLOGIC_DB_NAME: authlogic
127131
AUTHLOGIC_DB_USER: postgres

Diff for: CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1212
- Added
1313
- None
1414
- Fixed
15-
- None
15+
- [#770](https://github.com/binarylogic/authlogic/pull/770) - Adds support for Rails 7.2 and 8.0
1616

1717
## 6.4.3 (2023-12-17)
1818

Diff for: CONTRIBUTING.md

+13-5
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,20 @@ BUNDLE_GEMFILE=gemfiles/rails_7.0.rb bundle exec rake
5252
# Rails 7.1
5353
BUNDLE_GEMFILE=gemfiles/rails_7.1.rb bundle install
5454
BUNDLE_GEMFILE=gemfiles/rails_7.1.rb bundle exec rake
55+
56+
# Rails 7.2
57+
BUNDLE_GEMFILE=gemfiles/rails_7.2.rb bundle install
58+
BUNDLE_GEMFILE=gemfiles/rails_7.2.rb bundle exec rake
59+
60+
# Rails 8.0
61+
BUNDLE_GEMFILE=gemfiles/rails_8.0.rb bundle install
62+
BUNDLE_GEMFILE=gemfiles/rails_8.0.rb bundle exec rake
5563
```
5664

5765
To run a single test:
5866

5967
```
60-
BUNDLE_GEMFILE=gemfiles/rails_6.0.rb \
68+
BUNDLE_GEMFILE=gemfiles/rails_8.0.rb \
6169
bundle exec ruby -I test path/to/test.rb
6270
```
6371

@@ -72,14 +80,14 @@ ruby –I test path/to/test.rb
7280

7381
```
7482
mysql -e 'drop database authlogic; create database authlogic;' && \
75-
DB=mysql BUNDLE_GEMFILE=gemfiles/rails_5.2.rb bundle exec rake
83+
DB=mysql BUNDLE_GEMFILE=gemfiles/rails_8.0.rb bundle exec rake
7684
```
7785

7886
### Test PostgreSQL
7987

8088
```
8189
psql -c 'create database authlogic;' -U postgres
82-
DB=postgres BUNDLE_GEMFILE=gemfiles/rails_6.0.rb bundle exec rake
90+
DB=postgres BUNDLE_GEMFILE=gemfiles/rails_8.0.rb bundle exec rake
8391
```
8492

8593
### Linting
@@ -88,13 +96,13 @@ Running `rake` also runs a linter, rubocop. Contributions must pass both
8896
the linter and the tests. The linter can be run on its own.
8997

9098
```
91-
BUNDLE_GEMFILE=gemfiles/rails_6.0.rb bundle exec rubocop
99+
BUNDLE_GEMFILE=gemfiles/rails_8.0.rb bundle exec rubocop
92100
```
93101

94102
To run the tests without linting, use `rake test`.
95103

96104
```
97-
BUNDLE_GEMFILE=gemfiles/rails_6.0.rb bundle exec rake test
105+
BUNDLE_GEMFILE=gemfiles/rails_8.0.rb bundle exec rake test
98106
```
99107

100108
### Version Control Branches

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ in `authlogic/session/base.rb`.
490490

491491
| Version | branch | ruby | activerecord |
492492
| ------- | ---------- | -------- | ------------- |
493-
| 6.4.3 | 6-4-stable | >= 2.4.0 | >= 5.2, < 7.2 |
493+
| 6.4.3 | 6-4-stable | >= 2.4.0 | >= 5.2, < 8.1 |
494494
| 5.2 | 5-2-stable | >= 2.3.0 | >= 5.2, < 6.1 |
495495
| 4.5 | 4-5-stable | >= 2.3.0 | >= 4.2, < 5.3 |
496496
| 4.3 | 4-3-stable | >= 2.3.0 | >= 4.2, < 5.3 |

Diff for: Rakefile

+1-8
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,7 @@ Rake::TestTask.new(:test) do |test|
1212
test.verbose = false
1313

1414
# Set interpreter warning level to 2 (verbose)
15-
#
16-
# Warnings are set to 0 on TravisCI because it has a maximum
17-
# log length of 4MB and the following warning is printed thousands of times:
18-
#
19-
# > ../postgresql/database_statements.rb:24:
20-
# > warning: rb_tainted_str_new is deprecated and will be removed in Ruby 3.2.
21-
warning_level = ENV.fetch("TRAVIS", "false") == "true" ? 0 : 2
22-
test.ruby_opts += [format("-W%d", warning_level)]
15+
test.ruby_opts << "-W2"
2316
end
2417

2518
require "rubocop/rake_task"

Diff for: authlogic.gemspec

+7-10
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,21 @@ require "authlogic/version"
2525
s.required_ruby_version = ">= 2.6.0"
2626

2727
# See doc/rails_support_in_authlogic_5.0.md
28-
s.add_dependency "activemodel", [">= 5.2", "< 7.2"]
29-
s.add_dependency "activerecord", [">= 5.2", "< 7.2"]
30-
s.add_dependency "activesupport", [">= 5.2", "< 7.2"]
28+
s.add_dependency "activemodel", [">= 5.2", "< 8.1"]
29+
s.add_dependency "activerecord", [">= 5.2", "< 8.1"]
30+
s.add_dependency "activesupport", [">= 5.2", "< 8.1"]
3131
s.add_dependency "request_store", "~> 1.0"
3232
s.add_development_dependency "bcrypt", "~> 3.1"
33-
s.add_development_dependency "byebug", "~> 10.0"
34-
s.add_development_dependency "coveralls", "~> 0.8.22"
33+
s.add_development_dependency "byebug", "~> 11.1.3"
34+
s.add_development_dependency "coveralls_reborn", "~> 0.28.0"
3535
s.add_development_dependency "minitest", "< 5.19.0" # See https://github.com/binarylogic/authlogic/issues/766
3636
s.add_development_dependency "minitest-reporters", "~> 1.3"
37-
s.add_development_dependency "mysql2", "~> 0.5.2"
38-
s.add_development_dependency "pg", "~> 1.1.4"
3937
s.add_development_dependency "rake", "~> 13.0"
4038
s.add_development_dependency "rubocop", "~> 0.80.1"
4139
s.add_development_dependency "rubocop-performance", "~> 1.1"
4240
s.add_development_dependency "scrypt", ">= 1.2", "< 4.0"
43-
s.add_development_dependency "simplecov", "~> 0.16.1"
44-
s.add_development_dependency "simplecov-console", "~> 0.4.2"
45-
s.add_development_dependency "sqlite3", "~> 1.4.0"
41+
s.add_development_dependency "simplecov", "~> 0.22.0"
42+
s.add_development_dependency "simplecov-console", "~> 0.9.1"
4643
s.add_development_dependency "timecop", "~> 0.7"
4744

4845
# To reduce gem size, only the minimum files are included.

Diff for: gemfiles/rails_5.2.rb

+5-2
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,8 @@
33
source "https://rubygems.org"
44
gemspec path: ".."
55

6-
gem "activerecord", "~> 5.2.1"
7-
gem "activesupport", "~> 5.2.1"
6+
gem "activerecord", "~> 5.2.0"
7+
gem "activesupport", "~> 5.2.0"
8+
gem "mysql2", "~> 0.5.6"
9+
gem "pg", "~> 1.5.8"
10+
gem "sqlite3", "~> 1.4.0"

Diff for: gemfiles/rails_6.0.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
source "https://rubygems.org"
44
gemspec path: ".."
55

6-
# Rails 6 beta 1 has been released, so you might expect us to use exactly that
7-
# version here, but it is still in flux, so we may continue using git for a
8-
# while, maybe until RC 1 is released.
96
gem "activerecord", "~> 6.0.0"
107
gem "activesupport", "~> 6.0.0"
8+
gem "mysql2", "~> 0.5.6"
9+
gem "pg", "~> 1.5.8"
10+
gem "sqlite3", "~> 1.4.0"

Diff for: gemfiles/rails_6.1.rb

+3
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@
55

66
gem "activerecord", "~> 6.1.0"
77
gem "activesupport", "~> 6.1.0"
8+
gem "mysql2", "~> 0.5.6"
9+
gem "pg", "~> 1.5.8"
10+
gem "sqlite3", "~> 1.4.0"

Diff for: gemfiles/rails_7.0.rb

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# frozen_string_literal: true
22

3-
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
4-
53
source "https://rubygems.org"
64
gemspec path: ".."
75

86
gem "activerecord", "~> 7.0.0"
97
gem "activesupport", "~> 7.0.0"
8+
gem "mysql2", "~> 0.5.6"
9+
gem "pg", "~> 1.5.8"
10+
gem "sqlite3", "~> 1.6.0"

Diff for: gemfiles/rails_7.1.rb

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# frozen_string_literal: true
22

3-
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
4-
53
source "https://rubygems.org"
64
gemspec path: ".."
75

86
gem "activerecord", "~> 7.1.0"
97
gem "activesupport", "~> 7.1.0"
8+
gem "mysql2", "~> 0.5.6"
9+
gem "pg", "~> 1.5.8"
10+
gem "sqlite3", "~> 1.6.0"

Diff for: gemfiles/rails_7.2.rb

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# frozen_string_literal: true
2+
3+
source "https://rubygems.org"
4+
gemspec path: ".."
5+
6+
gem "activerecord", "~> 7.2.0"
7+
gem "activesupport", "~> 7.2.0"
8+
gem "mysql2", "~> 0.5.6"
9+
gem "pg", "~> 1.5.8"
10+
gem "sqlite3", "~> 2.0.0"

Diff for: gemfiles/rails_8.0.rb

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# frozen_string_literal: true
2+
3+
source "https://rubygems.org"
4+
gemspec path: ".."
5+
6+
gem "activerecord", "~> 8.0.0"
7+
gem "activesupport", "~> 8.0.0"
8+
gem "mysql2", "~> 0.5.6"
9+
gem "pg", "~> 1.5.8"
10+
gem "sqlite3", "~> 2.1.0"

Diff for: lib/authlogic/config.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def self.extended(klass)
2424
private
2525

2626
def deprecate_authlogic_config(method_name)
27-
::ActiveSupport::Deprecation.warn(
27+
::ActiveSupport::Deprecation.new.warn(
2828
format(E_USE_NORMAL_RAILS_VALIDATION, method_name)
2929
)
3030
end

Diff for: lib/authlogic/session/base.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ def find(id = nil, priority_record = nil)
673673

674674
# @deprecated in favor of record_selection_method
675675
def find_by_login_method(value = nil)
676-
::ActiveSupport::Deprecation.warn(E_DPR_FIND_BY_LOGIN_METHOD)
676+
::ActiveSupport::Deprecation.new.warn(E_DPR_FIND_BY_LOGIN_METHOD)
677677
record_selection_method(value)
678678
end
679679
alias find_by_login_method= find_by_login_method
@@ -1791,7 +1791,7 @@ def exceeded_failed_logins_limit?
17911791

17921792
# @deprecated in favor of `self.class.record_selection_method`
17931793
def find_by_login_method
1794-
::ActiveSupport::Deprecation.warn(E_DPR_FIND_BY_LOGIN_METHOD)
1794+
::ActiveSupport::Deprecation.new.warn(E_DPR_FIND_BY_LOGIN_METHOD)
17951795
self.class.record_selection_method
17961796
end
17971797

Diff for: test/test_helper.rb

+6-6
Original file line numberDiff line numberDiff line change
@@ -183,16 +183,16 @@
183183
module ActiveSupport
184184
class TestCase
185185
include ActiveRecord::TestFixtures
186-
self.fixture_path = File.dirname(__FILE__) + "/fixtures"
187186

188-
# use_transactional_fixtures= is deprecated and will be removed from Rails 5.1
189-
# (use use_transactional_tests= instead)
190-
if respond_to?(:use_transactional_tests=)
191-
self.use_transactional_tests = false
187+
# `fixture_path=` was deprecated in favor of
188+
# `fixture_paths=` in Rails 7.1, removed in Rails 7.2.
189+
if respond_to?(:fixture_paths=)
190+
self.fixture_paths = [File.dirname(__FILE__) + "/fixtures"]
192191
else
193-
self.use_transactional_fixtures = false
192+
self.fixture_path = File.dirname(__FILE__) + "/fixtures"
194193
end
195194

195+
self.use_transactional_tests = false
196196
self.use_instantiated_fixtures = false
197197
self.pre_loaded_fixtures = false
198198
fixtures :all

0 commit comments

Comments
 (0)