diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 487e5304..954d1659 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,44 +1,44 @@ -name: gha-workflow-authlogic-test +name: CI on: [push, pull_request] jobs: # Linting is a separate job, primary because it only needs to be done once, # and secondarily because jobs are performed concurrently. - gha-job-authlogic-lint: + lint: name: Lint runs-on: ubuntu-latest steps: - name: Checkout source - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Setup ruby uses: ruby/setup-ruby@v1 with: # Set to `TargetRubyVersion` in `.rubocop.yml` - ruby-version: 2.6 + ruby-version: 3.2 - name: Bundle run: | - gem install bundler -v 2.4.22 + gem install bundler bundle install --jobs 4 --retry 3 - name: Lint run: bundle exec rubocop # The test job is a matrix of ruby/rails versions. - gha-job-authlogic-test: + test: name: Ruby ${{ matrix.ruby }}, Rails ${{ matrix.rails }} runs-on: ubuntu-latest services: - gha-service-authlogic-mysql: + mysql: env: MYSQL_ALLOW_EMPTY_PASSWORD: yes MYSQL_DATABASE: authlogic image: mysql:8.0 options: >- - --health-cmd="mysqladmin ping" - --health-interval=10s - --health-timeout=5s - --health-retries=3 + --health-cmd "mysqladmin ping" + --health-interval 10s + --health-timeout 5s + --health-retries 3 ports: - 3306:3306 - gha-service-authlogic-postgres: + postgres: env: POSTGRES_PASSWORD: asdfasdf image: postgres @@ -56,28 +56,15 @@ jobs: # have set this up with each database as a separate job, but then we'd be # duplicating the matrix configuration three times. matrix: - # To keep matrix size down, only test highest and lowest rubies. In - # `.rubocop.yml`, set `TargetRubyVersion`, to the lowest ruby version + # In `.rubocop.yml`, set `TargetRubyVersion`, to the lowest Ruby version # tested here. - ruby: ["3.1", "3.2", "3.3", "3.4"] - rails: ["7.0", "7.1", "7.2", "8.0"] - exclude: - # rails 7 requires ruby >= 2.7.0 - - rails: "7.0" - ruby: "3.1" - - rails: "7.0" - ruby: "3.2" - - rails: "7.0" - ruby: "3.3" - - rails: "7.0" - ruby: "3.4" - - rails: "8.0" - ruby: "3.1" + ruby: ["3.2", "3.3", "3.4"] + rails: ["7.2", "8.0", "8.1"] env: BUNDLE_GEMFILE: gemfiles/rails_${{ matrix.rails }}.rb steps: - name: Checkout source - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Setup ruby uses: ruby/setup-ruby@v1 with: diff --git a/.rubocop.yml b/.rubocop.yml index c65bf98c..c2567715 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -12,7 +12,7 @@ AllCops: # rubies on CI. # # Should be same as `ruby-version` in `.github/workflows/test.yml` - TargetRubyVersion: 2.6 + TargetRubyVersion: 3.2 # Avoid empty lines in methods, they are a sign the method is too big. Layout/EmptyLineAfterGuardClause: diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 654499f1..773b94db 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,13 +1,13 @@ # This configuration was generated by # `rubocop --auto-gen-config --exclude-limit 1000` -# on 2020-03-24 00:02:43 -0400 using RuboCop version 0.80.1. +# on 2025-10-16 20:21:05 UTC using RuboCop version 1.81.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. # Offense count: 7 -# Cop supports --auto-correct. +# This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, IndentationWidth. # SupportedStyles: with_first_argument, with_fixed_indentation Layout/ArgumentAlignment: @@ -16,29 +16,101 @@ Layout/ArgumentAlignment: - 'lib/authlogic/acts_as_authentic/single_access_token.rb' - 'test/libs/user.rb' -# Offense count: 14 -# Cop supports --auto-correct. -Lint/SendWithMixinArgument: +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: Severity. +# SupportedStylesAlignWith: start_of_line, begin +Layout/BeginEndAlignment: + EnforcedStyleAlignWith: begin + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowAliasSyntax, AllowedMethods. +# AllowedMethods: alias_method, public, protected, private +Layout/EmptyLinesAroundAttributeAccessor: + Exclude: + - 'lib/authlogic/crypto_providers/scrypt.rb' + - 'test/libs/user_session.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Layout/RescueEnsureAlignment: + Exclude: + - 'lib/authlogic/acts_as_authentic/session_maintenance.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator, EnforcedStyleForRationalLiterals. +# SupportedStylesForExponentOperator: space, no_space +# SupportedStylesForRationalLiterals: space, no_space +Layout/SpaceAroundOperators: Exclude: - - 'lib/authlogic/acts_as_authentic/base.rb' - - 'lib/authlogic/controller_adapters/sinatra_adapter.rb' - 'lib/authlogic/test_case.rb' -# Offense count: 3 +# Offense count: 1 +# Configuration parameters: AllowComments. +Lint/EmptyFile: + Exclude: + - 'test/session_test/credentials_test.rb' + +# Offense count: 4 +# Configuration parameters: AllowedParentClasses. +Lint/MissingSuper: + Exclude: + - 'lib/authlogic/test_case/mock_api_controller.rb' + - 'lib/authlogic/test_case/mock_controller.rb' + - 'lib/authlogic/test_case/mock_cookie_jar.rb' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: AllowedMethods, InferNonNilReceiver, AdditionalNilMethods. +# AllowedMethods: instance_of?, kind_of?, is_a?, eql?, respond_to?, equal? +# AdditionalNilMethods: present?, blank?, try, try! +Lint/RedundantSafeNavigation: + Exclude: + - 'lib/authlogic/test_case/mock_request.rb' + +# Offense count: 1 +# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes. Metrics/AbcSize: - Max: 16.03 + Max: 21 + +# Offense count: 2 +# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns. +# SupportedStyles: snake_case, normalcase, non_integer +# AllowedIdentifiers: TLS1_1, TLS1_2, capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64 +Naming/VariableNumber: + Exclude: + - 'test/acts_as_authentic_test/perishable_token_test.rb' + - 'test/session_test/session_test.rb' + +# Offense count: 4 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: separated, grouped +Style/AccessorGrouping: + Exclude: + - 'lib/authlogic/crypto_providers/sha1.rb' + - 'lib/authlogic/crypto_providers/sha1/v2.rb' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: AllowedMethods, AllowedPatterns. +# AllowedMethods: ==, equal?, eql? +Style/ClassEqualityComparison: + Exclude: + - 'lib/authlogic/session/base.rb' # Offense count: 5 Style/ClassVars: Exclude: - 'lib/authlogic/i18n.rb' -# Offense count: 4 -Style/MethodMissingSuper: +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/GlobalStdStream: Exclude: - - 'lib/authlogic/controller_adapters/abstract_adapter.rb' - - 'lib/authlogic/controller_adapters/sinatra_adapter.rb' - - 'lib/authlogic/test_case/mock_request.rb' + - 'test/test_helper.rb' # Offense count: 3 Style/MissingRespondToMissing: @@ -46,19 +118,53 @@ Style/MissingRespondToMissing: - 'lib/authlogic/controller_adapters/sinatra_adapter.rb' - 'lib/authlogic/test_case/mock_request.rb' -# Offense count: 6 -# Cop supports --auto-correct. -# Configuration parameters: ExactNameMatch, AllowPredicates, AllowDSLWriters, IgnoreClassMethods, AllowedMethods. -# AllowedMethods: to_ary, to_a, to_c, to_enum, to_h, to_hash, to_i, to_int, to_io, to_open, to_path, to_proc, to_r, to_regexp, to_str, to_s, to_sym -Style/TrivialAccessors: +# Offense count: 5 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowMethodComparison, ComparisonsThreshold. +Style/MultipleComparison: Exclude: - 'lib/authlogic/session/base.rb' -Style/HashEachMethods: - Enabled: false +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Style/RedundantFreeze: + Exclude: + - 'test/libs/user.rb' -Style/HashTransformKeys: - Enabled: false +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Style/RedundantRegexpEscape: + Exclude: + - 'test/libs/user.rb' + +# Offense count: 3 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength. +# AllowedMethods: present?, blank?, presence, try, try! +Style/SafeNavigation: + Exclude: + - 'lib/authlogic/acts_as_authentic/session_maintenance.rb' + - 'lib/authlogic/session/base.rb' -Style/HashTransformValues: - Enabled: false +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowModifier. +Style/SoleNestedConditional: + Exclude: + - 'lib/authlogic/session/base.rb' + +# Offense count: 3 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: Mode. +Style/StringConcatenation: + Exclude: + - 'test/session_test/existence_test.rb' + - 'test/test_helper.rb' + +# Offense count: 7 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: ExactNameMatch, AllowPredicates, AllowDSLWriters, IgnoreClassMethods, AllowedMethods. +# AllowedMethods: to_ary, to_a, to_c, to_enum, to_h, to_hash, to_i, to_int, to_io, to_open, to_path, to_proc, to_r, to_regexp, to_str, to_s, to_sym +Style/TrivialAccessors: + Exclude: + - 'lib/authlogic/session/base.rb' diff --git a/CHANGELOG.md b/CHANGELOG.md index 2317c2b5..1ca495ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## Unreleased +- Breaking Changes + - [#782](https://github.com/binarylogic/authlogic/pull/782) - Drops support for EOL Ruby versions (< 3.2) + - [#782](https://github.com/binarylogic/authlogic/pull/782) - Drops support for EOL Rails versions (< 7.2) +- Added + - [#782](https://github.com/binarylogic/authlogic/pull/782) - Adds support for Rails 8.1 +- Fixed + - None + ## 6.5.0 (2025-04-10) - Breaking Changes @@ -46,7 +54,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Added - `Authlogic::Session::Base.session_fixation_defense` - Reset the Rack session ID after authentication, to protect against Session Fixation - attacks. (https://guides.rubyonrails.org/security.html#session-fixation) + attacks. () Default: true - Fixed - None @@ -135,5 +143,3 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## Previous major version See eg. the `5-1-stable` branch - -[1]: https://github.com/binarylogic/authlogic/blob/master/doc/use_normal_rails_validation.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d5cb3118..9a9122e2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -33,26 +33,6 @@ ruby. See `required_ruby_version` in the gemspec. Tests can be run against different versions of Rails: ``` -# Rails 5.2 -BUNDLE_GEMFILE=gemfiles/rails_5.2.rb bundle install -BUNDLE_GEMFILE=gemfiles/rails_5.2.rb bundle exec rake - -# Rails 6.0 -BUNDLE_GEMFILE=gemfiles/rails_6.0.rb bundle install -BUNDLE_GEMFILE=gemfiles/rails_6.0.rb bundle exec rake - -# Rails 6.1 -BUNDLE_GEMFILE=gemfiles/rails_6.1.rb bundle install -BUNDLE_GEMFILE=gemfiles/rails_6.1.rb bundle exec rake - -# Rails 7.0 -BUNDLE_GEMFILE=gemfiles/rails_7.0.rb bundle install -BUNDLE_GEMFILE=gemfiles/rails_7.0.rb bundle exec rake - -# Rails 7.1 -BUNDLE_GEMFILE=gemfiles/rails_7.1.rb bundle install -BUNDLE_GEMFILE=gemfiles/rails_7.1.rb bundle exec rake - # Rails 7.2 BUNDLE_GEMFILE=gemfiles/rails_7.2.rb bundle install BUNDLE_GEMFILE=gemfiles/rails_7.2.rb bundle exec rake @@ -60,12 +40,16 @@ BUNDLE_GEMFILE=gemfiles/rails_7.2.rb bundle exec rake # Rails 8.0 BUNDLE_GEMFILE=gemfiles/rails_8.0.rb bundle install BUNDLE_GEMFILE=gemfiles/rails_8.0.rb bundle exec rake + +# Rails 8.1 +BUNDLE_GEMFILE=gemfiles/rails_8.1.rb bundle install +BUNDLE_GEMFILE=gemfiles/rails_8.1.rb bundle exec rake ``` To run a single test: ``` -BUNDLE_GEMFILE=gemfiles/rails_8.0.rb \ +BUNDLE_GEMFILE=gemfiles/rails_8.1.rb \ bundle exec ruby -I test path/to/test.rb ``` @@ -80,14 +64,14 @@ ruby –I test path/to/test.rb ``` mysql -e 'drop database authlogic; create database authlogic;' && \ - DB=mysql BUNDLE_GEMFILE=gemfiles/rails_8.0.rb bundle exec rake + DB=mysql BUNDLE_GEMFILE=gemfiles/rails_8.1.rb bundle exec rake ``` ### Test PostgreSQL ``` psql -c 'create database authlogic;' -U postgres -DB=postgres BUNDLE_GEMFILE=gemfiles/rails_8.0.rb bundle exec rake +DB=postgres BUNDLE_GEMFILE=gemfiles/rails_8.1.rb bundle exec rake ``` ### Linting @@ -96,13 +80,13 @@ Running `rake` also runs a linter, rubocop. Contributions must pass both the linter and the tests. The linter can be run on its own. ``` -BUNDLE_GEMFILE=gemfiles/rails_8.0.rb bundle exec rubocop +BUNDLE_GEMFILE=gemfiles/rails_8.1.rb bundle exec rubocop ``` To run the tests without linting, use `rake test`. ``` -BUNDLE_GEMFILE=gemfiles/rails_8.0.rb bundle exec rake test +BUNDLE_GEMFILE=gemfiles/rails_8.1.rb bundle exec rake test ``` ### Version Control Branches @@ -118,11 +102,15 @@ the "stable" branches should be the only branches with release tags. 1. git merge master 1. Update version number in lib/authlogic/version.rb 1. In the changelog, - - Add release date to entry - - Add a new "Unreleased" section at top + +- Add release date to entry +- Add a new "Unreleased" section at top + 1. In the readme, - - Update version number in the docs table at the top - - For non-patch versions, update the compatibility table + +- Update version number in the docs table at the top +- For non-patch versions, update the compatibility table + 1. Commit with message like "Release 4.3.0" 1. git push origin 4-3-stable 1. CI should pass @@ -131,7 +119,8 @@ the "stable" branches should be the only branches with release tags. 1. git tag -a -m "v4.3.0" "v4.3.0" 1. git push --tags origin 4-3-stable 1. update the docs in the master branch, because that's what people look at - - git checkout master - - git merge --ff-only 4-3-stable - - optional: amend commit, adding `[ci skip]` - - git push + +- git checkout master +- git merge --ff-only 4-3-stable +- optional: amend commit, adding `[ci skip]` +- git push diff --git a/README.md b/README.md index d8c621f7..339f360d 100644 --- a/README.md +++ b/README.md @@ -10,14 +10,15 @@ An unobtrusive ruby authentication library based on ActiveRecord. | Version | Documentation | | ---------- | ----------------------------------------------------------------- | -| Unreleased | https://github.com/binarylogic/authlogic/blob/master/README.md | -| 6.5.0 | https://github.com/binarylogic/authlogic/blob/v6.5.0/README.md | -| 6.4.3 | https://github.com/binarylogic/authlogic/blob/v6.4.3/README.md | -| 5.2.0 | https://github.com/binarylogic/authlogic/blob/v5.2.0/README.md | -| 4.5.0 | https://github.com/binarylogic/authlogic/blob/v4.5.0/README.md | -| 3.7.0 | https://github.com/binarylogic/authlogic/blob/v3.7.0/README.md | -| 2.1.11 | https://github.com/binarylogic/authlogic/blob/v2.1.11/README.rdoc | -| 1.4.3 | https://github.com/binarylogic/authlogic/blob/v1.4.3/README.rdoc | +| Unreleased | | +| 6.6.0 | | +| 6.5.0 | | +| 6.4.3 | | +| 5.2.0 | | +| 4.5.0 | | +| 3.7.0 | | +| 2.1.11 | | +| 1.4.3 | | ## Table of Contents @@ -167,7 +168,7 @@ And run `bundle install`. ## 2. Rails -Let's walk through a typical rails setup. ([Compatibility](#90-compatibility)) +Let's walk through a typical Rails setup. ([Compatibility](#90-compatibility)) ### 2.a.1 The users table @@ -383,9 +384,9 @@ Because Authlogic introduces its own methods for storing user sessions, the CSRF (Cross Site Request Forgery) protection that is built into Rails will not work out of the box. -No generally applicable mitigation by the authlogic library is possible, because +No generally applicable mitigation by the Authlogic library is possible, because the instance variable you use to store a reference to the user session in `def -current_user_session` will not be known to authlogic. +current_user_session` will not be known to Authlogic. You will need to override `ActionController::Base#handle_unverified_request` to do something appropriate to how your app handles user sessions, e.g.: @@ -415,7 +416,7 @@ Up until recently, the standard default value when SameSite was not explicitly d Authlogic can allow you to explicitly set the value of SameSite to one of: Lax, Strict, or None. Note that when setting SameSite to None, the `secure` flag must also be set (secure is the default in Authlogic). -Reference: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#SameSite +Reference: ## 3. Testing @@ -423,25 +424,25 @@ See [Authlogic::TestCase](https://github.com/binarylogic/authlogic/blob/master/l ## 4. Helpful links -- API Reference: http://www.rubydoc.info/github/binarylogic/authlogic -- Repository: https://github.com/binarylogic/authlogic/tree/master -- Railscasts Screencast: http://railscasts.com/episodes/160-authlogic -- Example repository with tutorial in README: https://github.com/binarylogic/authlogic_example/tree/master -- Tutorial: Rails Authentication with Authlogic https://www.sitepoint.com/rails-authentication-with-authlogic -- Issues: https://github.com/binarylogic/authlogic/issues -- Chrome is not logging out on browser close https://productforums.google.com/forum/#!topic/chrome/9l-gKYIUg50/discussion +- API Reference: +- Repository: +- Railscasts Screencast: +- Example repository with tutorial in README: +- Tutorial: Rails Authentication with Authlogic +- Issues: +- Chrome is not logging out on browser close ## 5. Add-ons -- Authlogic OpenID addon: https://github.com/binarylogic/authlogic_openid -- Authlogic LDAP addon: https://github.com/binarylogic/authlogic_ldap -- Authlogic Facebook Connect: https://github.com/kalasjocke/authlogic-facebook-connect -- Authlogic Facebook Connect (New JS API): https://github.com/studybyte/authlogic_facebook_connect -- Authlogic Facebook Shim https://github.com/james2m/authlogic_facebook_shim -- Authlogic OAuth (Twitter): https://github.com/jrallison/authlogic_oauth -- Authlogic Oauth and OpenID: https://github.com/lancejpollard/authlogic-connect -- Authlogic PAM: https://github.com/nbudin/authlogic_pam -- Authlogic x509: https://github.com/auth-scc/authlogic_x509 +- Authlogic OpenID addon: +- Authlogic LDAP addon: +- Authlogic Facebook Connect: +- Authlogic Facebook Connect (New JS API): +- Authlogic Facebook Shim +- Authlogic OAuth (Twitter): +- Authlogic Oauth and OpenID: +- Authlogic PAM: +- Authlogic x509: If you create one of your own, please let us know about it so we can add it to this list. Or just fork the project, add your link, and send us a pull request. @@ -491,7 +492,8 @@ in `authlogic/session/base.rb`. | Version | branch | ruby | activerecord | | ------- | ---------- | -------- | ------------- | -| 6.5.0 | 6-5-stable | >= 2.4.0 | >= 5.2, < 8.0 | +| 6.6.0 | 6-6-stable | >= 3.2.0 | >= 7.2, < 8.2 | +| 6.5.0 | 6-5-stable | >= 2.4.0 | >= 5.2, < 8.1 | | 6.4.3 | 6-4-stable | >= 2.4.0 | >= 5.2, < 7.1 | | 5.2 | 5-2-stable | >= 2.3.0 | >= 5.2, < 6.1 | | 4.5 | 4-5-stable | >= 2.3.0 | >= 4.2, < 5.3 | @@ -507,8 +509,8 @@ Under SemVer, [changes to dependencies][10] do not require a major release. Copyright (c) 2012 Ben Johnson of Binary Logic, released under the MIT license -[1]: https://api.travis-ci.org/binarylogic/authlogic.svg?branch=master -[2]: https://travis-ci.org/binarylogic/authlogic +[1]: https://github.com/binarylogic/authlogic/actions/workflows/test.yml/badge.svg?branch=master +[2]: https://github.com/binarylogic/authlogic/actions/workflows/test.yml [3]: https://gemnasium.com/badges/github.com/binarylogic/authlogic.svg [4]: https://gemnasium.com/binarylogic/authlogic [5]: https://badge.fury.io/rb/authlogic.svg diff --git a/authlogic.gemspec b/authlogic.gemspec index 407d9194..7eaf0b29 100644 --- a/authlogic.gemspec +++ b/authlogic.gemspec @@ -22,21 +22,20 @@ require_relative "lib/authlogic/version" s.summary = "An unobtrusive ruby authentication library based on ActiveRecord." s.license = "MIT" s.metadata = { "rubygems_mfa_required" => "true" } - s.required_ruby_version = ">= 2.6.0" + s.required_ruby_version = ">= 3.2.0" - # See doc/rails_support_in_authlogic_5.0.md - s.add_dependency "activemodel", [">= 5.2", "< 8.1"] - s.add_dependency "activerecord", [">= 5.2", "< 8.1"] - s.add_dependency "activesupport", [">= 5.2", "< 8.1"] + s.add_dependency "activemodel", [">= 7.2", "< 8.2"] + s.add_dependency "activerecord", [">= 7.2", "< 8.2"] + s.add_dependency "activesupport", [">= 7.2", "< 8.2"] s.add_dependency "request_store", "~> 1.0" s.add_development_dependency "bcrypt", "~> 3.1" s.add_development_dependency "byebug", "~> 11.1.3" - s.add_development_dependency "coveralls_reborn", "~> 0.28.0" + s.add_development_dependency "coveralls_reborn", "~> 0.29.0" s.add_development_dependency "minitest", "< 5.19.0" # See https://github.com/binarylogic/authlogic/issues/766 s.add_development_dependency "minitest-reporters", "~> 1.3" s.add_development_dependency "mutex_m", "~> 0.3.0" s.add_development_dependency "rake", "~> 13.0" - s.add_development_dependency "rubocop", "~> 0.80.1" + s.add_development_dependency "rubocop", [">= 1.26.0", "< 2.0.0"] s.add_development_dependency "rubocop-performance", "~> 1.1" s.add_development_dependency "scrypt", ">= 1.2", "< 4.0" s.add_development_dependency "simplecov", "~> 0.22.0" diff --git a/doc/rails_support_in_authlogic_5.0.md b/doc/rails_support_in_authlogic_5.0.md deleted file mode 100644 index c5b7af34..00000000 --- a/doc/rails_support_in_authlogic_5.0.md +++ /dev/null @@ -1,14 +0,0 @@ -# Rails support in Authlogic 5 - -2018-12-03 - -Authlogic 5 adds support for rails 6.0, and drops support for rails < 5.2. -This is in keeping with the [Maintenance Policy -for Ruby on Rails](https://guides.rubyonrails.org/maintenance_policy.html). -When rails 6 is released, rails < 5.2 will be EoL. Authlogic 5 reflects this. - -Authlogic 4 will continue to support rails `>= 4.2, < 5.3`. We'll continue to -accept contributions to Authlogic 4 for as long as is practical. - -In conclusion, Authlogic 4 supports the "rails 5 era" and Authlogic 5 supports -the "rails 6 era". diff --git a/gemfiles/rails_5.2.rb b/gemfiles/rails_5.2.rb deleted file mode 100644 index 4840c6f5..00000000 --- a/gemfiles/rails_5.2.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -source "https://rubygems.org" -gemspec path: ".." - -gem "activerecord", "~> 5.2.0" -gem "activesupport", "~> 5.2.0" -gem "mysql2", "~> 0.5.6" -gem "pg", "~> 1.5.8" -gem "sqlite3", "~> 1.4.0" diff --git a/gemfiles/rails_6.0.rb b/gemfiles/rails_6.0.rb deleted file mode 100644 index 69147ebe..00000000 --- a/gemfiles/rails_6.0.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -source "https://rubygems.org" -gemspec path: ".." - -gem "activerecord", "~> 6.0.0" -gem "activesupport", "~> 6.0.0" -gem "mysql2", "~> 0.5.6" -gem "pg", "~> 1.5.8" -gem "sqlite3", "~> 1.4.0" diff --git a/gemfiles/rails_6.1.rb b/gemfiles/rails_6.1.rb deleted file mode 100644 index ed03ee5b..00000000 --- a/gemfiles/rails_6.1.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -source "https://rubygems.org" -gemspec path: ".." - -gem "activerecord", "~> 6.1.0" -gem "activesupport", "~> 6.1.0" -gem "mysql2", "~> 0.5.6" -gem "pg", "~> 1.5.8" -gem "sqlite3", "~> 1.4.0" diff --git a/gemfiles/rails_7.1.rb b/gemfiles/rails_7.1.rb deleted file mode 100644 index fecba797..00000000 --- a/gemfiles/rails_7.1.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -source "https://rubygems.org" -gemspec path: ".." - -gem "activerecord", "~> 7.1.0" -gem "activesupport", "~> 7.1.0" -gem "mysql2", "~> 0.5.6" -gem "pg", "~> 1.5.8" -gem "sqlite3", "~> 1.6.0" diff --git a/gemfiles/rails_7.0.rb b/gemfiles/rails_8.1.rb similarity index 58% rename from gemfiles/rails_7.0.rb rename to gemfiles/rails_8.1.rb index 1fdddbbc..3caf195b 100644 --- a/gemfiles/rails_7.0.rb +++ b/gemfiles/rails_8.1.rb @@ -3,8 +3,8 @@ source "https://rubygems.org" gemspec path: ".." -gem "activerecord", "~> 7.0.0" -gem "activesupport", "~> 7.0.0" +gem "activerecord", "~> 8.1.0" +gem "activesupport", "~> 8.1.0" gem "mysql2", "~> 0.5.6" gem "pg", "~> 1.5.8" -gem "sqlite3", "~> 1.6.0" +gem "sqlite3", "~> 2.1.0" diff --git a/lib/authlogic/acts_as_authentic/base.rb b/lib/authlogic/acts_as_authentic/base.rb index e58fd327..a9125a1a 100644 --- a/lib/authlogic/acts_as_authentic/base.rb +++ b/lib/authlogic/acts_as_authentic/base.rb @@ -105,14 +105,14 @@ def first_column_to_exist(*columns_to_check) end ActiveSupport.on_load :active_record do - ActiveRecord::Base.send :include, Authlogic::ActsAsAuthentic::Base - ActiveRecord::Base.send :include, Authlogic::ActsAsAuthentic::Email - ActiveRecord::Base.send :include, Authlogic::ActsAsAuthentic::LoggedInStatus - ActiveRecord::Base.send :include, Authlogic::ActsAsAuthentic::Login - ActiveRecord::Base.send :include, Authlogic::ActsAsAuthentic::MagicColumns - ActiveRecord::Base.send :include, Authlogic::ActsAsAuthentic::Password - ActiveRecord::Base.send :include, Authlogic::ActsAsAuthentic::PerishableToken - ActiveRecord::Base.send :include, Authlogic::ActsAsAuthentic::PersistenceToken - ActiveRecord::Base.send :include, Authlogic::ActsAsAuthentic::SessionMaintenance - ActiveRecord::Base.send :include, Authlogic::ActsAsAuthentic::SingleAccessToken + ActiveRecord::Base.include Authlogic::ActsAsAuthentic::Base + ActiveRecord::Base.include Authlogic::ActsAsAuthentic::Email + ActiveRecord::Base.include Authlogic::ActsAsAuthentic::LoggedInStatus + ActiveRecord::Base.include Authlogic::ActsAsAuthentic::Login + ActiveRecord::Base.include Authlogic::ActsAsAuthentic::MagicColumns + ActiveRecord::Base.include Authlogic::ActsAsAuthentic::Password + ActiveRecord::Base.include Authlogic::ActsAsAuthentic::PerishableToken + ActiveRecord::Base.include Authlogic::ActsAsAuthentic::PersistenceToken + ActiveRecord::Base.include Authlogic::ActsAsAuthentic::SessionMaintenance + ActiveRecord::Base.include Authlogic::ActsAsAuthentic::SingleAccessToken end diff --git a/lib/authlogic/acts_as_authentic/queries/find_with_case.rb b/lib/authlogic/acts_as_authentic/queries/find_with_case.rb index 586c00fb..59ca9b4b 100644 --- a/lib/authlogic/acts_as_authentic/queries/find_with_case.rb +++ b/lib/authlogic/acts_as_authentic/queries/find_with_case.rb @@ -19,11 +19,6 @@ module Queries # # @api private class FindWithCase - # Dup ActiveRecord.gem_version before freezing, in case someone - # else wants to modify it. Freezing modifies an object in place. - # https://github.com/binarylogic/authlogic/pull/590 - AR_GEM_VERSION = ::ActiveRecord.gem_version.dup.freeze - # @api private def initialize(model_class, field, value, sensitive) @model_class = model_class @@ -47,35 +42,17 @@ def comparison # @api private def insensitive_comparison - if AR_GEM_VERSION > Gem::Version.new("5.3") - @model_class.connection.case_insensitive_comparison( - @model_class.arel_table[@field], @value - ) - else - @model_class.connection.case_insensitive_comparison( - @model_class.arel_table, - @field, - @model_class.columns_hash[@field], - @value - ) - end + @model_class.connection.case_insensitive_comparison( + @model_class.arel_table[@field], @value + ) end # @api private def sensitive_comparison bound_value = @model_class.predicate_builder.build_bind_attribute(@field, @value) - if AR_GEM_VERSION > Gem::Version.new("5.3") - @model_class.connection.case_sensitive_comparison( - @model_class.arel_table[@field], bound_value - ) - else - @model_class.connection.case_sensitive_comparison( - @model_class.arel_table, - @field, - @model_class.columns_hash[@field], - bound_value - ) - end + @model_class.connection.case_sensitive_comparison( + @model_class.arel_table[@field], bound_value + ) end end end diff --git a/lib/authlogic/controller_adapters/sinatra_adapter.rb b/lib/authlogic/controller_adapters/sinatra_adapter.rb index 4d20c2ae..67072d81 100644 --- a/lib/authlogic/controller_adapters/sinatra_adapter.rb +++ b/lib/authlogic/controller_adapters/sinatra_adapter.rb @@ -64,4 +64,4 @@ def self.included(klass) end end -Sinatra::Base.send(:include, Authlogic::ControllerAdapters::SinatraAdapter::Adapter::Implementation) +Sinatra::Base.include(Authlogic::ControllerAdapters::SinatraAdapter::Adapter::Implementation) diff --git a/lib/authlogic/test_case.rb b/lib/authlogic/test_case.rb index 067c4b33..476f769e 100644 --- a/lib/authlogic/test_case.rb +++ b/lib/authlogic/test_case.rb @@ -209,7 +209,7 @@ def controller end # TODO: Why are these lines inside the `Authlogic` module? Should be outside? - ::Test::Unit::TestCase.send(:include, TestCase) if defined?(::Test::Unit::TestCase) - ::MiniTest::Unit::TestCase.send(:include, TestCase) if defined?(::MiniTest::Unit::TestCase) - ::MiniTest::Test.send(:include, TestCase) if defined?(::MiniTest::Test) + ::Test::Unit::TestCase.include(TestCase) if defined?(::Test::Unit::TestCase) + ::MiniTest::Unit::TestCase.include(TestCase) if defined?(::MiniTest::Unit::TestCase) + ::MiniTest::Test.include(TestCase) if defined?(::MiniTest::Test) end diff --git a/lib/authlogic/version.rb b/lib/authlogic/version.rb index debf43e4..3d19ddfb 100644 --- a/lib/authlogic/version.rb +++ b/lib/authlogic/version.rb @@ -15,6 +15,6 @@ module Authlogic # # @api public def self.gem_version - ::Gem::Version.new("6.5.0") + ::Gem::Version.new("6.6.0") end end diff --git a/test/test_helper.rb b/test/test_helper.rb index 30c9561f..f2e3de8c 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -54,19 +54,12 @@ logger.level = Logger::FATAL ActiveRecord::Base.logger = logger -if ActiveRecord::VERSION::STRING < "4.1" - ActiveRecord::Base.configurations = true -end - if ActiveSupport.respond_to?(:test_order) ActiveSupport.test_order = :sorted end -if ActiveRecord::VERSION::STRING < "7.1" - ActiveRecord::Base.default_timezone = :local -else - ActiveRecord.default_timezone = :local -end +ActiveRecord.default_timezone = :local + ActiveRecord::Schema.define(version: 1) do create_table :companies do |t| t.datetime :created_at, limit: 6 @@ -184,14 +177,7 @@ module ActiveSupport class TestCase include ActiveRecord::TestFixtures - # `fixture_path=` was deprecated in favor of - # `fixture_paths=` in Rails 7.1, removed in Rails 7.2. - if respond_to?(:fixture_paths=) - self.fixture_paths = [File.dirname(__FILE__) + "/fixtures"] - else - self.fixture_path = File.dirname(__FILE__) + "/fixtures" - end - + self.fixture_paths = [File.dirname(__FILE__) + "/fixtures"] self.use_transactional_tests = false self.use_instantiated_fixtures = false self.pre_loaded_fixtures = false