Skip to content

Instantly share code, notes, and snippets.

@willejs
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save willejs/347ec18cd4683bbab5a3 to your computer and use it in GitHub Desktop.
Save willejs/347ec18cd4683bbab5a3 to your computer and use it in GitHub Desktop.
sprout-wrap-bootstrap
#!/bin/bash
set -e
# Read SPROUTREPO from environment or use default crowdsurge repo
: ${SPROUTREPO:="https://github.com/crowdsurge/sprout-wrap.git"}
### Define some helper functions ###
usage() {
cat << _EOF_
Usage: "$0" [options]
This script will install Xcode 5.1.1, Xcode cli tools, and various other applications though sprout wrap.
Options:
-h | --help Print this message
--no-xcode Do not install Xcode
ENVVARS:
SPROUTREPO $SPROUTREPO
_EOF_
}
die() {
usage
echo ERROR: "$*"
exit 1
}
install_xcode() {
# Install Xcode
xcode-select --install || die
sudo xcodebuild -license || die
}
### Parse arguments ###
noXcode="false"
scriptArg=${1:-}
if [[ ! -z "$scriptArg" ]]; then
case "$1" in
"--no-xcode")
noXcode="true"
;;
"-h"|"--help")
usage
exit
;;
*) usage && die "Invalid option"
;;
esac; shift
fi
# Ensure no extra arguments have been passed to the script
# this could cause unknown behavior
#${1+:} false && die Unknown option \""$1"\"
### Execute ###
cd "$workDir"
if [[ "$noXcode" != "true" ]]; then
install_xcode
fi
# Clone or update the sprout-wrap directory
if [[ -d ./sprout-wrap ]]; then
cd sprout-wrap
git pull origin master
else
git clone "$SPROUTREPO" sprout-wrap
cd sprout-wrap
fi
# Setup and run sprout-wrap
echo "Preparing sprout-wrap..."
sudo gem install bundler
sudo ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future bundle
echo "Running sprout-wrap..."
sudo bundle exec soloist
echo 'Script has completed, enjoy your new workstation!'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment