Skip to content

Instantly share code, notes, and snippets.

@teppeis
Created December 14, 2012 05:20
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save teppeis/4282862 to your computer and use it in GitHub Desktop.
Save teppeis/4282862 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Update latest stable version, use it and migrate npm packages.
PREV_VER=$(nodebrew ls|grep current:|cut -d ' ' -f 2)
echo "Current version: $PREV_VER"
echo ""
echo "nodebrew install-binary stable"
nodebrew install-binary stable
if [ $? -ne 0 ]; then
# Already installed
exit 1
fi
echo ""
echo "nodebrew use stable"
nodebrew use stable
echo ""
if [ "$PREV_VER" = "none" ]; then
echo '"nodebrew migrate-package" is skipped.'
exit 1
fi
echo "nodebrew migrate-package $PREV_VER"
nodebrew migrate-package $PREV_VER
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment