Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 89 lines (73 sloc) 2.547 kB
e7bcd7e @ixti Improves makefile
ixti authored
1 PATH := $(shell pwd)/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
e7bcd7e @ixti Improves makefile
ixti authored
13 JS_FILES := $(shell find ./lib -type f -name '*.js' -print)
14
9c18086 @ixti Improves make tasks and test runner
ixti authored
15 lint:
16 @if test ! `which jslint` ; then \
bb13c51 @ixti Fixes makefile
ixti authored
17 echo "You need 'jslint' installed in order to run lint." >&2 ; \
9c18086 @ixti Improves make tasks and test runner
ixti authored
18 echo " $ make dev-deps" >&2 ; \
19 exit 128 ; \
20 fi
21 # (node) -> Node.JS compatibility mode
22 # (indent) -> indentation level (2 spaces)
23 # (nomen) -> tolerate underscores in identifiers (e.g. `var _val = 1`)
9056477 @ixti Linted common.js
ixti authored
24 # (bitwise) -> tolerate bitwise operators (used in base64)
2e9c82c @ixti Linted all files
ixti authored
25 # (white) -> tolerate messy whitespace
26 jslint --node --nomen --bitwise --white --indent=2 ${JS_FILES}
23f8083 @ixti Added make task to build browserified version
ixti authored
27
bf30236 @ixti Refactored issue tests to use vows
ixti authored
28 test: lint test-functional
29 @if test ! `which vows` ; then \
30 echo "You need 'vows' installed in order to run tests." >&2 ; \
31 echo " $ make dev-deps" >&2 ; \
32 exit 128 ; \
33 fi
34 NODE_ENV=test vows --spec
4e97245 @ixti Added make tasks to run tests
ixti authored
35
19f02b0 @ixti Improveed browserification
ixti authored
36 test-functional:
23f8083 @ixti Added make task to build browserified version
ixti authored
37 echo
19f02b0 @ixti Improveed browserification
ixti authored
38 echo "## FUNCTIONAL ##################################################################"
23f8083 @ixti Added make task to build browserified version
ixti authored
39 echo "################################################################################"
40 echo
19f02b0 @ixti Improveed browserification
ixti authored
41 node ./test/functional/run.js
23f8083 @ixti Added make task to build browserified version
ixti authored
42 echo
4e97245 @ixti Added make tasks to run tests
ixti authored
43
9c18086 @ixti Improves make tasks and test runner
ixti authored
44 dev-deps:
45 @if test ! `which npm` ; then \
46 echo "You need 'npm' installed." >&2 ; \
47 echo " See: http://npmjs.org/" >&2 ; \
48 exit 128 ; \
49 fi
50 npm install --dev
23f8083 @ixti Added make task to build browserified version
ixti authored
51
52 build: browserify uglify
53
54 browserify:
55 if test ! `which browserify` ; then npm install browserify ; fi
97923ff @ixti Fixes Makefile
ixti authored
56 cp -r support/browserify/ ${TMP_PATH}
57 browserify index.js -o ${TMP_PATH}/50_js-yaml.js
58 cat ${TMP_PATH}/* > js-yaml.js
59 rm -rf ${TMP_PATH}
5e536be @ixti Improved ghpages geneation
ixti authored
60 cp js-yaml.js demo/js/
23f8083 @ixti Added make task to build browserified version
ixti authored
61
62 uglify:
63 if test ! `which uglifyjs` ; then npm install uglify-js ; fi
64 uglifyjs js-yaml.js > js-yaml.min.js
6cb8f91 @ixti Added update gh-pages task
ixti authored
65
a628390 @ixti Improved gh-pages task
ixti authored
66
67 gh-pages:
68 @if test -z ${REMOTE_REPO} ; then \
69 echo 'Remote repo URL not found' >&2 ; \
70 exit 128 ; \
71 fi
97923ff @ixti Fixes Makefile
ixti authored
72 mkdir ${TMP_PATH}
73 cp -r demo/* ${TMP_PATH}
74 touch ${TMP_PATH}/.nojekyll
75 cd ${TMP_PATH} && \
a628390 @ixti Improved gh-pages task
ixti authored
76 git init && \
77 git add . && \
58e01dc @ixti Fixes gh-pages task commit message
ixti authored
78 git commit -q -m 'Update browserified demo'
97923ff @ixti Fixes Makefile
ixti authored
79 cd ${TMP_PATH} && \
a628390 @ixti Improved gh-pages task
ixti authored
80 git remote add remote ${REMOTE_REPO} && \
81 git push --force remote +master:gh-pages
97923ff @ixti Fixes Makefile
ixti authored
82 rm -rf ${TMP_PATH}
9c18086 @ixti Improves make tasks and test runner
ixti authored
83
84 todo:
85 grep 'TODO' -n -r ./lib 2>/dev/null || test true
86
87 .PHONY: test lint dev-deps gh-pages todo
88 .SILENT: todo test test-functional test-issues
Something went wrong with that request. Please try again.