Documentation and makefile

This commit is contained in:
Mark Cavage 2011-08-15 10:53:57 -07:00
parent e87550ff57
commit 17d2d4e5cb
4 changed files with 242 additions and 176 deletions

2
.gitignore vendored
View File

@ -1,3 +1,5 @@
node_modules node_modules
*.log *.log
*.ldif *.ldif
*.tar*
docs/pkg

65
Makefile Normal file
View File

@ -0,0 +1,65 @@
NAME=ldapjs
ifeq ($(VERSION), "")
@echo "Use gmake"
endif
SRC := $(shell pwd)
TAR = tar
UNAME := $(shell uname)
ifeq ($(UNAME), SunOS)
TAR = gtar
endif
HAVE_GJSLINT := $(shell which gjslint >/dev/null && echo yes || echo no)
NPM := npm_config_tar=$(TAR) npm
RESTDOWN = ./node_modules/.restdown/bin/restdown
RESTDOWN_VERSION=1.2.11
DOCPKGDIR = ./docs/pkg
.PHONY: dep lint test doc clean all
all:: test doc
node_modules/.ldapjs.npm.installed:
$(NPM) install --dev
if [[ ! -d node_modules/.restdown ]]; then \
git clone git://github.com/trentm/restdown.git node_modules/.restdown; \
else \
(cd node_modules/.restdown && git fetch origin); \
fi
@(cd ./node_modules/.restdown && git checkout $(RESTDOWN_VERSION))
@touch ./node_modules/.ldapjs.npm.installed
dep: ./node_modules/.ldapjs.npm.installed
gjslint:
gjslint --nojsdoc -r lib -r tst
ifeq ($(HAVE_GJSLINT), yes)
lint: gjslint
else
lint:
@echo "* * *"
@echo "* Warning: Cannot lint with gjslint. Install it from:"
@echo "* http://code.google.com/closure/utilities/docs/linter_howto.html"
@echo "* * *"
endif
doc: dep
@rm -rf ${DOCPKGDIR}
@mkdir -p ${DOCPKGDIR}
${RESTDOWN} -m ${DOCPKGDIR} -D mediaroot=media ./docs/guide.md
rm docs/*.json
mv docs/*.html ${DOCPKGDIR}
sed -i '' -e 's|docs/public/media|media|g' ${DOCPKGDIR}/*.html
(cd ${DOCPKGDIR} && $(TAR) -czf ${SRC}/${NAME}-docs-`git log -1 --pretty='format:%h'`.tar.gz *)
test: dep lint
$(NPM) test
clean:
@rm -fr ${DOCPKGDIR} node_modules *.log

View File

@ -22,7 +22,6 @@
"node-uuid": "~1.2.0" "node-uuid": "~1.2.0"
}, },
"scripts": { "scripts": {
"pretest": "which gjslint; if [[ \"$?\" = 0 ]] ; then gjslint --nojsdoc -r lib -r tst; else echo \"Missing gjslint. Skipping lint\"; fi",
"test": "./node_modules/.bin/tap ./tst" "test": "./node_modules/.bin/tap ./tst"
} }
} }