Skip to content

Instantly share code, notes, and snippets.

@fnichol
Created January 7, 2013 17:57
Show Gist options
  • Save fnichol/4476990 to your computer and use it in GitHub Desktop.
Save fnichol/4476990 to your computer and use it in GitHub Desktop.
Basic Project script/bootstrap
#!/usr/bin/env bash
set -e
[ -n "$BOOTSTRAP_DEBUG" ] && set -x
banner() { printf -- "-----> $*\n"; }
log() { printf -- " $*\n"; }
warn() { printf -- ">>>>>> $*\n"; }
fail() { printf -- "\nERROR: $*\n" ; exit 1 ; }
if ! command -v direnv >/dev/null ; then
warn "The direnv command is not installed and helps in using"
warn "this project."
warn ""
warn "Please visit https://github.com/zimbatm/direnv for more details."
warn ""
warn "If you are on a Mac and using Homebrew, install it with:"
warn ""
warn " $ brew install direnv"
warn ""
warn "Follow the post-install instructions, and re-run $0"
warn "\n"
fi
if ! command -v bundle >/dev/null ; then
banner "Installing bundler gem"
gem install bundler
fi
if ! bundle check >/dev/null ; then
bundle_cmd="bundle install --path vendor/bundle --binstubs vendor/binstubs"
banner "Running '$bundle_cmd'"
$bundle_cmd
else
log "Bundler up to date, skipping 'bundle install'"
fi
banner 'All ready!'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment