Skip to content

Commit

Permalink
[lib] Install Node.js and npm via Homebrew on OS X
Browse files Browse the repository at this point in the history
Now that the `npm` related issue (see: Homebrew/legacy-homebrew#27479) has been
fixed (see: Homebrew/legacy-homebrew#28075), revert back to using `Homebrew` to
install `Node.js` and `npm` on OS X.
  • Loading branch information
alrra committed Jun 29, 2014
1 parent 20c3fc2 commit 6e05a6d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 31 deletions.
10 changes: 5 additions & 5 deletions lib/dotfiles
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ declare -a NEW_DIRECTORIES=(
"$HOME/server"
)

declare -a NODE_PACKAGES=(
declare -a NPM_PACKAGES=(
"jshint"
)

Expand Down Expand Up @@ -319,18 +319,18 @@ install_apps() {
install_applications

printf "\n"
install_node_packages
install_npm_packages

fi
}

install_node_packages() {
install_npm_packages() {

# Make sure the most recent version of npm is installed
sudo npm install -q -g npm &> /dev/null
npm install -q -g npm &> /dev/null
print_result $? "npm [update]"

for i in ${NODE_PACKAGES[@]}; do
for i in ${NPM_PACKAGES[@]}; do
execute "npm install -g $i" "$i"
done
}
Expand Down
27 changes: 1 addition & 26 deletions lib/osx/install_applications.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ declare -a HOMEBREW_FORMULAE=(
"git"
"imagemagick --with-webp"
"caskroom/cask/brew-cask"
"node"
"vim --override-system-vi"
"zopfli"
)
Expand Down Expand Up @@ -61,32 +62,6 @@ install_applications() {
print_success "XCode Command Line Tools"
printf "\n"

# Install Node.js (and npm)
if [ $(cmd_exists "node") -eq 1 ]; then

# Get the name of the `.pkg` file containing the latest Node.js version
tmp="$(curl -sSL http://nodejs.org/dist/latest | sed -n 's/.*href="\(.*pkg\)".*/\1/p')"

# Download `.pkg` file
$(curl -sSL "http://nodejs.org/dist/latest/$tmp" -o /tmp/$tmp)

if [ $? -eq 0 ]; then
print_success "Download '$tmp'"

# Open the `.pkg` file
open "/tmp/$tmp"

# Wait for Node.js to be installed
while [ $(cmd_exists "node") -eq 1 ]; do
sleep 5;
done

print_success "Node.js and npm"
else
print_error "Download '$tmp'"
fi
fi

# Homebrew
if [ $(cmd_exists "brew") -eq 1 ]; then
printf '\n' | ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
Expand Down

0 comments on commit 6e05a6d

Please sign in to comment.