From c69f21a767faa69c2480b3a85cbe45edbdcb3acb Mon Sep 17 00:00:00 2001 From: Steve Polito Date: Thu, 5 Dec 2024 10:50:29 -0500 Subject: [PATCH] Add option to install local build In the process of supporting Rails 8 via #1213, we realized we needed to install a local build. This commit simply introduces a `--suspenders-local` option, and documents how to build locally. Co-Authored-By: Nick Charlton --- CONTRIBUTING.md | 26 ++++++++++++++++++++++++++ lib/install/web.rb | 2 ++ 2 files changed, 28 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2cacaaa4..65b0d3de 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -46,6 +46,32 @@ This is a time for discussion and improvements, and making the necessary changes will be required before we can merge the contribution. +## Testing a Local Build + +There are cases where you'll want to use a local build, rather tha a released +version. + +``` +SUSPENDERS_LOCAL_PATH=/path/to/suspenders \ + rails new app_name \ + --suspenders-local \ + --skip-rubocop \ + --skip-test \ + -d=postgresql \ + -m=https://raw.githubusercontent.com/thoughtbot/suspenders/main/lib/install/web.rb +``` + +You can also change the path used for the application template by setting the +`-m` flag to something else. + +``` +rails new app_name \ + --skip-rubocop \ + --skip-test \ + -d=postgresql \ + -m=path/to/suspenders/lib/install/web.rb +``` + ## Testing Generators There is a smaller dummy application at `test/dummy`. This application is used diff --git a/lib/install/web.rb b/lib/install/web.rb index b071c4d7..6f7d4fdc 100644 --- a/lib/install/web.rb +++ b/lib/install/web.rb @@ -27,6 +27,8 @@ def apply_template! gem_group :development, :test do if ARGV.include?("--suspenders-main") gem "suspenders", github: "thoughtbot/suspenders", branch: "main" + elsif ARGV.include?("--suspenders-local") && ENV["SUSPENDERS_LOCAL_PATH"] + gem "suspenders", path: ENV.fetch("SUSPENDERS_LOCAL_PATH") else gem "suspenders" end