Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 87 lines (71 sloc) 2.421 kb
9c18086 @ixti Improves make tasks and test runner
ixti authored
1 PATH := ./node_modules/.bin:${PATH}
a628390 @ixti Improved gh-pages task
ixti authored
2
9c18086 @ixti Improves make tasks and test runner
ixti authored
3 PROJECT := $(notdir ${PWD})
4 TMP_PATH := /tmp/${PROJECT}-$(shell date +%s)
23f8083 @ixti Added make task to build browserified version
ixti authored
5
a628390 @ixti Improved gh-pages task
ixti authored
6 REMOTE_NAME ?= origin
7 REMOTE_REPO ?= $(shell git config --get remote.${REMOTE_NAME}.url)
23f8083 @ixti Added make task to build browserified version
ixti authored
8
9c18086 @ixti Improves make tasks and test runner
ixti authored
9 CURR_HEAD := $(firstword $(shell git show-ref --hash HEAD | cut --bytes=-6) master)
10 GITHUB_NAME := nodeca/js-yaml
11 SRC_URL_FMT := https://github.com/${GITHUB_NAME}/blob/${CURR_HEAD}/{file}\#L{line}
12
13 lint:
14 @if test ! `which jslint` ; then \
15 echo "You need 'jslint' installed in order to generate docs." >&2 ; \
16 echo " $ make dev-deps" >&2 ; \
17 exit 128 ; \
18 fi
19 # (node) -> Node.JS compatibility mode
20 # (indent) -> indentation level (2 spaces)
21 # (nomen) -> tolerate underscores in identifiers (e.g. `var _val = 1`)
22 jslint --node --nomen --indent=2 ./lib/*.js ./lib/**/*.js
23f8083 @ixti Added make task to build browserified version
ixti authored
23
9c18086 @ixti Improves make tasks and test runner
ixti authored
24 test: lint test-issues test-functional
4e97245 @ixti Added make tasks to run tests
ixti authored
25
19f02b0 @ixti Improveed browserification
ixti authored
26 test-functional:
23f8083 @ixti Added make task to build browserified version
ixti authored
27 echo
19f02b0 @ixti Improveed browserification
ixti authored
28 echo "## FUNCTIONAL ##################################################################"
23f8083 @ixti Added make task to build browserified version
ixti authored
29 echo "################################################################################"
30 echo
19f02b0 @ixti Improveed browserification
ixti authored
31 node ./test/functional/run.js
23f8083 @ixti Added make task to build browserified version
ixti authored
32 echo
4e97245 @ixti Added make tasks to run tests
ixti authored
33
19f02b0 @ixti Improveed browserification
ixti authored
34 test-issues:
23f8083 @ixti Added make task to build browserified version
ixti authored
35 echo
19f02b0 @ixti Improveed browserification
ixti authored
36 echo "## ISSUES ######################################################################"
23f8083 @ixti Added make task to build browserified version
ixti authored
37 echo "################################################################################"
38 echo
19f02b0 @ixti Improveed browserification
ixti authored
39 node ./test/issues/run.js
23f8083 @ixti Added make task to build browserified version
ixti authored
40 echo
41
9c18086 @ixti Improves make tasks and test runner
ixti authored
42 dev-deps:
43 @if test ! `which npm` ; then \
44 echo "You need 'npm' installed." >&2 ; \
45 echo " See: http://npmjs.org/" >&2 ; \
46 exit 128 ; \
47 fi
48 npm install --dev
23f8083 @ixti Added make task to build browserified version
ixti authored
49
50 build: browserify uglify
51
52 browserify:
53 if test ! `which browserify` ; then npm install browserify ; fi
20a39ad @ixti Moved .browserify templtes under support
ixti authored
54 cp -r support/browserify/ ${TMP_DIR}
19f02b0 @ixti Improveed browserification
ixti authored
55 browserify index.js -o ${TMP_DIR}/50_js-yaml.js
56 cat ${TMP_DIR}/* > js-yaml.js
57 rm -rf ${TMP_DIR}
5e536be @ixti Improved ghpages geneation
ixti authored
58 cp js-yaml.js demo/js/
23f8083 @ixti Added make task to build browserified version
ixti authored
59
60 uglify:
61 if test ! `which uglifyjs` ; then npm install uglify-js ; fi
62 uglifyjs js-yaml.js > js-yaml.min.js
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
70 mkdir ${TMP_DIR}
5e536be @ixti Improved ghpages geneation
ixti authored
71 cp -r demo/* ${TMP_DIR}
a628390 @ixti Improved gh-pages task
ixti authored
72 touch ${TMP_DIR}/.nojekyll
73 cd ${TMP_DIR} && \
74 git init && \
75 git add . && \
76 git commit -q -m 'Recreated docs'
77 cd ${TMP_DIR} && \
78 git remote add remote ${REMOTE_REPO} && \
79 git push --force remote +master:gh-pages
80 rm -rf ${TMP_DIR}
9c18086 @ixti Improves make tasks and test runner
ixti authored
81
82 todo:
83 grep 'TODO' -n -r ./lib 2>/dev/null || test true
84
85 .PHONY: test lint dev-deps gh-pages todo
86 .SILENT: todo test test-functional test-issues
Something went wrong with that request. Please try again.