Makefile with man/html docs generation

This commit is contained in:
Anatoliy Chakkaev 2013-03-23 22:50:01 +04:00
parent e0b52c6b7e
commit ddbba49138
2 changed files with 57 additions and 4 deletions

View File

@ -1,8 +1,33 @@
doc:
makedoc lib/abstract-class.js lib/schema.js lib/validatable.js -t "JugglingDB API docs"
# doc:
# makedoc lib/abstract-class.js lib/schema.js lib/validatable.js -t "JugglingDB API docs"
test:
@./node_modules/.bin/mocha --require should test/*.test.js
.PHONY: test
.PHONY: doc
MAN_DOCS = $(shell find docs -name '*.md' \
|sed 's|.md|.3|g' \
|sed 's|docs/|docs/man/|g' )
HTML_DOCS = $(shell find docs -name '*.md' \
|sed 's|.md|.3.html|g' \
|sed 's|docs/|docs/html/|g' ) \
docs/html/index.html
docs/man/%.3: docs/%.md scripts/doc.sh
scripts/doc.sh $< $@
docs/html/%.3.html: docs/%.md scripts/doc.sh
scripts/doc.sh $< $@
docs/html/index.html: docs/jugglingdb.md scripts/doc.sh
scripts/doc.sh $< $@
man: $(MAN_DOCS)
html: $(HTML_DOCS)
release: man
web: html
rsync ./docs/html/* jugglingdb.co:/var/www/apps/jugglingdb.co/public
.PHONY: test docs

28
scripts/doc.sh Executable file
View File

@ -0,0 +1,28 @@
#!/bin/bash
src=$1
dest=$2
if ! [ `which ronn` ]; then
echo 'ronn rubygem is not installed, run "gem install ronn"'
exit 0
fi
mkdir -p $(dirname $dest)
# VERSION=$(grep version package.json | perl -pi -e 's/[^-\d\.]//g')
case $dest in
*.[13])
ronn --roff $1 --pipe --organization=1602\ Software --manual=JugglingDB > $2
exit $?
;;
*.html)
ronn -5 $1 --pipe\
--style=toc\
--organization=1602\ Software\
--manual=JugglingDB > $2
exit $?
;;
esac