Commit Graph

3765 Commits

Author SHA1 Message Date
Carlos Antonio da Silva
43800b4b85 Bump to 4.8.1 with Rails 7 support
Also note in the Changelog that Turbo is not fully supported yet.
v4.8.1
2021-12-16 08:04:21 -03:00
Carlos Antonio da Silva
baf5e00544 Merge pull request #5435 from dixpac/dix/rails_7
Add support for Rails 7
2021-12-16 08:02:18 -03:00
Dino Maric
289dd5f221 Add support for Rails 7
This commit adds support for latest Rails release.
2021-12-16 10:12:05 +01:00
Carlos Antonio da Silva
9f5b83750e Bundle update to Rails 7.0 rc1 2021-12-08 08:26:05 -03:00
Carlos Antonio da Silva
8593801130 Keep the constantize behavior consistent for versions prior to Rails 7
Use `AS::Dependencies` as before if we still can, otherwise use the new
direct `constantize` call for Rails 7+.

Leave a TODO to help remind us this can be removed once we drop support
to Rails versions prior to 7 in the future.
2021-10-08 08:33:47 -03:00
Carlos Antonio da Silva
bb879f7154 Merge branch 'ca-rails-main'
Add Rails 7 / main support
2021-10-07 20:23:21 -03:00
Carlos Antonio da Silva
772b74a657 Update Changelog adding Rails 7 support 2021-10-07 20:15:44 -03:00
Carlos Antonio da Silva
51bf327017 Refactor using helper to swap config 2021-10-07 19:06:33 -03:00
Carlos Antonio da Silva
14eb1362e3 Eliminate Rails 7 warning about Active Record legacy connection handling
DEPRECATION WARNING: Using legacy connection handling is deprecated.
    Please set `legacy_connection_handling` to `false` in your application.
2021-10-07 18:46:40 -03:00
Carlos Antonio da Silva
f3e8fd3baa Move the Gemfile to test with Rails 7.0 alpha2, fix session test issue
It appears setting the `rack.session` to a simple hash doesn't work
anymore as it now has a few additional methods Rails is relying on to
determine whether it's enabled or not:
https://github.com/rails/rails/pull/42231

Failure:
    NoMethodError: undefined method `enabled?' for {}:Hash
    rails (f55cdafe4b82) actionpack/lib/action_dispatch/middleware/flash.rb:62:in `commit_flash'

Turns we we don't seem to need to set `rack.session` for the tests here.
2021-10-07 18:08:16 -03:00
strobilomyces
a0ccc1cf96 Fix deprecated ActiveSupport::Dependencies.constantize (#5397)
Changes deprecated `ActiveSupport::Dependencies.constantize(model_name)` to `model_name.constantize`

Co-authored-by: Carlos Antonio da Silva <carlosantoniodasilva@gmail.com>
2021-10-07 17:27:37 -03:00
Alex Ghiculescu
b39faffde4 Test against Rails main and remove ActiveSupport::Dependencies.reference (#5357)
Remove `ActiveSupport::Dependencies.reference`

This was deleted from Rails: 14d4edd7c3

As far as I can tell, it was meant to add a performance boost at some point in the past but doesn't seem to do anything useful these days.
2021-10-07 17:18:37 -03:00
Carlos Antonio da Silva
366a428b2c Revise docs from #5405
Update a couple other modules that still referred to `devise_for` to
point to `devise`, and make all of them more consistent. We can only
mention `devise`, that should be clear enough about it being options
for the model method.
2021-10-06 19:20:07 -03:00
Carlos Antonio da Silva
7d103bc627 Merge pull request #5405 from chihaso/fix_comment_in_some_modules
Fix comment in some modules [ci skip]
2021-10-06 19:17:21 -03:00
chihaso
bdd2e7e24f Fix comment in some modules
- It says that the option is added to devise_for, but it is actually added to the devise method in the model.
2021-09-17 14:37:28 +09:00
Carlos Antonio da Silva
c82e4cf47b Merge pull request #5378 from nickhammond/patch-1
Add metadata for RubyGems
2021-05-08 10:19:35 -03:00
Nick Hammond
63ccdfb34a Add metadata for RubyGems 2021-05-06 16:33:39 -07:00
Carlos Antonio da Silva
2ee0068d77 Bundle update 2021-05-05 18:20:38 -03:00
Carlos Antonio da Silva
57d1a1d381 Release v4.8.0 v4.8.0 2021-04-29 08:52:33 -03:00
Carlos Antonio da Silva
5d5636f03a Merge pull request #5369 from heartcombo/ca-lockable-reset-attempts
Create a model hook around the lockable warden hook to reset attempts
2021-04-02 15:52:43 -03:00
Carlos Antonio da Silva
a3ae35e9c9 Create a model hook around the lockable warden hook to reset attempts
Resetting failed attempts after sign in happened inside a warden hook
specific for the lockable module, but that was hidden inside the hook
implementation and didn't allow any user customization.

One such customization needed for example is to direct these updates to
a write DB when using a multi-DB setup. With the logic hidden in the
warden hook this wasn't possible, now that it's exposed in a model
method much like trackable, we can override the model method to wrap it
in a connection switch block for example, point to a write DB, and
simply call `super`.

Closes #5310
Related to #5264 and #5133
2021-04-02 15:45:25 -03:00
Carlos Antonio da Silva
e8e0c27599 Revert "Lock bundler to 2.2.9 instead of latest"
This reverts commit 1ba53dc369.

Let's give the latest bundler (2.2.15 as of today) a try again.
2021-03-30 21:53:57 -03:00
Carlos Antonio da Silva
429afcbe8a Bundle update 2021-03-30 21:53:56 -03:00
Carlos Antonio da Silva
ef9a2f4104 Use minitest helpers to check if objects respond to certain methods 2021-03-22 18:43:19 -03:00
Carlos Antonio da Silva
0cd72a56f9 Merge pull request #5347 from heartcombo/ca-build
Support Ruby 3+ officially, remove final Rails 6.1 deprecations, drop test dependency for XML serialization
2021-02-16 17:35:19 -03:00
Carlos Antonio da Silva
1ba53dc369 Lock bundler to 2.2.9 instead of latest
2.2.10 is causing the dependency resolution on Rails 6-0-stable to fail:

```
  Bundler could not find compatible versions for gem "railties":
    In Gemfile-rails-6-0:
      devise was resolved to 4.7.3, which depends on
        railties (>= 4.1.0)

      rails was resolved to 6.0.3.5, which depends on
        railties (= 6.0.3.5)

      responders (~> 3.0) was resolved to 3.0.1, which depends on
        railties (>= 5.0)
  Took  27.49 seconds
```

https://github.com/heartcombo/devise/runs/1905780158?check_suite_focus=true#step:5:23

The `railties` version 6.0.3.5 should work, given the other two are
using >= declarations, but it fails in 2.2.10.

Downgrading to 2.2.9 works.
2021-02-15 16:33:14 -03:00
Carlos Antonio da Silva
faef12cf2b Use the 6-0-stable version of Rails to fix issue with JSON responses
The test suite was failing on Rails 6.0 + Ruby 3 with errors like:

    Expected "{\"errors\":\"#<ActiveModel::Errors:0x000055f2e6cb8188>\"}"
    to include "{\"errors\":{".

The ActiveModel::Errors object wasn't being serialized to JSON as
expected, and this only happened with that combination of Ruby/Rails.

Upon further investigation, this was caused by a change in Ruby and
fixed in Rails in this PR: https://github.com/rails/rails/pull/39697
(which describes in more details the exact same problem and links to the
Ruby bug tracker with more information).

That fix was backported to 6-0-stable in June 2020, but hasn't been
officially released in a stable version yet: (there have been only
security fixes since then for 6.0)
75f6539d0e

Since the branch contains the fix, I'm pointing directly to it to get
the tests passing. We can't tell if there'll be a new stable 6.0 release
at this point, but hopefully yes, in which case we can go back at
pointing to it.
2021-02-15 16:33:03 -03:00
Carlos Antonio da Silva
c82a381f29 Bundle update 2021-02-15 14:45:04 -03:00
Carlos Antonio da Silva
a793472a3e Replace XML with JSON serialization across the test suite
This allows us to remove the dependency on the XML serializer provided
by the external `activemodel-serializers-xml` gem, and eliminates the
following deprecation warning:

    DEPRECATION WARNING: ActiveModel::Errors#to_xml is deprecated and
    will be removed in Rails 6.2.

Please note: this does not mean Devise doesn't support XML, it simply
means our test suite will use JSON to test non-navigatable formats
instead of XML, for simplicity. Devise's job is not to test object
serialization, so as long as your objects properly serialize to
XML/JSON/any other format, it should work out of the box.
2021-02-15 14:40:05 -03:00
Carlos Antonio da Silva
ad91686b62 Test on Ruby 3+ with Rails 6+
And remove dupe entry in the exclude matrix.

In order to get Ruby 3 working we needed to install `rexml` as part of
the test dependencies, only done on the main Gemfile (Rails 6.1) and the
6.0 versions. (which are the only ones supported by Ruby 3.)

Devise itself doesn't require `rexml` as it does nothing with it, but a
dependency we use during tests seem to require it. I was able to track
it down to omniauth-openid -> rack-openid -> ruby-openid requiring it:

    13a88ad644/lib/openid/yadis/xrds.rb (L1)

So while we have tests using omniauth-openid, we'll need this require in
place as well. Ideally that upstream version of ruby-openid should have
it, but it seems that one isn't updated in a while.
2021-02-15 14:34:36 -03:00
Carlos Antonio da Silva
1bb5fcbbec Merge pull request #5339 from ghiculescu/rails-deprecation
Fix deprecation warning on Rails 6.1

Related changes in Rails:
https://github.com/rails/rails/pull/38256
https://github.com/rails/rails/pull/38536
2021-02-02 21:27:31 -03:00
Alex Ghiculescu
80423c8f01 Fix deprecation warning on Rails 6.1 2021-02-02 15:37:45 -07:00
Carlos Antonio da Silva
743b6937e2 Merge pull request #5327 from heartcombo/ca-omniauth-2
Improve OmniAuth version check to allow anything from 1.0 forward
2021-02-01 17:30:37 -03:00
Carlos Antonio da Silva
e16d60d0fe Expand the release notes with more info about the OmniAuth v2 upgrade
I'm sure more people will hit issues so I'm trying to add more guidance
here about how to upgrade... maybe that should be in its own wiki but
I'll keep it all in the changelog for now.
2021-02-01 12:01:24 -03:00
Carlos Antonio da Silva
9d16f33c7b Revert "Explicitly set OmniAuth to 1.x in the Gemfiles for now"
This reverts commit 628f2fb2be.

We should be run green on OmniAuth 2.x now.
2021-02-01 11:51:23 -03:00
Carlos Antonio da Silva
c9a0f896cc Merge branch 'master' into ca-omniauth-2 2021-02-01 11:50:38 -03:00
Carlos Antonio da Silva
aa8d89579a Merge pull request #5338 from heartcombo/ca-build
Move build to GitHub Actions
2021-02-01 11:49:36 -03:00
Carlos Antonio da Silva
210c62af38 Add changelog about moving to GitHub Actions 2021-02-01 11:44:42 -03:00
Carlos Antonio da Silva
3048fe0960 Prevent Bundler 2.x. with Rails 4.x versions 2021-02-01 10:10:26 -03:00
Carlos Antonio da Silva
628f2fb2be Explicitly set OmniAuth to 1.x in the Gemfiles for now
The build is breaking with 2.x (which is expected), so this is a step to
get it to green on GA.
2021-01-31 10:19:06 -03:00
Carlos Antonio da Silva
13ba27497b Use the latest 2.x patch version for each Ruby, remove ruby-head
ruby-head was always in allowed failures with travis anyway, and we
never really paid much attention to it, so let's just remove it entirely
for now.
2021-01-31 10:08:57 -03:00
Carlos Antonio da Silva
7386f419e3 Use latest bundler on Gemfile.lock
Bundler 1.x uses git instead of https by default and we don't have that
github source setting in the Gemfile, but this should work.
2021-01-31 10:05:03 -03:00
Carlos Antonio da Silva
e07932c181 Rename gemfiles to keep consistency 2021-01-31 09:54:47 -03:00
Carlos Antonio da Silva
d0eafe70dc Remove the lock gemfiles from the previous versions
Keep only the lock for the main Gemfile to keep Devise consistent with
the other heartcombo libs.
2021-01-31 09:51:20 -03:00
Carlos Antonio da Silva
7e6da424e2 Move from Travis to GitHub Actions 2021-01-29 16:59:14 -03:00
AsbahIshaq
81bf3ad8c1 changed support to supports (#5334)
Co-authored-by: Asbah Ishaq <asbahishaq>
2021-01-24 08:51:09 -03:00
Carlos Antonio da Silva
51c05a5b21 Add changelog entry for OmniAuth 2 support
And a note/warning about how it might break apps that don't update their
integration accordingly as OmniAuth now expects.
2021-01-22 09:28:05 -03:00
Carlos Antonio da Silva
1d138dd40c Simplify OmniAuth version check by trying to load the gem with the necessary version 2021-01-22 09:16:58 -03:00
Carlos Antonio da Silva
c43ae8cb47 Merge branch 'master' into ca-omniauth-2 2021-01-19 15:22:57 -03:00
Carlos Antonio da Silva
cd60c747cc Update to latest released omniauth* gems
omniauth-openid v2.0.1 was just released opening support for omniauth
v2, so we can bundle update everything from the released gems now.
2021-01-19 15:21:26 -03:00