Last active
August 29, 2015 14:19
-
-
Save willejs/347ec18cd4683bbab5a3 to your computer and use it in GitHub Desktop.
sprout-wrap-bootstrap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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