Browse files

Making sure gen_docs.sh looks for a globally installed copy of jasmin…

…e-node as well as local.
  • Loading branch information...
1 parent f7ac8ef commit b74639e14a45eb9dac07c2d7b8e64780a42a478d @jzacsh committed Aug 27, 2012
Showing with 18 additions and 3 deletions.
  1. +18 −3 gen_docs.sh
View
21 gen_docs.sh
@@ -1,4 +1,19 @@
-#!/bin/bash
-if [ ! -e gen_docs.disable ]; then
- ./node_modules/.bin/jasmine-node docs/spec --noColor && node docs/src/gen-docs.js
+#!/usr/bin/env bash
+
+JASMINE_NODE='jasmine-node'
+if ! type -p "$JASMINE_NODE" >/dev/null 2>&1;then
+ # Locally (npm)-installed jasmine-node
+ local_jasmine='./node_modules/.bin/jasmine-node'
+
+ if [[ -x "$local_jasmine" ]];then
+ JASMINE_NODE="$local_jasmine"
+ else
+ echo 'Could not find a locally or globally installed executable of' \
+ 'jasmine-node. Try: `npm install jasmine-node`.' >&2
+ exit 1
+ fi
+fi
+
+if [[ ! -e gen_docs.disable ]]; then
+ "$JASMINE_NODE" docs/spec --noColor && node docs/src/gen-docs.js
fi

0 comments on commit b74639e

Please sign in to comment.