Permalink
Browse files

Update 'make doc' to only ronn build if necessary

Also, updated to play nicely with 'make -j8 doc'
  • Loading branch information...
1 parent bd0c73d commit b337aced94f3e7d8c0de148e3bbb77f73020c23d @isaacs isaacs committed Oct 4, 2011
Showing with 27 additions and 6 deletions.
  1. +6 −4 Makefile
  2. +2 −1 package.json
  3. +19 −1 scripts/doc-build.sh
View
10 Makefile
@@ -53,12 +53,14 @@ clean: doc-clean uninstall
uninstall: submodules
node cli.js rm npm -g -f
-doc: node_modules/ronn $(mandocs) $(htmldocs)
+doc: $(mandocs) $(htmldocs)
docclean: doc-clean
doc-clean:
rm -rf \
node_modules/ronn \
+ node_modules/.bin/ronn \
+ .building_ronn \
doc/cli/index.md \
doc/api/index.md \
$(api_mandocs) \
@@ -67,9 +69,6 @@ doc-clean:
$(cli_htmldocs) \
&>/dev/null || true
-node_modules/ronn:
- node cli.js install git+https://github.com/isaacs/ronnjs.git
-
# use `npm install ronn` for this to work.
man/man1/README.1: README.md scripts/doc-build.sh package.json
scripts/doc-build.sh $< $@
@@ -94,6 +93,9 @@ html/api/%.html: doc/api/%.md html/dochead.html html/docfoot.html scripts/doc-bu
doc/cli/index.md: $(markdowns) scripts/index-build.js scripts/doc-build.sh package.json
node scripts/index-build.js > $@
+node_modules/ronn:
+ node cli.js install https://github.com/isaacs/ronnjs/tarball/master
+
doc: man
man: $(cli_docs) $(api_docs)
View
3 package.json
@@ -49,7 +49,8 @@
, "request"
, "proto-list"
, "which" ]
-, "devDependencies" : { "ronn" : "" }
+, "devDependencies" :
+ { "ronn" : "https://github.com/isaacs/ronnjs/tarball/master" }
, "engines" : { "node" : "0.4 || 0.5", "npm" : "1" }
, "scripts" : { "test" : "./test/run"
, "prepublish" : "make doc"
View
20 scripts/doc-build.sh
@@ -6,7 +6,25 @@ fi
set -o errexit
set -o pipefail
-[ -x ./node_modules/.bin/ronn ] || node cli.js install ronn
+if ! [ -x node_modules/.bin/ronn ]; then
+ if [ -f .building_ronn ]; then
+ while [ -f .building_ronn ]; do
+ sleep 1
+ done
+ else
+ # a race to see which make process will be the one to install ronn
+ echo $$ > .building_ronn
+ sleep 1
+ if [ $(cat .building_ronn) == $$ ]; then
+ make node_modules/ronn
+ rm .building_ronn
+ else
+ while [ -f .building_ronn ]; do
+ sleep 1
+ done
+ fi
+ fi
+fi
src=$1
dest=$2

0 comments on commit b337ace

Please sign in to comment.