Skip to content

Instantly share code, notes, and snippets.

@mklabs
Created April 11, 2012 15:00
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mklabs/2359881 to your computer and use it in GitHub Desktop.
Save mklabs/2359881 to your computer and use it in GitHub Desktop.

One line installer for h5bp/node-build-script

Fancy one line install (Unix / Windows on Cygwin)

What it does

  1. Check that node exists and is in your $PATH

  2. Uninstall previously installed version (if any)

  3. Global Install the npm package from dev (to be changed, master) branch.

  4. Once installed, display the help output

  5. Followed by the init template, creating a brand new project with the correct grunt setup, based on the answers to a few question.

Gotchas

If you have problem with npm saying:

npm ERR! Move it away, and try again.

Try running npm cache clean and try again.

If you are some behind some kind of proxy and have the script pending following this:

Fetching https://github.com/h5bp/html5-boilerplate/tarball/master
This might take a few moment

Try setting up your $http_proxy environment variable to your proxyurl, and try again.

#!/bin/sh
#
# A word about this shell script:
#
# It must work only on systems with a /bin/bash.
#
# cat readme.md || exit 1
# to be changed, master
branch=dev
# make sure that node exists
node=`which node 2>&1`
if [ -x "$node" ]; then
(exit 0)
else
echo "The build script cannot be installed without nodejs." >&2
echo "Install node first, and then try again." >&2
echo "" >&2
echo "http://nodejs.org/#download" >&2
echo "" >&2
echo "Maybe node is installed, but not in the PATH?" >&2
echo ""
echo "PATH=$PATH" >&2
exit 1
fi
#
# 1. Install step
#
# uninstall previous package, if any
npm uninstall node-build-script -g || exit 1
# global install
npm install http://github.com/h5bp/node-build-script/tarball/$branch -g || exit 1
# 2. Should be ok now, print out the help
h5bp help || exit 1
# 3. trigger the init task, this creates a very custom h5Bp project
# with grunt configuration matching the answers to the few prompts
h5bp init || exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment