Skip to content

Instantly share code, notes, and snippets.

@NonLogicalDev
Last active August 29, 2015 14:05
Show Gist options
  • Save NonLogicalDev/ad88aedfed4e69860db5 to your computer and use it in GitHub Desktop.
Save NonLogicalDev/ad88aedfed4e69860db5 to your computer and use it in GitHub Desktop.
failed=0
if [[ -z `command -v node` ]]; then
printf `tput setaf 1` 1>&2
echo "ERROR: You need to install NodeJS" 1>&2
printf `tput sgr0` 1>&2
echo "You can get instructions here" 1>&2
printf `tput setaf 2` 1>&2
echo " http://nodejs.org" 1>&2
printf `tput sgr0` 1>&2
echo "" 1>&2
echo "That said, I hignly recomend you to use the NVM (Node Version Manager)" 1>&2
echo "You can get it here:" 1>&2
printf `tput setaf 2` 1>&2
echo " https://github.com/creationix/nvm" 1>&2
printf `tput sgr0` 1>&2
echo "" 1>&2
exit 1
else
printf `tput setaf 2`
echo "You have: Node"
printf `tput sgr0`
fi
if [[ -z `command -v ruby` ]]; then
printf `tput setaf 1` 1>&2
echo "ERROR: You need to install Ruby" 1>&2
printf `tput sgr0` 1>&2
echo "You can get instructions here" 1>&2
printf `tput setaf 2` 1>&2
echo " https://www.ruby-lang.org/en/installation/" 1>&2
printf `tput sgr0` 1>&2
echo "" 1>&2
echo "That said, I hignly recomend you to use the RVM (Ruby Version Manager)" 1>&2
echo "You can get it here:" 1>&2
printf `tput setaf 2` 1>&2
echo " http://rvm.io" 1>&2
printf `tput sgr0` 1>&2
echo "" 1>&2
exit 1
else
printf `tput setaf 2`
echo "You have: Ruby"
printf `tput sgr0`
fi
if [[ -z `command -v grunt` ]]; then
printf `tput setaf 1` 1>&2
echo "ERROR: You need to install Grunt-Cli" 1>&2
printf `tput sgr0` 1>&2
echo "You can install it using this command:" 1>&2
printf `tput setaf 2` 1>&2
echo " npm install -g grunt-cli" 1>&2
printf `tput sgr0` 1>&2
echo "" 1>&2
failed=1
else
printf `tput setaf 2`
echo "You have: Grunt"
printf `tput sgr0`
fi
if [[ -z `command -v bower` ]]; then
printf `tput setaf 1` 1>&2
echo "ERROR: You need to install bower" 1>&2
printf `tput sgr0` 1>&2
echo "You can install it using this command:" 1>&2
printf `tput setaf 2` 1>&2
echo " npm install -g bower" 1>&2
printf `tput sgr0` 1>&2
echo "" 1>&2
failed=1
else
printf `tput setaf 2`
echo "You have: Bower"
printf `tput sgr0`
fi
if [[ -z `command -v scss` || -z `command -v sass` ]]; then
printf `tput setaf 1` 1>&2
echo "ERROR: You need to install Scss/Sass" 1>&2
printf `tput sgr0` 1>&2
echo "You can install them using this command:" 1>&2
printf `tput setaf 2` 1>&2
echo " gem install sass" 1>&2
printf `tput sgr0` 1>&2
echo "" 1>&2
failed=1
else
printf `tput setaf 2`
echo "You have: Scss and Sass"
printf `tput sgr0`
fi
if [[ $failed -eq 0 ]]; then
printf `tput setaf 2`
echo "Good to go! Starting installation."
printf `tput sgr0`
else
printf `tput setaf 1`
echo "You need to resolve the problems before proceeding with installation."
printf `tput sgr0`
exit 1
fi
echo "Are you certain you want to download the script to this folder? (Y/n)"
read response
if [[ $response != "Y" ]]; then
echo "Aborting instalation."
exit 1
fi
echo "What would you like to call the project folder?(Using git name if none provided)"
read response
if [[ -z $response ]]; then
echo "Using git repo name"
fi
printf `tput setaf 2`
echo "Clonning the repository"
printf `tput sgr0`
git clone git://github.com/NonLogicalDev/jeans-nodejs-playground "$response"
if (($? > 0)); then
exit 1
fi
if [[ -n $response ]]; then
printf `tput setaf 2`
echo "Renaming the project folder"
printf `tput sgr0`
mv jeans-nodejs-playground "$response"
else
response='jeans-nodejs-playground'
fi
cd "$response"
printf `tput setaf 2`
echo "Installing node dependencies"
printf `tput sgr0`
npm install
if (($? > 0)); then
exit 1
fi
printf `tput setaf 2`
echo "Installing front end libraries"
printf `tput sgr0`
bower install
if (($? > 0)); then
exit 1
fi
printf `tput setaf 3`
echo ""
echo ""
echo ""
echo "Would you like to test run the server?(Y/n)"
printf `tput sgr0`
read response
if [[ $response == 'Y' ]]; then
echo ""
echo "$ grunt livedev"
grunt livedev
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment