From ddbba4913892d95c424e7b472c35aa9609c7a05e Mon Sep 17 00:00:00 2001 From: Anatoliy Chakkaev Date: Sat, 23 Mar 2013 22:50:01 +0400 Subject: [PATCH] Makefile with man/html docs generation --- Makefile | 33 +++++++++++++++++++++++++++++---- scripts/doc.sh | 28 ++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 4 deletions(-) create mode 100755 scripts/doc.sh diff --git a/Makefile b/Makefile index 7ad36363..d100b43e 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/scripts/doc.sh b/scripts/doc.sh new file mode 100755 index 00000000..505bc6ee --- /dev/null +++ b/scripts/doc.sh @@ -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