Skip to content

Commit

Permalink
Update 'make doc' to only ronn build if necessary
Browse files Browse the repository at this point in the history
Also, updated to play nicely with 'make -j8 doc'
  • Loading branch information
isaacs committed Oct 4, 2011
1 parent bd0c73d commit b337ace
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
10 changes: 6 additions & 4 deletions Makefile
Expand Up @@ -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) \
Expand All @@ -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 $< $@
Expand All @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -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"
Expand Down
20 changes: 19 additions & 1 deletion scripts/doc-build.sh
Expand Up @@ -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
Expand Down

0 comments on commit b337ace

Please sign in to comment.