Skip to content

Instantly share code, notes, and snippets.

@levymoreira
Last active August 29, 2015 14:27
Show Gist options
  • Save levymoreira/16e6f76875b35b1c9028 to your computer and use it in GitHub Desktop.
Save levymoreira/16e6f76875b35b1c9028 to your computer and use it in GitHub Desktop.
This script configure a NodeJs dev machine
########################################################
# This script configure a NodeJs dev machine
# How run?
# 1- Save this text as configureDevMachine.sh at home directory
# 2- Change the variable notRootUser to your user name
# 3- Open terminal and execute
# sudo chmod u+x configureDevMachine.sh
# sudo ./configureDevMachine.sh
########################################################
#Default user
notRootUser=developer
echo "Check if user is root"
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
echo "Is root... lets go!"
echo "Installing git"
sudo apt-get --assume-yes install git
#Necessary to protractor (selenium jetty server)
echo "Installing jre"
sudo apt-get --assume-yes install default-jre
echo "Installingnode and npm"
sudo apt-get --assume-yes install nodejs
sudo apt-get --assume-yes install npm
sudo ln -s /usr/bin/nodejs /usr/bin/node
echo "Installing node plugins"
sudo npm install --global bower --allow-root
sudo npm install --global grunt-cli
sudo npm install --global protractor
echo "Installing chrome"
sudo apt-get --assume-yes install libxss1 libappindicator1 libindicator7
sudo -u $notRootUser wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome*.deb
echo "Cloning sample repository"
sudo -u $notRootUser git clone -b pocFrameworkTest http://levy_moreira:12345678@ip/url/pocs.git
cd pocs/pocFrameworksTest
echo "Setting the app"
sudo chmod -R +777 ~/tmp/
sudo -u $notRootUser npm install
sudo -u $notRootUser bower --config.interactive=false install
echo "Closing browsers"
killall -9 chrome
killall -9 firefox
echo "Running tests"
sudo -u $notRootUser grunt test
echo "Starting the server"
sudo -u $notRootUser grunt serve
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment