Permalink
Browse files

Node installation now managed by NVM

  • Loading branch information...
goodguyry committed Dec 30, 2014
1 parent 7e315ff commit 5cd72d0a62779aace5ee444eb1ae8cf0194955f6
Showing with 36 additions and 13 deletions.
  1. +3 −0 bash/bash_profile
  2. +33 −13 local/packages
View
@@ -10,6 +10,7 @@ declare -a files=(
$HOME/.bash_prompt # Custom bash prompt
$HOME/.extras # Local and private settings not under version control (e.g. git credentials)
$HOME/.bash_paths # Path modifications
$HOME/.nvm/nvm.sh # Load NVM
)
# If these files are readable, source them
@@ -22,6 +23,8 @@ done
unset files
## Use the installed stable version of Node
nvm use stable > /dev/null
# If possible, add tab completion for many more commands
[ -f /etc/bash_completion ] && source /etc/bash_completion
View
@@ -130,28 +130,47 @@ function init_casks() {
}
# Install node and packages
# Install Node packages
function init_npm() {
# Check for Homebrew
check_for_homebrew
# Check for npm
if ! type_exists 'npm'; then
e_header "Installing Node..."
brew install node
if type_exists 'npm'; then
e_header "Installing Node.js packages..."
# List of npm packages
local packages="bower grunt-cli grunt-init browser-sync jshint"
# Install packages globally and quietly
npm install $packages --g --quiet
[[ $? ]] && e_success "Done"
else
e_header "NPM not yet installed..."
init_nvm
fi
e_header "Installing Node.js packages..."
}
# List of npm packages
local packages="bower grunt-cli grunt-init browser-sync jshint"
# Install/Update Node (via NVM)
function init_nvm() {
old_pwd=$(pwd)
# Install packages globally and quietly
npm install $packages --g --quiet
if [[ ! -d "${HOME}/.nvm" ]]; then
e_header "Installing NVM..."
git clone https://github.com/creationix/nvm.git ~/.nvm
fi
[[ $? ]] && e_success "Done"
e_header "Updating NVM..."
cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`
cd "$old_pwd"
source ~/.nvm/nvm.sh
nvm install stable
nvm use stable
[[ $? ]] && e_success "Done"
}
# Install rvm and gems
@@ -226,6 +245,7 @@ function run_packages() {
init_brew
init_casks
init_nvm
init_npm
init_rvm
init_downloads

0 comments on commit 5cd72d0

Please sign in to comment.