Last active
October 5, 2015 14:19
-
-
Save matthewpizza/005044062dd93fbe59ce to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
################### | |
# Access to Tools # | |
################### | |
# Variables | |
## get current directory path | |
pushd `dirname $0` > /dev/null | |
directory=`pwd` | |
popd > /dev/null | |
## path to composer config | |
composer_config="$directory/composer.json" | |
## path to node config | |
node_config="$directory/package.json" | |
## path to bower config | |
bower_config="$directory/bower.json" | |
# Functions | |
## check if is installed | |
is_installed() { | |
type "$1" &> /dev/null ; | |
} | |
## install composer | |
install_composer() { | |
cd $HOME | |
curl -sS https://getcomposer.org/installer | php | |
echo -e "\n# Composer\nalias composer=\"php \$HOME/composer.phar\"" >> $HOME/.bash_profile | |
source $HOME/.bash_profile | |
## install composer dependencies in composer.json | |
if [ -f $composer_config ]; then | |
composer install $composer_config | |
fi | |
} | |
## install homebrew | |
install_brew() { | |
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)" | |
brew update | |
brew doctor | |
export PATH="/usr/local/bin:$PATH" | |
} | |
## install node | |
install_node() { | |
brew install node | |
## install node modules in package.json | |
if [ -f $node_config ]; then | |
npm install $node_config | |
fi | |
} | |
## install bower | |
install_bower() { | |
npm install -g bower | |
## install bower components in bower.json | |
if [ -f $bower_config ]; then | |
bower install $bower_config | |
fi | |
} | |
## install lolcat | |
install_lolcat() { | |
gem install lolcat | |
} | |
# Install | |
## list of requirements | |
requirements="brew node bower composer lolcat" | |
## loop through requirements | |
for requirement in $requirements | |
do | |
### install if not already installed | |
if ! is_installed $requirement ; then | |
echo "Installing $requirement" | |
eval "install_$requirement" | |
else | |
echo "$requirement is already installed" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment