Skip to content

Instantly share code, notes, and snippets.

@sheehan
Created March 2, 2014 16:46
Show Gist options
  • Save sheehan/9309382 to your computer and use it in GitHub Desktop.
Save sheehan/9309382 to your computer and use it in GitHub Desktop.
Install grunt on demand in a Jenkins build step. Adapted from https://repository-cloudbees.forge.cloudbees.com/distributions/ci-addons/node/use-node
node_version=0.10.26
node_name=node-v${node_version}-linux-x64
node_dir=~/jenkins/node
mkdir -p $node_dir
test -f ${node_dir}/${node_name}.tar.gz || wget -P $node_dir http://nodejs.org/dist/v${node_version}/${node_name}.tar.gz
test -f ${node_dir}/${node_name}/bin/node || tar -zxvf ${node_dir}/${node_name}.tar.gz -C $node_dir
export PATH=${node_dir}/${node_name}/bin:$PATH
npm install
npm install grunt
npm install grunt-cli
export PATH=$PATH:node_modules/grunt-cli/bin/
grunt test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment