From e36f7367da30c1dc230561fc5779638d58a52cf8 Mon Sep 17 00:00:00 2001 From: Louis Antonopoulos Date: Tue, 8 Oct 2024 17:10:53 +0100 Subject: [PATCH] Allow running against suspenders main Co-authored-by: Steve Polito --- NEWS.md | 1 + README.md | 13 +++++++++++++ lib/install/web.rb | 22 +++++++++++++++++++--- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/NEWS.md b/NEWS.md index 264854c0..61acc707 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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 diff --git a/README.md b/README.md index ddd03a4f..86147bf0 100644 --- a/README.md +++ b/README.md @@ -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 \ diff --git a/lib/install/web.rb b/lib/install/web.rb index e1639958..6fe16524 100644 --- a/lib/install/web.rb +++ b/lib/install/web.rb @@ -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" @@ -41,12 +47,22 @@ def apply_template! === Please use the correct options === + # Use the latest suspenders release: rails new \\ --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 \\ + --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