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

Add option to install local build #1241

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
26 changes: 26 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions lib/install/web.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Comment on lines +30 to +31
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels a little redundant. Would this be better?

Suggested change
elsif ARGV.include?("--suspenders-local") && ENV["SUSPENDERS_LOCAL_PATH"]
gem "suspenders", path: ENV.fetch("SUSPENDERS_LOCAL_PATH")
elsif ENV["SUSPENDERS_LOCAL_PATH"].present?
gem "suspenders", path: ENV.fetch("SUSPENDERS_LOCAL_PATH")

Then, we could omit --suspenders-local altogether.

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

else
gem "suspenders"
end
Expand Down
Loading