Skip to content

Commit

Permalink
Allow running against suspenders main
Browse files Browse the repository at this point in the history
Co-authored-by: Steve Polito <[email protected]>
  • Loading branch information
louis-antonopoulos and stevepolitodesign committed Oct 8, 2024
1 parent 1f13e7b commit e36f736
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
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
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,21 @@ 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 \
--suspenders_main \
--skip_rubocop \
--skip-test \
-d=postgresql \
Expand Down
22 changes: 19 additions & 3 deletions lib/install/web.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,14 @@ def apply_template!
end
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_group :development, :test do
gem "suspenders", github: "thoughtbot/suspenders", branch: "main"
end
else
gem_group :development, :test do
gem "suspenders"
end
end

run "bundle install"
Expand All @@ -41,12 +47,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

0 comments on commit e36f736

Please sign in to comment.