Skip to content

Commit

Permalink
README: Update instructions for generating a new app
Browse files Browse the repository at this point in the history
Closes #1221

The [release of Rails 7.2.0][rails_7_2] introduced its [own linting
mechanism][rails-lint].

Unfortunately, this creates a conflict with [our linting
mechanism][suspenders-lint].

This is only relevant when running `rails new` with our [application
template][].

In order to fix this, we simply require the caller pass
`--skip_rubocop`.

A future commit could explore re-introducing the system executable to
account for our required options, but for now, this fixes the issue.

[rails_7_2]: https://guides.rubyonrails.org/v7.2/7_2_release_notes.html
[rails-lint]: https://guides.rubyonrails.org/v7.2/7_2_release_notes.html#add-omakase-rubocop-rules-by-default
[suspenders-lint]: https://github.com/thoughtbot/suspenders/blob/main/FEATURES.md#linting
[application template]: https://github.com/thoughtbot/suspenders/blob/main/lib/install/web.rb
  • Loading branch information
stevepolitodesign committed Aug 15, 2024
1 parent 2e1196f commit 00a7e0e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ application with Suspenders.
We skip the [default test framework][] in favor of [RSpec][], and [prefer
PostgreSQL][] as our database.

We skip [RuboCop rules by default][] in favor of our [holistic linting rules][].

```
rails new app_name \
--skip_rubocop \
--skip-test \
-d=postgresql \
-m=https://raw.githubusercontent.com/thoughtbot/suspenders/main/lib/install/web.rb
Expand All @@ -57,6 +60,8 @@ app_name`, or create your own [railsrc][] file with the following configuration:
[prefer PostgreSQL]: https://github.com/thoughtbot/dotfiles/pull/728
[dotfiles]: https://github.com/thoughtbot/dotfiles
[railsrc]: https://github.com/rails/rails/blob/7f7f9df8641e35a076fe26bd097f6a1b22cb4e2d/railties/lib/rails/generators/rails/app/USAGE#L5C1-L7
[RuboCop rules by default]: https://guides.rubyonrails.org/v7.2/7_2_release_notes.html#add-omakase-rubocop-rules-by-default
[holistic linting rules]: https://github.com/thoughtbot/suspenders/blob/main/FEATURES.md#linting

### With Existing Rails Applications

Expand Down
3 changes: 2 additions & 1 deletion lib/install/web.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def apply_template!

fail Rails::Generators::Error, message
end
if options[:database] == "postgresql" && options[:skip_test]
if options[:database] == "postgresql" && options[:skip_test] && options[:skip_rubocop]
after_bundle do
gem_group :development, :test do
gem "suspenders"
Expand All @@ -42,6 +42,7 @@ def apply_template!
=== Please use the correct options ===
rails new <app_name> \\
--skip-rubocop \\
--skip-test \\
-d=postgresql \\
-m=https://raw.githubusercontent.com/thoughtbot/suspenders/main/lib/install/web.rb
Expand Down

0 comments on commit 00a7e0e

Please sign in to comment.