Last active
March 28, 2016 10:15
-
-
Save navio/7443018 to your computer and use it in GitHub Desktop.
Script to install NVM, Node, PhantomJS and CasperJS without installing or using git.
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 | |
# Sets node version to install. | |
export NODE_VERSION=v0.10.21; | |
# Verify if nvm installation exist, otherwise install. | |
if ! hash "nvm" >/dev/null 2>&1; then | |
printf "Installing NVM %s\n" >&2 | |
curl https://raw.github.com/creationix/nvm/master/install-gitless.sh | sh; | |
fi | |
wait | |
# Installing Node! | Will skip if already exist | |
source $HOME/.bash_profile; | |
cd $HOME; | |
nvm install $NODE_VERSION; | |
wait | |
echo 'Node Installation Complete'; | |
#Installing PhantomJS! | Will skip if already exist | |
source $HOME/.bash_profile; | |
npm install -g phantomjs; | |
wait | |
echo 'PhantomJS Installation Complete'; | |
# Downloading CasperJS! Latest Dev Version | |
cd $HOME/.nvm/$NODE_VERSION/lib/node_modules; | |
wget https://github.com/n1k0/casperjs/zipball/master; | |
unzip master; | |
mv *casperjs* casperjs; | |
cd $HOME/.nvm/$NODE_VERSION/bin; | |
ln -s $HOME/.nvm/$NODE_VERSION/lib/node_modules/casperjs/bin/casperjs casperjs; | |
source $HOME/.bash_profile; | |
wait | |
echo 'CasperJS Installation Complete'; | |
# Verify Installation - Prompt with Alert if Problems. | |
commands_tocheck="nvm phantomjs casperjs" | |
missing_counter=0; | |
for needed_command in $commands_tocheck; do | |
if ! hash "$needed_command" >/dev/null 2>&1; then | |
printf "Command not found in PATH: %s\n" "$needed_command" >&2 | |
((missing_counter++)) | |
fi | |
done | |
if ((missing_counter > 0)); then | |
printf "There was something wrong with the installation. Please contact the Reference Store Team" >&2 | |
exit 1 | |
fi | |
# Alert of Installation Completition. | |
echo >&2 "Dependecies Installation Complete Downloading JUTS " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment