jcanfield
10/27/2016 - 1:59 AM

A small bashscript to setup an web-development environment with gulp, bower, nodejs in Ubuntu/Ubuntu-based distributions. !!! Be careful: I

A small bashscript to setup an web-development environment with gulp, bower, nodejs in Ubuntu/Ubuntu-based distributions. !!! Be careful: I recommend to only use it on a fresh installed system, otherwise it could mess up something !!!

#!/bin/bash

# Echo to nowhere for a more beautiful console output
sudo echo > /dev/null

# Add nodejs and sublime text ppa
echo ':: adding ppas'
sudo add-apt-repository -y ppa:chris-lea/node.js > /dev/null 2>&1
sudo add-apt-repository -y ppa:webupd8team/sublime-text-3 > /dev/null 2>&1

# Update repository
echo ':: updating package list'
sudo apt-get update > /dev/null 2>&1

# Install packages
echo ':: installing packages'
sudo apt-get install -y -qq git nodejs ruby sublime-text-installer > /dev/null 2>&1

# Configure package managers
echo ':: configuring package managers'
if [ ! -f ~/.bashrc ]; then
  touch ~/.bashrc
fi
echo 'export PATH=$HOME/.node_modules/bin:$HOME/.gem/ruby/1.9.1/bin:$PATH' | cat - ~/.bashrc > /tmp/_bashrc && mv /tmp/_bashrc ~/.bashrc
source ~/.bashrc
echo 'gem: --user-install' > ~/.gemrc
npm config set prefix ~/.node_modules

# Install rubygems
echo ':: installing rubygems'
gem install -q sass > /dev/null 2>&1

# Install node modules
echo ':: installing node modules ... (this will take a while)'
npm install npm --prefix=~/.node_modules -g > /dev/null 2>&1
npm install -g --silent gulp bower yo vtop generator-gulp-webapp > /dev/null 2>&1

# Done
echo ':: everything is done'
echo ':: now open a new terminal and have fun!'