From 3f7c13571b5b2bb79fd4d043b240f8c49e497076 Mon Sep 17 00:00:00 2001 From: Aiko Mastboom Date: Sun, 12 May 2013 12:36:21 +0200 Subject: [PATCH] added groc and coverage --- coverit | 22 ++++++++++++++++++++++ deployit | 4 ++++ docit | 18 ++++++++++++++++++ installit | 4 +++- package.json | 9 ++++++--- test/test.helpers.js | 4 +++- 6 files changed, 56 insertions(+), 5 deletions(-) create mode 100755 coverit create mode 100755 docit diff --git a/coverit b/coverit new file mode 100755 index 0000000..62749ea --- /dev/null +++ b/coverit @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +current_dir=$(cd $(dirname $0) && pwd) +base_dir=${current_dir} +cd ${base_dir} + +if [ ! -x ./opt/node-jscoverage/jscoverage ]; then + mkdir -p ./opt + cd ./opt + git clone git://github.com/visionmedia/node-jscoverage.git + cd node-jscoverage/ + ./configure && make + cd ${base_dir} +fi + +if [ ! -x ./node_modules/.bin/mocha ]; then + npm install mocha +fi + +./opt/node-jscoverage/jscoverage lib lib-cov +PROTOTYPER_COV=1 ./node_modules/.bin/mocha -R html-cov > public/coverage.html +rm -rf lib-cov diff --git a/deployit b/deployit index 2be082b..f4b94e0 100755 --- a/deployit +++ b/deployit @@ -1,5 +1,9 @@ #!/usr/bin/env bash +current_dir=$(cd $(dirname $0) && pwd) +base_dir=${current_dir} +cd ${base_dir} + command -v fleet fleet_installed=$? if [ ${fleet_installed} == 1 ]; then diff --git a/docit b/docit new file mode 100755 index 0000000..fee19c5 --- /dev/null +++ b/docit @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +current_dir=$(cd $(dirname $0) && pwd) +base_dir=${current_dir} +cd ${base_dir} + + +command -v pygmentize +pygments_installed=$? +if [ ${pygments_installed} == 1 ]; then + easy_install pygments +fi + +if [ ! -x ./node_modules/.bin/groc ]; then + npm install groc +fi + +./node_modules/.bin/groc lib/*.js diff --git a/installit b/installit index be9e6a2..f9fac8b 100755 --- a/installit +++ b/installit @@ -5,7 +5,9 @@ set -e current_dir=$(cd $(dirname $0) && pwd) -cd ${current_dir} +base_dir=${current_dir} +cd ${base_dir} + unameStr=`uname` if [[ "${unameStr}" == 'Linux' ]]; then diff --git a/package.json b/package.json index 0f86801..454e6d6 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,8 @@ "sockjs": "~0.3.7", "chai": "*", "mocha": "*", - "sinon": "*" + "sinon": "*", + "groc": "*" }, "repository": "git://github.com/aikomastboom/Prototyper.git", "author": "Aiko Mastboom", @@ -36,8 +37,10 @@ }, "description": "README.md", "scripts": { - "test": "mocha", + "test": "./node_modules/.bin/mocha", "install": "./installit", - "deploy": "./deployit" + "deploy": "./deployit", + "doc":"./docit", + "cov": "./coverit" } } diff --git a/test/test.helpers.js b/test/test.helpers.js index 4e704ec..ec17c31 100644 --- a/test/test.helpers.js +++ b/test/test.helpers.js @@ -1,4 +1,6 @@ -var helpers = require('../lib/helpers.js'); +var libpath = process.env['PROTOTYPER_COV'] ? '../lib-cov' : '../lib'; + +var helpers = require(libpath + '/helpers.js'); var expect = require('chai').expect; var when = require('when');