Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 193 lines (159 sloc) 4.662 kb
bf29b7c @paularmstrong add get-swig task
authored
1 SHA := $(shell git rev-parse HEAD)
2 THIS_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
1a9bdc0 @paularmstrong add swig.version and -v to cli
authored
3 VERSION_REGEX = [0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*[^\" ]*
15c72c5 @paularmstrong add version number getting/building to comments/docs
authored
4 VERSION := $(shell npm ls | grep "swig@" | grep -Eo "${VERSION_REGEX}" -m 1)
bf29b7c @paularmstrong add get-swig task
authored
5
c951326 @paularmstrong use tmp instead of tmp_build for gh-pages
authored
6 TMP = 'tmp'
5c55f11 @paularmstrong Merge branch 'site-templates'
authored
7 REMOTE = origin
8 BRANCH = gh-pages
c9a0c2d @paularmstrong use blanket for coverage reporting
authored
9 BIN = node_modules/.bin
57ab5e3 @paularmstrong copy coverage html to docs directory on build
authored
10 PWD = $(shell pwd | sed -e 's/[\/&]/\\&/g')
5c55f11 @paularmstrong Merge branch 'site-templates'
authored
11
5c9f1de @paularmstrong fix order of make tasks
authored
12 all:
463bebd @paularmstrong Fix some npm install ugliness
authored
13 @echo "Installing packages"
14 @npm install --depth=100 --loglevel=error
15 @npm link &>/dev/null
5c9f1de @paularmstrong fix order of make tasks
authored
16 @cp scripts/githooks/* .git/hooks/
17 @chmod -R +x .git/hooks/
18
1a9bdc0 @paularmstrong add swig.version and -v to cli
authored
19 .INTERMEDIATE version: \
20 browser/comments.js \
21 docs/index.json
22
23 version:
24 @sed -i.bak 's/${VERSION_REGEX}/${VERSION}/' lib/swig.js
25 @rm lib/swig.js.bak
26
15c72c5 @paularmstrong add version number getting/building to comments/docs
authored
27 browser/comments.js: FORCE
28 @sed -i.bak 's/v${VERSION_REGEX}/v${VERSION}/' $@
29 @rm $@.bak
30
0ee16c6 @paularmstrong build minified version for browser as well
authored
31 .SECONDARY dist/swig.js: \
441f58d @paularmstrong ensure copyright/license added to dist
authored
32 browser/comments.js
33
0ee16c6 @paularmstrong build minified version for browser as well
authored
34 .SECONDARY dist/swig.min.js: \
35 dist/swig.js
3152824 @paularmstrong use browserify to build for browser
authored
36
c2225ed @paularmstrong make test-browser work
authored
37 .INTERMEDIATE browser/test/tests.js: \
38 tests/comments.test.js \
39 tests/filters.test.js \
40 tests/tags.test.js \
41 tests/variables.test.js \
42 tests/tags/autoescape.test.js \
43 tests/tags/else.test.js \
44 tests/tags/filter.test.js \
45 tests/tags/for.test.js \
46 tests/tags/if.test.js \
47 tests/tags/macro.test.js \
48 tests/tags/raw.test.js \
49 tests/tags/set.test.js \
50 tests/tags/spaceless.test.js \
51 tests/basic.test.js
15c72c5 @paularmstrong add version number getting/building to comments/docs
authored
52
53 clean: FORCE
0ee16c6 @paularmstrong build minified version for browser as well
authored
54 @rm -rf dist
55 @rm -rf ${TMP}
56
57 build: clean dist dist/swig.min.js
58 @echo "Built to ./dist/"
59
60 dist:
61 @mkdir -p $@
62
63 dist/swig.js:
15c72c5 @paularmstrong add version number getting/building to comments/docs
authored
64 @echo "Building $@..."
0ee16c6 @paularmstrong build minified version for browser as well
authored
65 @cat $^ > $@
66 @${BIN}/browserify browser/index.js >> $@
67
68 dist/swig.min.js:
15c72c5 @paularmstrong add version number getting/building to comments/docs
authored
69 @echo "Building $@..."
a634147 @paularmstrong hide minifier warnings, build source-map
authored
70 @${BIN}/uglifyjs $^ --comments -c warnings=false -m --source-map dist/swig.js.map > $@
0ee16c6 @paularmstrong build minified version for browser as well
authored
71
c2225ed @paularmstrong make test-browser work
authored
72 browser/test/tests.js:
15c72c5 @paularmstrong add version number getting/building to comments/docs
authored
73 @echo "Building $@..."
c2225ed @paularmstrong make test-browser work
authored
74 @cat $^ > tests/browser.js
75 @perl -pi -e 's/\.\.\/\.\.\/lib/\.\.\/lib/g' tests/browser.js
76 @${BIN}/browserify tests/browser.js > $@
77 @rm tests/browser.js
78
265da4b @paularmstrong move tests, start new test suite
authored
79 tests := $(shell find ./tests -name '*.test.js' ! -path "*node_modules/*")
8d95898 @paularmstrong convert filters and helpers
authored
80 reporter = dot
81 opts =
f0bbc1a @paularmstrong adding test to task to make
authored
82 test:
74d2f81 @paularmstrong Ensure compilation does not leak global variables. Fixes gh-496
authored
83 @${BIN}/mocha --check-leaks --reporter ${reporter} ${opts} ${tests}
0241937 @paularmstrong easily run a single test file
authored
84
15c72c5 @paularmstrong add version number getting/building to comments/docs
authored
85 test-browser: FORCE clean browser/test/tests.js
c2225ed @paularmstrong make test-browser work
authored
86 @${BIN}/mocha-phantomjs browser/test/index.html --reporter ${reporter}
28933cd @paularmstrong add mocha-phantomjs for testing browser, update travis
authored
87
0e7f650 @paularmstrong ignore tmp/ directory for lint
authored
88 files := $(shell find . -name '*.js' ! -path "./node_modules/*" ! -path "./dist/*" ! -path "./browser*" ! -path "./docs*" ! -path "./tmp*")
aa848fa @paularmstrong Adding JSLint make task (nodelint as devDependencies)
authored
89 lint:
c9a0c2d @paularmstrong use blanket for coverage reporting
authored
90 @${BIN}/nodelint ${files} --config=scripts/config-lint.js
c526245 @paularmstrong remove need for runlint/runtest scripts
authored
91
64cb3a0 @paularmstrong add test coverage report
authored
92 out = tests/coverage.html
c9a0c2d @paularmstrong use blanket for coverage reporting
authored
93 cov-reporter = html-cov
64cb3a0 @paularmstrong add test coverage report
authored
94 coverage:
c9a0c2d @paularmstrong use blanket for coverage reporting
authored
95 ifeq (${cov-reporter}, travis-cov)
9b418c9 @paularmstrong remove --globals from tests
authored
96 @${BIN}/mocha ${opts} ${tests} --require blanket -R ${cov-reporter}
c9a0c2d @paularmstrong use blanket for coverage reporting
authored
97 else
9b418c9 @paularmstrong remove --globals from tests
authored
98 @${BIN}/mocha ${opts} ${tests} --require blanket -R ${cov-reporter} > ${out}
57ab5e3 @paularmstrong copy coverage html to docs directory on build
authored
99 @sed -i .bak -e "s/${PWD}//g" ${out}
100 @rm ${out}.bak
64cb3a0 @paularmstrong add test coverage report
authored
101 @echo
102 @echo "Built Report to ${out}"
103 @echo
c9a0c2d @paularmstrong use blanket for coverage reporting
authored
104 endif
64cb3a0 @paularmstrong add test coverage report
authored
105
15c72c5 @paularmstrong add version number getting/building to comments/docs
authored
106 docs/index.json: FORCE
107 @echo "Building $@..."
108 @sed -i.bak 's/v${VERSION_REGEX}/v${VERSION}/' $@
109 @rm $@.bak
110
184bce4 @paularmstrong docs: filters.json uses -X from jsdoc
authored
111 docs/docs.json: FORCE
112 @echo "Building $@..."
113 @sed -i.bak 's/v${VERSION_REGEX}/v${VERSION}/' $@
114 @rm $@.bak
115
15c72c5 @paularmstrong add version number getting/building to comments/docs
authored
116 docs/coverage.html: FORCE
117 @echo "Building $@..."
118 @make coverage out=$@
119
120 docs/docs/api.json: FORCE
121 @echo "Building $@..."
3c57987 @paularmstrong docs api.json uses -X from jsdoc
authored
122 @echo '{ "api": ' > $@
123 @${BIN}/jsdoc lib/swig.js -X >> $@
124 @echo '}' >> $@
15c72c5 @paularmstrong add version number getting/building to comments/docs
authored
125
126 docs/docs/filters.json: FORCE
127 @echo "Building $@..."
184bce4 @paularmstrong docs: filters.json uses -X from jsdoc
authored
128 @echo '{ "filters": ' > $@
129 @${BIN}/jsdoc lib/filters.js -X >> $@
130 @echo '}' >> $@
15c72c5 @paularmstrong add version number getting/building to comments/docs
authored
131
132 docs/docs/tags.json: FORCE
133 @echo "Building $@..."
733421f @paularmstrong docs: tags.json uses -X from jsdoc
authored
134 @echo '{ "tags": ' > $@
135 @${BIN}/jsdoc lib/tags/ -X >> $@
136 @echo '}' >> $@
15c72c5 @paularmstrong add version number getting/building to comments/docs
authored
137
cee4e3f @paularmstrong Add page for template loader docs, fix typo
authored
138 docs/docs/loaders.json: FORCE
139 @echo "Building $@..."
140 @echo '{ "loaders": ' > $@
141 @${BIN}/jsdoc lib/loaders/ -X >> $@
142 @echo '}' >> $@
143
1bbb8df @paularmstrong move custom tags docs to new extending page
authored
144 docs/docs/extending.json: FORCE
145 @echo "Building $@..."
7da5fe6 @paularmstrong docs: extending.json uses -X from jsdoc
authored
146 @echo '{ "ext": ' > $@
147 @${BIN}/jsdoc lib/parser.js lib/lexer.js -X >> $@
148 @echo '}' >> $@
1bbb8df @paularmstrong move custom tags docs to new extending page
authored
149
15c72c5 @paularmstrong add version number getting/building to comments/docs
authored
150 .SECONDARY build-docs: \
184bce4 @paularmstrong docs: filters.json uses -X from jsdoc
authored
151 docs/index.json \
152 docs/docs.json
15c72c5 @paularmstrong add version number getting/building to comments/docs
authored
153
154 .INTERMDIATE build-docs: \
155 docs/docs/api.json \
156 docs/docs/filters.json \
1bbb8df @paularmstrong move custom tags docs to new extending page
authored
157 docs/docs/tags.json \
f004dd9 @paularmstrong ensure loaders docs are built properly
authored
158 docs/docs/extending.json \
159 docs/docs/loaders.json
15c72c5 @paularmstrong add version number getting/building to comments/docs
authored
160
161 build-docs: FORCE
162 @echo "Documentation built."
46cc938 @paularmstrong first pass at outputting dox generated json to html
authored
163
8af21f8 @paularmstrong rename docs task to gh-pages, test-docs to docs
authored
164 gh-pages: clean build build-docs
46cc938 @paularmstrong first pass at outputting dox generated json to html
authored
165 @mkdir -p ${TMP}/js
5c55f11 @paularmstrong Merge branch 'site-templates'
authored
166 @mkdir -p docs/css
319bf3d @paularmstrong Build docs with swig@~1 for proof that it works!
authored
167 @rm -f docs/coverage.html
c9a0c2d @paularmstrong use blanket for coverage reporting
authored
168 @${BIN}/lessc --yui-compress --include-path=docs/less docs/less/swig.less docs/css/swig.css
319bf3d @paularmstrong Build docs with swig@~1 for proof that it works!
authored
169 @${BIN}/still docs -o ${TMP} -i "layout" -i "json" -i "less" -v
170 @make coverage out=${TMP}/coverage.html
5c55f11 @paularmstrong Merge branch 'site-templates'
authored
171 @cp dist/swig.* ${TMP}/js/
172 @git checkout ${BRANCH}
173 @cp -r ${TMP}/* ./
174 @rm -rf ${TMP}
0e7f650 @paularmstrong ignore tmp/ directory for lint
authored
175 ifeq (${THIS_BRANCH}, master)
51c11bb @paularmstrong fix build command
authored
176 @git add .
fb3aa7c @paularmstrong starting some templates
authored
177 @git commit -n -am "Automated build from ${SHA}"
5c55f11 @paularmstrong Merge branch 'site-templates'
authored
178 @git push ${REMOTE} ${BRANCH}
fb3aa7c @paularmstrong starting some templates
authored
179 @git checkout ${THIS_BRANCH}
79e8423 @paularmstrong clean docs folder after build process
authored
180 @git clean -f -d docs/
57ab5e3 @paularmstrong copy coverage html to docs directory on build
authored
181 endif
1d571ec @paularmstrong build commands
authored
182
183 port = 3000
8af21f8 @paularmstrong rename docs task to gh-pages, test-docs to docs
authored
184 docs: build build-docs
c9a0c2d @paularmstrong use blanket for coverage reporting
authored
185 @${BIN}/still-server docs/ -p ${port} -o
1d571ec @paularmstrong build commands
authored
186
15c72c5 @paularmstrong add version number getting/building to comments/docs
authored
187 FORCE:
188
1a9bdc0 @paularmstrong add swig.version and -v to cli
authored
189 .PHONY: all version \
15c72c5 @paularmstrong add version number getting/building to comments/docs
authored
190 build build-docs \
191 test test-browser lint coverage \
184bce4 @paularmstrong docs: filters.json uses -X from jsdoc
authored
192 docs gh-pages
Something went wrong with that request. Please try again.