Skip to content

Commit

Permalink
Install node via nvm
Browse files Browse the repository at this point in the history
* Add nvm from homebrew
* Add an inst_nvm command which will call it

This version of nvm 0.3.11 doesn't support a --no-progress
option so it spews onto the screen. An update
[here] does.

[here]: nvm-sh/nvm#1079
  • Loading branch information
byrney committed Aug 22, 2018
1 parent 56bc04c commit 179c67c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
2 changes: 2 additions & 0 deletions dev.bash
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ inst_brew rake-completion
inst_brew git-sh
inst_brew node
inst_brew yarn
inst_brew nvm "mkdir -p $HOME/.nvm"
inst_nvm "9.11.1"
inst_brew reattach-to-user-namespace
inst_brew ssh-copy-id
inst_brew terminal-notifier
Expand Down
17 changes: 15 additions & 2 deletions mbpsetup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function status(){
local line='---------------------------------------------------'
local title="$1"
local stat="$2"
printf "%s %s [%s]\n" "$title" "${line:${#title}}" "$stat"
printf "%s %s [%s]\\n" "$title" "${line:${#title}}" "$stat"
}

# Perform an action once.
Expand All @@ -30,7 +30,7 @@ function once() {
status "$title" "NOP"
else
status "$title" "START"
$cmd
eval "$cmd"
if [[ -z "$post" ]] ; then
$post
fi
Expand Down Expand Up @@ -96,6 +96,19 @@ function inst_conda(){
once "$title" "$check" "$cmd"
}

# install a node version via nvm (which must already be installed)
#
# $1 - name of gem
function inst_nvm() {
local title="node $1"
local pkg="$1"
local nvmsh="/usr/local/opt/nvm/nvm.sh"
local setup="export NVM_DIR=\"$HOME/.nvm\" && source \"$nvmsh\""
local cmd="( $setup && nvm install $pkg )"
local check="( $setup && nvm list $pkg )"
once "$title" "$check" "$cmd"
}

# Install homebrew, homebrew cask
#
function bootstrap() {
Expand Down

0 comments on commit 179c67c

Please sign in to comment.