Name: js-handler/node_modules/restify/node_modules/bunyan/Makefile
| 1: | #---- Tools |
| 2: | |
| 3: | NODEUNIT := ./node_modules/.bin/nodeunit |
| 4: | SUDO := sudo |
| 5: | ifeq ($(shell uname -s),SunOS) |
| 6: | # On SunOS (e.g. SmartOS) we expect to run the test suite as the |
| 7: | # root user -- necessary to run dtrace. Therefore `pfexec` isn't |
| 8: | # necessary. |
| 9: | SUDO := |
| 10: | endif |
| 11: | DTRACE_UP_IN_HERE= |
| 12: | ifeq ($(shell uname -s),SunOS) |
| 13: | DTRACE_UP_IN_HERE=1 |
| 14: | endif |
| 15: | ifeq ($(shell uname -s),Darwin) |
| 16: | DTRACE_UP_IN_HERE=1 |
| 17: | endif |
| 18: | NODEOPT ?= $(HOME)/opt |
| 19: | |
| 20: | |
| 21: | |
| 22: | #---- Files |
| 23: | |
| 24: | JSSTYLE_FILES := $(shell find lib test tools examples -name "*.js") bin/bunyan |
| 25: | # All test files *except* dtrace.test.js. |
| 26: | NON_DTRACE_TEST_FILES := $(shell ls -1 test/*.test.js | grep -v dtrace | xargs) |
| 27: | |
| 28: | |
| 29: | |
| 30: | #---- Targets |
| 31: | |
| 32: | all: |
| 33: | npm install |
| 34: | |
| 35: | # Ensure all version-carrying files have the same version. |
| 36: | .PHONY: versioncheck |
| 37: | versioncheck: |
| 38: | [[ `cat package.json | json version` == `grep '^## ' CHANGES.md | head -1 | awk '{print $$3}'` ]] |
| 39: | [[ `cat package.json | json version` == `grep '^var VERSION' bin/bunyan | awk -F"'" '{print $$2}'` ]] |
| 40: | [[ `cat package.json | json version` == `grep '^var VERSION' lib/bunyan.js | awk -F"'" '{print $$2}'` ]] |
| 41: | @echo Version check ok. |
| 42: | |
| 43: | .PHONY: cutarelease |
| 44: | cutarelease: versioncheck |
| 45: | [[ `git status | tail -n1` == "nothing to commit (working directory clean)" ]] |
| 46: | ./tools/cutarelease.py -p bunyan -f package.json -f lib/bunyan.js -f bin/bunyan |
| 47: | |
| 48: | .PHONY: docs |
| 49: | docs: |
| 50: | @[[ `which ronn` ]] || (echo "No 'ronn' on your PATH. Install with 'gem install ronn'" && exit 2) |
| 51: | mkdir -p man/man1 |
| 52: | ronn --style=toc --manual="bunyan manual" --date=$(shell git log -1 --pretty=format:%cd --date=short) --roff --html docs/bunyan.1.ronn |
| 53: | python -c 'import sys; h = open("docs/bunyan.1.html").read(); h = h.replace(".mp dt.flush {float:left;width:8ex}", ""); open("docs/bunyan.1.html", "w").write(h)' |
| 54: | python -c 'import sys; h = open("docs/bunyan.1.html").read(); h = h.replace("</body>", """<a href="https://github.com/trentm/node-bunyan"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub"></a></body>"""); open("docs/bunyan.1.html", "w").write(h)' |
| 55: | @echo "# test with 'man ./docs/bunyan.1' and 'open ./docs/bunyan.1.html'" |
| 56: | |
| 57: | .PHONY: publish |
| 58: | publish: |
| 59: | mkdir -p tmp |
| 60: | [[ -d tmp/bunyan-gh-pages ]] || git clone [email protected]:trentm/node-bunyan.git tmp/bunyan-gh-pages |
| 61: | cd tmp/bunyan-gh-pages && git checkout gh-pages && git pull --rebase origin gh-pages |
| 62: | cp docs/index.html tmp/bunyan-gh-pages/index.html |
| 63: | cp docs/bunyan.1.html tmp/bunyan-gh-pages/bunyan.1.html |
| 64: | (cd tmp/bunyan-gh-pages \ |
| 65: | && git commit -a -m "publish latest docs" \ |
| 66: | && git push origin gh-pages || true) |
| 67: | |
| 68: | .PHONY: distclean |
| 69: | distclean: |
| 70: | rm -rf node_modules |
| 71: | |
| 72: | |
| 73: | #---- test |
| 74: | |
| 75: | .PHONY: test |
| 76: | test: $(NODEUNIT) |
| 77: | test -z "$(DTRACE_UP_IN_HERE)" || test -n "$(SKIP_DTRACE)" || \ |
| 78: | (node -e 'require("dtrace-provider").createDTraceProvider("isthisthingon")' && \ |
| 79: | $(SUDO) $(NODEUNIT) test/dtrace.test.js) |
| 80: | $(NODEUNIT) $(NON_DTRACE_TEST_FILES) |
| 81: | |
| 82: | # Test will all node supported versions (presumes install locations I use on |
| 83: | # my machine). |
| 84: | # Note: 'test08' is last so (if all is well) I end up with a binary |
| 85: | # dtrace-provider build for node 0.8 (my current version). |
| 86: | .PHONY: testall |
| 87: | testall: test06 test10 test08 |
| 88: | |
| 89: | .PHONY: test10 |
| 90: | test10: |
| 91: | @echo "# Test node 0.10.x (with node `$(NODEOPT)/node-0.10/bin/node --version`)" |
| 92: | @$(NODEOPT)/node-0.10/bin/node --version |
| 93: | PATH="$(NODEOPT)/node-0.10/bin:$(PATH)" make distclean all test |
| 94: | .PHONY: test08 |
| 95: | test08: |
| 96: | @echo "# Test node 0.8.x (with node `$(NODEOPT)/node-0.8/bin/node --version`)" |
| 97: | @$(NODEOPT)/node-0.8/bin/node --version |
| 98: | PATH="$(NODEOPT)/node-0.8/bin:$(PATH)" make distclean all test |
| 99: | .PHONY: test06 |
| 100: | test06: |
| 101: | @echo "# Test node 0.6.x (with node `$(NODEOPT)/node-0.6/bin/node --version`)" |
| 102: | @$(NODEOPT)/node-0.6/bin/node --version |
| 103: | PATH="$(NODEOPT)/node-0.6/bin:$(PATH)" make distclean all test |
| 104: | |
| 105: | |
| 106: | #---- check |
| 107: | |
| 108: | .PHONY: check-jsstyle |
| 109: | check-jsstyle: $(JSSTYLE_FILES) |
| 110: | ./tools/jsstyle -o indent=4,doxygen,unparenthesized-return=0,blank-after-start-comment=0,leading-right-paren-ok=1 $(JSSTYLE_FILES) |
| 111: | |
| 112: | .PHONY: check |
| 113: | check: check-jsstyle |
| 114: | @echo "Check ok." |
| 115: | |
| 116: | .PHONY: prepush |
| 117: | prepush: check testall |
| 118: | @echo "Okay to push." |
