Skip to content

Commit

Permalink
Add custom tap command
Browse files Browse the repository at this point in the history
  • Loading branch information
mikesplain committed Dec 29, 2017
1 parent 4b6c4ab commit 2db8b28
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ Instead, to deploy to [Heroku](https://www.heroku.com) click:
- `WEB_CONCURRENCY`: the number of Unicorn (web server) processes to run (defaults to 3).
- `STRAP_ISSUES_URL`: the URL where users should file issues (defaults to https://github.com/mikemcquaid/strap/issues/new).
- `STRAP_BEFORE_INSTALL`: instructions displayed in the web application for users to follow before installing Strap (wrapped in `<li>` tags).
- `CUSTOM_TAP`: an optional tap to tap, allowing other commands to be setup from strap.sh.
- `CUSTOM_COMMAND`: a single command that is run after all other stages have completed.

## Status
Stable and in active development.
Expand Down
8 changes: 8 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@
"STRAP_BEFORE_INSTALL": {
"description": "Instructions displayed in the web application for users to follow before installing Strap (will be wrapped in `<li>` tags)..",
"required": false
},
"CUSTOM_TAP": {
"description": "an optional tap to tap, allowing other commands to be setup from strap.sh.",
"required": false
},
"CUSTOM_COMMAND": {
"description": "a single command that is run after all other stages have completed.",
"required": false
}
}
}
14 changes: 14 additions & 0 deletions bin/strap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ STDIN_FILE_DESCRIPTOR="0"
# STRAP_GIT_EMAIL=
# STRAP_GITHUB_USER=
# STRAP_GITHUB_TOKEN=
# CUSTOM_TAP=
# CUSTOM_COMMAND=
STRAP_ISSUES_URL="https://github.com/mikemcquaid/strap/issues/new"

STRAP_FULL_PATH="$(cd "$(dirname "$0")" && pwd)/$(basename "$0")"
Expand Down Expand Up @@ -324,5 +326,17 @@ if [ -f "$HOME/.Brewfile" ]; then
logk
fi

if [ -n "$CUSTOM_TAP" ]; then
log "Tapping custom tap:"
brew tap "$CUSTOM_TAP"
logk
fi

if [ -n "$CUSTOM_COMMAND" ]; then
log "Executing custom command $CUSTOM_COMMAND:"
brew $CUSTOM_COMMAND
logk
fi

STRAP_SUCCESS="1"
log "Your system is now Strap'd!"
4 changes: 4 additions & 0 deletions web/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
STRAP_ISSUES_URL = ENV["STRAP_ISSUES_URL"] || \
"https://github.com/mikemcquaid/strap/issues/new"
STRAP_BEFORE_INSTALL = ENV["STRAP_BEFORE_INSTALL"]
CUSTOM_TAP = ENV["CUSTOM_TAP"]
CUSTOM_COMMAND = ENV["CUSTOM_COMMAND"]

set :sessions, secret: SESSION_SECRET

Expand Down Expand Up @@ -67,6 +69,8 @@

content = IO.read(File.expand_path("#{File.dirname(__FILE__)}/../bin/strap.sh"))
content.gsub!(/^STRAP_ISSUES_URL=.*$/, "STRAP_ISSUES_URL='#{STRAP_ISSUES_URL}'")
content.gsub!(/^# CUSTOM_TAP=.*$/, "CUSTOM_TAP='#{CUSTOM_TAP}'")
content.gsub!(/^# CUSTOM_COMMAND=.*$/, "CUSTOM_COMMAND='#{CUSTOM_COMMAND}'")

content_type = params["text"] ? "text/plain" : "application/octet-stream"

Expand Down

0 comments on commit 2db8b28

Please sign in to comment.