Skip to content

Commit 1baaef4

Browse files
authored
Recreate Test Apps for Rails 8 (#17)
* Create test app and update .gitignores * Add gems and Devise generator * Add devise_invitable * After devise generators * Remove files that shouldn't have been tracked * DB for Devise * Add home_controller * Updates to contributing * .gitignore flailing * Run devise_bootstrap_form generator * Move Rails 8.0 app to rails_app * Fix nested .gitignore * Generator look for right manifest This may be should just remove the import, as we don't need our styles anymore? * User double-quotes * Templates without wrapper nor styles * Test app with import Also maybe not needed/valid? * Reminder to use local gem from parent directory source * Spanish before adding home * Add root page * Move Spanish test app * Update CI matrix * Get rid of omakase from test apps and other rubocop fixes
1 parent 6fe1aba commit 1baaef4

277 files changed

Lines changed: 20078 additions & 2139 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.devcontainer.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-docker-compose
3+
{
4+
"name": "devise-bootstrap-form",
5+
6+
// Update the 'dockerComposeFile' list if you have more compose files or use different names.
7+
"dockerComposeFile": [
8+
"compose.yml",
9+
"compose.override.yml"
10+
],
11+
12+
// The 'service' property is the name of the service for the container that VS Code should
13+
// use. Update this value and .devcontainer/docker-compose.yml to the real service name.
14+
"service": "web",
15+
16+
// The optional 'workspaceFolder' property is the path VS Code should open by default when
17+
// connected. This is typically a file mount in .devcontainer/docker-compose.yml
18+
"workspaceFolder": "/app"
19+
// "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}"
20+
21+
// Features to add to the dev container. More info: https://containers.dev/features.
22+
// "features": {},
23+
24+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
25+
// "forwardPorts": [],
26+
27+
// Uncomment the next line if you want start specific services in your Docker Compose config.
28+
// "runServices": [],
29+
30+
// Uncomment the next line if you want to keep your containers running after VS Code shuts down.
31+
// "shutdownAction": "none",
32+
33+
// Uncomment the next line to run commands after the container is created.
34+
// "postCreateCommand": "cat /etc/os-release",
35+
36+
// Configure tool-specific properties.
37+
// "customizations": {},
38+
39+
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
40+
// "remoteUser": "devcontainer"
41+
}

.github/workflows/ruby.yml

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,17 @@ jobs:
1111
- uses: actions/checkout@v2
1212
- uses: ruby/setup-ruby@v1
1313
with:
14-
ruby-version: 2.7.2
14+
ruby-version: 3.2
1515
bundler-cache: true
16-
- name: Danger
17-
if: ${{ github.event_name == 'pull_request' }}
18-
run: |
19-
gem install danger
20-
export DANGER_GITHUB_API_TOKEN=${{ github.token }}
21-
danger
2216
- name: Rubocop
2317
run: bundle exec rubocop --auto-correct
2418
Test:
2519
runs-on: ubuntu-latest
2620
strategy:
2721
fail-fast: false
2822
matrix:
29-
ruby-version: [ '3.1', '3.0', '2.7', '2.6' ]
30-
gemfile: [ '7.0', '6.1', '6.0', '5.2', 'edge' ]
31-
exclude:
32-
- { ruby-version: '3.1', gemfile: "6.1" } # Triggers some deprecations that might never get fixed
33-
- { ruby-version: '3.1', gemfile: "6.0" }
34-
- { ruby-version: '3.1', gemfile: "5.2" }
35-
- { ruby-version: '3.0', gemfile: "5.2" }
36-
- { ruby-version: '2.6', gemfile: "edge" }
37-
- { ruby-version: '2.6', gemfile: "7.0" }
23+
ruby-version: [ '3.4', '3.3', '3.2' ]
24+
gemfile: [ '8.0', '7.2', '7.1', '7.0', 'edge' ]
3825
steps:
3926
- uses: actions/checkout@v2
4027
- name: Set up Ruby

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,15 @@
2929
# For Alpine images
3030
.ash_history
3131

32+
.npm/
33+
node_modules/
34+
35+
.ssh/
36+
.gnupg/
37+
.gitconfig
38+
3239
vendor/bundle
40+
41+
.vscode-server/
42+
43+
compose.override.yml

.rubocop.yml

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -44,44 +44,18 @@ Layout/LineLength:
4444
# The IgnoreCopDirectives option causes the LineLength rule to ignore cop
4545
# directives like '# rubocop: enable ...' when calculating a line's length.
4646
IgnoreCopDirectives: true
47-
# The IgnoredPatterns option is a list of !ruby/regexp and/or string
48-
# elements. Strings will be converted to Regexp objects. A line that matches
49-
# any regular expression listed in this option will be ignored by LineLength.
50-
IgnoredPatterns: []
47+
# AllowedPatterns: []
5148

52-
# Rails 5 only requires 2.2.2.
5349
AllCops:
5450
NewCops: enable
5551
DisplayCopNames: true
5652
DisplayStyleGuide: true
57-
TargetRubyVersion: 2.6
53+
TargetRubyVersion: 3.2
5854
Exclude:
5955
- Capfile
6056
- Gemfile
61-
- "test/rails_app/bin/**/*"
62-
- "test/rails_app/config/**/*"
63-
- test/rails_app/config.ru
64-
- "test/rails_app/db/**/*"
65-
- "test/rails_app/log/**/*"
66-
- "test/rails_app/tmp/**/*"
67-
- "test/rails_app/vendor/**/*"
68-
- "test/rails_app/node_modules/**/*"
69-
- "test/rails_app/bower_components/**/*"
70-
- test/rails_app/Gemfile
71-
- test/rails_app/Guardfile
72-
- test/rails_app/Rakefile
73-
- "test/es_rails_app/bin/**/*"
74-
- "test/es_rails_app/config/**/*"
75-
- test/es_rails_app/config.ru
76-
- "test/es_rails_app/db/**/*"
77-
- "test/es_rails_app/log/**/*"
78-
- "test/es_rails_app/tmp/**/*"
79-
- "test/es_rails_app/vendor/**/*"
80-
- "test/es_rails_app/node_modules/**/*"
81-
- "test/es_rails_app/bower_components/**/*"
82-
- test/es_rails_app/Gemfile
83-
- test/es_rails_app/Guardfile
84-
- test/es_rails_app/Rakefile
57+
- test/es_rails_app/**/*
58+
- test/rails_app/**/*
8559
- vendor/bundle/**/*
8660

8761
Metrics/BlockLength:
@@ -99,9 +73,3 @@ Metrics/ClassLength:
9973
Metrics/MethodLength:
10074
Exclude:
10175
- test/**/*.rb
102-
103-
# TODO: Remove this when minimum Ruby is 2.3.
104-
Layout/HeredocIndentation:
105-
Exclude:
106-
- Dangerfile
107-
- devise-bootstrap-form.gemspec

CONTRIBUTING.md

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ To use the `devise-bootstrap-form` gem in a test app:
2121
cd test/rails_app # or cd test/es_rails_app
2222
# Generate the view in the test app
2323
rails g devise:views:bootstrap_form
24-
rails s -b 0.0.0.0 &
24+
bin/dev
2525
# Navigate to localhost:3000/people/sign_in
2626
```
2727

@@ -30,7 +30,7 @@ To change the version of Rails for the test app:
3030
```bash
3131
export BUNDLE_GEMFILE=gemfiles/7.0.gemfile # change this to the version of Rails you need
3232
bundle update
33-
rails s -b 0.0.0.0 &
33+
bin/dev
3434
```
3535

3636
### Automated Testing
@@ -49,6 +49,35 @@ To run the tests and the RuboCop checks, assuming you've set the `BUNDLE_GEMFILE
4949
rake
5050
```
5151

52+
## New Version of Rails
53+
54+
I create a new app from scratch in a new directory.
55+
56+
1. Install latest Rails: `gem install rails`.
57+
1. Create a new app: `cd test && rails new rails_app_8.0 --skip-git --javascript=esbuild --css bootstrap --skip-action-mailbox --skip-active-storage --skip-action-cable --skip-kamal --skip-solid`.
58+
1. `cd rails_app_8.0`.
59+
1. `rails db:prepare`.
60+
1. Update the `web` line of `Procfile.dov` to: `web: env RUBY_DEBUG_OPEN=true bin/rails server -b 0.0.0.0`.
61+
1. `bin/dev`.
62+
1. Follow the standard installation instructions from the [README](), but get the `devise-bootstrap-form` gem from the parent directory.
63+
```
64+
gem "devise-bootstrap-form", path: "../.."
65+
```
66+
1. Follow the instructions in the [above section](#manual-and-exploratory-testing).
67+
1. Restart the server.
68+
69+
### Internationalization
70+
71+
**Very Important**
72+
73+
To create a new instance of the test app for Spanish, you have to "customize" the translations provided by the `devise-i18n` gem. Generate them:
74+
75+
```
76+
rails g devise:i18n:locale es
77+
```
78+
79+
then change the instances of `user` in `config/locales/es.yml` to `person`.
80+
5281
## Gotchas
5382
5483
To test that the views work for a model other than the default `User`, the test apps use `Person` as the Devise model. It's a bit frustrating to remember that you can't just cut and paste examples that assume the model is `User`.

Dangerfile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ has_changelog_changes = git.modified_files.include?("CHANGELOG.md")
2121
# You've made changes to lib, but didn't write any tests?
2222
# ------------------------------------------------------------------------------
2323
if has_lib_changes && !has_test_changes
24-
warn("There are code changes, but no corresponding tests. "\
25-
"Please include tests if this PR introduces any modifications in "\
24+
warn("There are code changes, but no corresponding tests. " \
25+
"Please include tests if this PR introduces any modifications in " \
2626
"#{project_name}'s behavior.",
2727
sticky: false)
2828
end
@@ -32,14 +32,14 @@ end
3232
# ------------------------------------------------------------------------------
3333
if !has_changelog_changes && has_lib_changes
3434
markdown <<~MARKDOWN
35-
Here's an example of a CHANGELOG.md entry (place it immediately under the `* Your contribution here!` line):
35+
Here's an example of a CHANGELOG.md entry (place it immediately under the `* Your contribution here!` line):
3636
37-
```markdown
38-
* [##{pr_number}](#{pr_url}): #{github.pr_title} - [@#{github.pr_author}](https://github.com/#{github.pr_author}).
39-
```
37+
```markdown
38+
* [##{pr_number}](#{pr_url}): #{github.pr_title} - [@#{github.pr_author}](https://github.com/#{github.pr_author}).
39+
```
4040
MARKDOWN
41-
warn("Please update CHANGELOG.md with a description of your changes. "\
42-
"If this PR is not a user-facing change (e.g. just refactoring), "\
41+
warn("Please update CHANGELOG.md with a description of your changes. " \
42+
"If this PR is not a user-facing change (e.g. just refactoring), " \
4343
"you can disregard this.", sticky: false)
4444
end
4545

Gemfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ source "https://rubygems.org"
66
gemspec
77

88
group :development do
9-
gem "chandler", ">= 0.7.0"
10-
# gem "htmlbeautifier"
9+
gem "rubocop-rails-omakase"
1110
gem "rubocop", require: false
1211
gem "rubocop-rake", require: false
1312
end

README.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,18 @@ It also makes the Devise views simpler, because the code to define forms using `
66

77
You can find usage information below, but the gist of it is you'll run `rails g devise:views:bootstrap_form` instead of the normal `rails g devise:views`.
88

9-
If you're just looking for Bootstrap markup on your Devise views, and don't want to use `bootstrap_form`, then you should look into the [`devise-bootstrapped`](https://github.com/king601/devise-bootstrapped) gem, or [`devise-bootstrap-views`](https://github.com/hisea/devise-bootstrap-views).
9+
If you're just looking for Bootstrap markup on your Devise views, and don't want to use `bootstrap_form`, then you should look into the [`devise-bootstrapped`](https://github.com/king601/devise-bootstrapped) gem, or the [`devise-bootstrap-views`](https://github.com/hisea/devise-bootstrap-views) gem.
1010

1111
## Installation
1212

1313
Add these lines to your application's `Gemfile`:
1414

1515
```ruby
16-
gem 'bootstrap', '~> 5.0'
1716
gem "bootstrap_form", "~> 5.0"
18-
gem 'devise'
19-
# gem 'devise-i18n'
20-
# gem 'devise_invitable'
21-
gem 'devise-bootstrap-form'
17+
gem "devise"
18+
# gem "devise-i18n"
19+
# gem "devise_invitable"
20+
gem "devise-bootstrap-form"
2221
```
2322

2423
And then execute:
@@ -27,8 +26,8 @@ And then execute:
2726
bundle install
2827
```
2928

30-
There are additional installation instructions for [`bootstrap_form`](https://github.com/bootstrap-ruby/bootstrap_form#installation), [`bootstrap`](https://github.com/twbs/bootstrap-rubygem#a-ruby-on-rails), [`devise`](https://github.com/plataformatec/devise) that you must complete before using `devise-bootstrap-form`, and
31-
[`devise-i18n`](https://github.com/tigrish/devise-i18n).
29+
There are additional installation instructions for [`bootstrap_form`](https://github.com/bootstrap-ruby/bootstrap_form#installation), [`devise`](https://github.com/plataformatec/devise) that you must complete before using `devise-bootstrap-form`, and
30+
[`devise-i18n`](https://github.com/devise-i18n/devise-i18n).
3231

3332
Note that as of Devise 4.6.0, `devise_error_messages!` is deprecated in favour of the `_error_messages.html.erb` partial. `devise-bootstrap-form` versions 0.3.0 and higher generate views that use the `_error_messages.html.erb` partial. If you need to use `devise_error_messages!`, use this line in your `Gemfile`:
3433

RELEASING.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ Follow these steps to release a new version of `devise-bootstrap-form` to `rubyg
66

77
* You must have commit rights to the `devise-bootstrap-form` repository.
88
* You must have push rights for the `devise-bootstrap-form` gem on `rubygems.org`.
9-
* You must be using Ruby >= 2.2.
10-
* Your GitHub credentials must be available to Chandler via `~/.netrc` or an environment variable, [as explained here](https://github.com/mattbrictson/chandler#2-configure-credentials).
9+
* You must be using Ruby >= 3.2.
1110

1211
## How to release
1312

Rakefile

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,3 @@ desc "Run RuboCop lint checks"
1414
RuboCop::RakeTask.new(:lint)
1515

1616
task default: %i[test lint]
17-
18-
require "chandler/tasks"
19-
20-
# Add chandler as a prerequisite for `rake release`
21-
task "release:rubygem_push" => "chandler:push"

0 commit comments

Comments
 (0)