Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 113 lines (88 sloc) 3.199 kB
13870f0 @ixti Replace jslint with jshint
ixti authored
1 PATH := ./node_modules/.bin:${PATH}
a628390 @ixti Improved gh-pages task
ixti authored
2
13870f0 @ixti Replace jslint with jshint
ixti authored
3 NPM_PACKAGE := $(shell node -e 'process.stdout.write(require("./package.json").name)')
4 NPM_VERSION := $(shell node -e 'process.stdout.write(require("./package.json").version)')
fb46574 @ixti Add make publish task
ixti authored
5
6 TMP_PATH := /tmp/${NPM_PACKAGE}-$(shell date +%s)
23f8083 @ixti Added make task to build browserified version
ixti authored
7
a628390 @ixti Improved gh-pages task
ixti authored
8 REMOTE_NAME ?= origin
9 REMOTE_REPO ?= $(shell git config --get remote.${REMOTE_NAME}.url)
23f8083 @ixti Added make task to build browserified version
ixti authored
10
fb46574 @ixti Add make publish task
ixti authored
11 CURR_HEAD := $(firstword $(shell git show-ref --hash HEAD | cut --bytes=-6) master)
12 GITHUB_PROJ := nodeca/${NPM_PACKAGE}
13 SRC_URL_FMT := https://github.com/${GITHUB_PROJ}/blob/${CURR_HEAD}/{file}\#L{line}
9c18086 @ixti Improves make tasks and test runner
ixti authored
14
13870f0 @ixti Replace jslint with jshint
ixti authored
15
16 help:
17 echo "make help - Print this help"
18 echo "make lint - Lint sources with JSHint"
19 echo "make test - Lint sources and run all tests"
20 echo "make doc - Build API docs"
21 echo "make dev-deps - Install developer dependencies"
22 echo "make gh-pages - Build and push API docs into gh-pages branch"
23 echo "make publish - Set new version tag and publish npm package"
24 echo "make todo - Find and list all TODOs"
25
e7bcd7e @ixti Improves makefile
ixti authored
26
9c18086 @ixti Improves make tasks and test runner
ixti authored
27 lint:
13870f0 @ixti Replace jslint with jshint
ixti authored
28 if test ! `which jshint` ; then \
29 echo "You need 'jshint' installed in order to run lint." >&2 ; \
9c18086 @ixti Improves make tasks and test runner
ixti authored
30 echo " $ make dev-deps" >&2 ; \
31 exit 128 ; \
32 fi
13870f0 @ixti Replace jslint with jshint
ixti authored
33 jshint . --show-non-errors
34
23f8083 @ixti Added make task to build browserified version
ixti authored
35
694aaa1 @ixti Rewrote functional tests to use vows as well
ixti authored
36 test: lint
bf30236 @ixti Refactored issue tests to use vows
ixti authored
37 @if test ! `which vows` ; then \
38 echo "You need 'vows' installed in order to run tests." >&2 ; \
39 echo " $ make dev-deps" >&2 ; \
40 exit 128 ; \
41 fi
42 NODE_ENV=test vows --spec
4e97245 @ixti Added make tasks to run tests
ixti authored
43
13870f0 @ixti Replace jslint with jshint
ixti authored
44
45 doc:
46 @if test ! `which ndoc` ; then \
47 echo "You need 'ndoc' installed in order to generate docs." >&2 ; \
48 echo " $ npm install ndoc" >&2 ; \
49 exit 128 ; \
50 fi
51 rm -rf ./doc
52 ndoc --output ./doc --link-format "${SRC_URL_FMT}" ./lib
53
54
9c18086 @ixti Improves make tasks and test runner
ixti authored
55 dev-deps:
56 @if test ! `which npm` ; then \
57 echo "You need 'npm' installed." >&2 ; \
58 echo " See: http://npmjs.org/" >&2 ; \
59 exit 128 ; \
60 fi
13870f0 @ixti Replace jslint with jshint
ixti authored
61 which jshint > /dev/null || npm install jshint
62 npm install
6cb8f91 @ixti Added update gh-pages task
ixti authored
63
a628390 @ixti Improved gh-pages task
ixti authored
64
65 gh-pages:
66 @if test -z ${REMOTE_REPO} ; then \
67 echo 'Remote repo URL not found' >&2 ; \
68 exit 128 ; \
69 fi
d9c8dbd @ixti Fix make gh-pages
ixti authored
70 mkdir ${TMP_PATH}
71 cp -r demo/* ${TMP_PATH}
72 touch ${TMP_PATH}/.nojekyll
97923ff @ixti Fixes Makefile
ixti authored
73 cd ${TMP_PATH} && \
a628390 @ixti Improved gh-pages task
ixti authored
74 git init && \
75 git add . && \
d9c8dbd @ixti Fix make gh-pages
ixti authored
76 git commit -q -m 'Updated browserified demo'
97923ff @ixti Fixes Makefile
ixti authored
77 cd ${TMP_PATH} && \
a628390 @ixti Improved gh-pages task
ixti authored
78 git remote add remote ${REMOTE_REPO} && \
79 git push --force remote +master:gh-pages
97923ff @ixti Fixes Makefile
ixti authored
80 rm -rf ${TMP_PATH}
9c18086 @ixti Improves make tasks and test runner
ixti authored
81
13870f0 @ixti Replace jslint with jshint
ixti authored
82
fb46574 @ixti Add make publish task
ixti authored
83 publish:
84 @if test 0 -ne `git status --porcelain | wc -l` ; then \
85 echo "Unclean working tree. Commit or stash changes first." >&2 ; \
86 exit 128 ; \
87 fi
88 @if test 0 -ne `git tag -l ${NPM_VERSION} | wc -l` ; then \
89 echo "Tag ${NPM_VERSION} exists. Update package.json" >&2 ; \
90 exit 128 ; \
91 fi
92 git tag ${NPM_VERSION} && git push origin ${NPM_VERSION}
93 npm publish https://github.com/${GITHUB_PROJ}/tarball/${NPM_VERSION}
94
13870f0 @ixti Replace jslint with jshint
ixti authored
95
96 browserify:
97 if test ! `which browserify` ; then npm install browserify ; fi
98 if test ! `which uglifyjs` ; then npm install uglify-js ; fi
99 cp -r support/browserify/ ${TMP_PATH}
2b7b88a @ixti Improve browserification
ixti authored
100 browserify -r ./index -o ${TMP_PATH}/50_js-yaml.js
13870f0 @ixti Replace jslint with jshint
ixti authored
101 cat ${TMP_PATH}/* > js-yaml.js
102 rm -rf ${TMP_PATH}
103 cp js-yaml.js demo/js/
104 uglifyjs js-yaml.js > js-yaml.min.js
105
106
9c18086 @ixti Improves make tasks and test runner
ixti authored
107 todo:
108 grep 'TODO' -n -r ./lib 2>/dev/null || test true
109
13870f0 @ixti Replace jslint with jshint
ixti authored
110
111 .PHONY: publish lint test doc dev-deps gh-pages todo
112 .SILENT: help lint test doc todo
Something went wrong with that request. Please try again.