Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow running against suspenders main #1230

Merged
merged 6 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Unreleased

* Require `--skip-rubocop` in favor of our [linting configuration][]
* Fixed: [Specify a tag when installing capybara_accessible_selectors](https://github.com/thoughtbot/suspenders/issues/1228)
* Fixed: [Issue 1229: How do we want to handle un-released versions?](https://github.com/thoughtbot/suspenders/issues/1229)

[linting configuration]: https://github.com/thoughtbot/suspenders/blob/main/FEATURES.md#linting

Expand Down
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,22 @@ PostgreSQL][] as our database.

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

#### Use the latest suspenders release:

```
rails new app_name \
--skip-rubocop \
--skip-test \
-d=postgresql \
-m=https://raw.githubusercontent.com/thoughtbot/suspenders/main/lib/install/web.rb
```

#### OR use the current (possibly unreleased) `main` branch of suspenders:

```
rails new app_name \
--skip_rubocop \
--suspenders-main \
--skip-rubocop \
--skip-test \
-d=postgresql \
-m=https://raw.githubusercontent.com/thoughtbot/suspenders/main/lib/install/web.rb
Expand All @@ -49,7 +62,7 @@ Alternatively, if you're using our [dotfiles][], then you can just run `rails ne
app_name`, or create your own [railsrc][] file with the following configuration:

```
--skip_rubocop
--skip-rubocop
--skip-test
--database=postgresql
-m=https://raw.githubusercontent.com/thoughtbot/suspenders/main/lib/install/web.rb
Expand Down
19 changes: 16 additions & 3 deletions lib/generators/suspenders/install/web_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,24 @@ class WebGenerator < Rails::Generators::Base

This generatator is intended to be invoked as part of an [application template][].

#### Use the latest suspenders release:

```
rails new <app_name> \\
--skip-rubocop \\
--skip-test \\
-d=postgresql \\
-m=https://raw.githubusercontent.com/thoughtbot/suspenders/main/lib/install/web.rb
```

#### OR use the current (possibly unreleased) `main` branch of suspenders:

```
rails new <app_name> \
rails new app_name \\
--suspenders-main \\
--skip-rubocop \\
--skip-test \
-d=postgresql \
--skip-test \\
-d=postgresql \\
-m=https://raw.githubusercontent.com/thoughtbot/suspenders/main/lib/install/web.rb
```

Expand Down
18 changes: 16 additions & 2 deletions lib/install/web.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ def apply_template!
if options[:database] == "postgresql" && options[:skip_test] && options[:skip_rubocop]
after_bundle do
gem_group :development, :test do
gem "suspenders"
if ARGV.include?("--suspenders-main")
gem "suspenders", github: "thoughtbot/suspenders", branch: "main"
else
gem "suspenders"
end
end

run "bundle install"
Expand All @@ -41,12 +45,22 @@ def apply_template!

=== Please use the correct options ===

# Use the latest suspenders release:
rails new <app_name> \\
--skip-rubocop \\
--skip-test \\
-d=postgresql \\
-m=https://raw.githubusercontent.com/thoughtbot/suspenders/main/lib/install/web.rb
ERROR

# OR use the current (possibly unreleased) `main` branch of suspenders:
rails new <app_name> \\
--suspenders-main \\
--skip-rubocop \\
--skip-test \\
-d=postgresql \\
-m=https://raw.githubusercontent.com/thoughtbot/suspenders/main/lib/install/web.rb

ERROR

fail Rails::Generators::Error, message
end
Expand Down
Loading