From 9db221c84f19ba016c91c36aa8d1ffcd16c2a6b7 Mon Sep 17 00:00:00 2001 From: Michael Krotscheck Date: Thu, 10 Jul 2014 15:43:06 -0700 Subject: [PATCH] Removed nodeenv dependency Once #106152 lands, nodejs will be available on our trusty build nodes, so nodeenv is no longer strictly required. However, not everyone wants to install nodejs on their system, so we now wrap the nodeenv invocation into a script to test whether a local node exists. Since we can no longer assume the existence of a clean virtual environment, we also no longer install a global version of bower and grunt, and instead use the versions bundled with the codebase's package.json. Change-Id: I42f4b61037b8e988708b39e951dd2cddd99313b0 --- bin/nodeenv.sh | 22 ++++++++++++++++++++++ package.json | 2 +- tox.ini | 39 +++++++++++++++------------------------ 3 files changed, 38 insertions(+), 25 deletions(-) create mode 100644 bin/nodeenv.sh diff --git a/bin/nodeenv.sh b/bin/nodeenv.sh new file mode 100644 index 00000000..5829d3f3 --- /dev/null +++ b/bin/nodeenv.sh @@ -0,0 +1,22 @@ +#!/bin/bash +set -e + +# This script checks if node is installed in the current path, +# and if not, will install the version specified. using nodeenv -p +# +#command -v node && echo "ok" + +ENVDIR="$1" +VERSION="$2" + +if [[ $(command -v node) ]] +then + exit +fi + +if [[ -n "$VERSION" ]] +then + nodeenv -p "$ENVDIR" --node="$VERSION" +else + nodeenv -p "$ENVDIR" +fi \ No newline at end of file diff --git a/package.json b/package.json index 083ad292..c44a0b11 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "grunt-contrib-uglify": "0.2.7", "grunt-contrib-imagemin": "0.4.0", "grunt": "0.4.2", - "grunt-cli": "0.1.11", + "grunt-cli": "0.1.13", "matchdep": "0.1.2", "karma-script-launcher": "0.1.0", "karma-chrome-launcher": "0.1.1", diff --git a/tox.ini b/tox.ini index 4e325973..7c805978 100644 --- a/tox.ini +++ b/tox.ini @@ -3,47 +3,38 @@ minversion = 1.6 skipsdist = True [testenv] -whitelist_externals = /bin/bash +whitelist_externals = bash + npm + node + nodejs + bower + grunt install_command = pip install -U {opts} {packages} setenv = VIRTUAL_ENV={envdir} deps = nodeenv + MySQL-python http://tarballs.openstack.org/storyboard/storyboard-master.tar.gz [testenv:venv] commands = - nodeenv -p {envdir} --node=0.10.26 || true - npm config set ca "" - npm install npm -g - npm config delete ca - pip install MySQL-python - npm install -g bower@1.3.8 grunt@0.4.2 grunt-cli@0.1.11 + bash ./bin/nodeenv.sh {envdir} 0.10.29 npm install - bower install + {toxinidir}/node_modules/.bin/bower install --config.interactive=false [testenv:grunt] commands = - nodeenv -p {envdir} --node=0.10.26 || true - npm config set ca "" - npm install npm -g - npm config delete ca - pip install MySQL-python - npm install -g bower@1.3.8 grunt@0.4.2 grunt-cli@0.1.11 + bash ./bin/nodeenv.sh {envdir} 0.10.29 npm install - bower install + {toxinidir}/node_modules/.bin/bower install --config.interactive=false bash ./bin/api.sh create-db bash ./bin/api.sh start - grunt {posargs} + {toxinidir}/node_modules/.bin/grunt {posargs} bash ./bin/api.sh stop [testenv:grunt_no_api] deps = nodeenv commands = - nodeenv -p {envdir} --node=0.10.26 || true - npm config set ca - npm install npm -g - npm config delete ca - pip install MySQL-python - npm install -g bower@1.3.8 grunt@0.4.2 grunt-cli@0.1.11 + bash ./bin/nodeenv.sh {envdir} 0.10.29 npm install - bower install - grunt {posargs} + {toxinidir}/node_modules/.bin/bower install --config.interactive=false + {toxinidir}/node_modules/.bin/grunt {posargs}