-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit adapts Devise to support multiple flash messages from the Models, utilizing the Warden multi-messages feature.
- Loading branch information
Showing
16 changed files
with
188 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
VERSION 0.6 | ||
|
||
# This allows one to change the running Ruby version with: | ||
# | ||
# `earthly --build-arg EARTHLY_RUBY_VERSION=2.7 --allow-privileged +test` | ||
ARG EARTHLY_RUBY_VERSION=3.3 | ||
ARG BUNDLER_VERSION=2.4.5 | ||
|
||
FROM ruby:$EARTHLY_RUBY_VERSION | ||
WORKDIR /gem | ||
|
||
deps: | ||
# No need to keep a single `RUN` here since this target uses `SAVE ARTIFACT` | ||
# which means there's no Docker image created here. | ||
RUN apt update \ | ||
&& apt install --yes \ | ||
--no-install-recommends \ | ||
build-essential \ | ||
git \ | ||
&& mkdir /gems \ | ||
&& git clone https://github.com/Pharmony/warden.git /gems/warden \ | ||
&& cd /gems/warden \ | ||
&& git checkout features/support-multiple-messages \ | ||
&& gem install bundler:${BUNDLER_VERSION} | ||
|
||
COPY Gemfile /gem/Gemfile | ||
COPY Gemfile.lock /gem/Gemfile.lock | ||
COPY *.gemspec /gem | ||
COPY lib/devise/version.rb /gem/lib/devise/version.rb | ||
|
||
RUN bundle install --jobs $(nproc) | ||
|
||
SAVE ARTIFACT /gems git-gems | ||
SAVE ARTIFACT /usr/local/bundle bundler | ||
SAVE ARTIFACT /gem/Gemfile Gemfile | ||
SAVE ARTIFACT /gem/Gemfile.lock Gemfile.lock | ||
|
||
dev: | ||
RUN apt update \ | ||
&& apt install --yes \ | ||
--no-install-recommends \ | ||
git \ | ||
&& gem install bundler:${BUNDLER_VERSION} | ||
|
||
# Import cached gems | ||
COPY +deps/git-gems /gems | ||
COPY +deps/bundler /usr/local/bundle | ||
COPY +deps/Gemfile /gem/Gemfile | ||
COPY +deps/Gemfile.lock /gem/Gemfile.lock | ||
|
||
# Import gem files | ||
FOR gem_folder IN app config lib test *.gemspec Rakefile | ||
COPY $gem_folder /gem/$gem_folder | ||
END | ||
|
||
ENTRYPOINT ["bundle", "exec"] | ||
CMD ["rake"] | ||
|
||
# Run `earthly +dev` in order to get the Docker image exported to your | ||
# Docker images. | ||
SAVE IMAGE heartcombo/devise:latest | ||
|
||
# | ||
# This target runs the test suite. | ||
# | ||
# On you local machine you would likely use `docker compose run --rm gem` | ||
# instead, avoiding to refresh the Docker image which takes some seconds. | ||
# | ||
# Use the following command in order to run the tests suite: | ||
# earthly --allow-privileged +test [--TEST_COMMAND="rake test TEST=test/test_foobar.rb"] | ||
test: | ||
FROM earthly/dind:alpine | ||
|
||
COPY docker-compose-earthly.yml ./docker-compose.yml | ||
|
||
# Optionnal argument in the case you'd like to run something else than | ||
# `rake test` | ||
ARG TEST_COMMAND | ||
|
||
# Creates a temporary Docker image using the output from the +dev target, | ||
# that will be used within the `WITH DOCKER ... END` block only. | ||
WITH DOCKER --load heartcombo/devise:latest=+dev | ||
RUN docker-compose run --rm gem $TEST_COMMAND | ||
END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,3 +36,5 @@ end | |
# group :mongoid do | ||
# gem "mongoid", "~> 4.0.0" | ||
# end | ||
|
||
gem "warden", "~> 1.2.3", path: '/gems/warden' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# This file is only used by Earthly | ||
|
||
name: devise | ||
|
||
services: | ||
gem: | ||
image: heartcombo/devise:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# This file allows you to use the `docker compose` command in order to run Ruby | ||
# commands or tests. | ||
|
||
name: devise | ||
|
||
services: | ||
# docker compose run --rm gem [rspec [path to spec file]] | ||
gem: | ||
image: heartcombo/devise:latest | ||
volumes: | ||
- $PWD:/gem/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.