Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 114 lines (79 sloc) 2.788 kb
9241c85 @evdb Use a makefile
evdb authored
1
8a9c410 @evdb Use a reporter that exits with error if there was a test failure
evdb authored
2 # note - this needs to be default so that the nodeunit process will exit with
3 # error if tests fail. Otherwise make will not abort.
4 REPORTER = default
5
2e26eb4 @evdb Test the correct port based on the test mode. Start the test server from...
evdb authored
6 LINT = ./node_modules/.bin/jslint --indent 2 --white --nomen
7 FOREVER = ./node_modules/.bin/forever
df8cd5d @evdb Add jslint to the project and tests
evdb authored
8
72437b7 @evdb Make the start and stop test server commands reusable
evdb authored
9 WAIT_FOR_SERVER = sleep 5 # FIXME - use something more elegant
1eedef1 @evdb Make sure that the test server is not running
evdb authored
10 TEST_SERVER = tests/test-server.js
11 STOP_TEST_SERVER = $(FOREVER) stop $(TEST_SERVER)
12 START_TEST_SERVER = $(STOP_TEST_SERVER); NODE_ENV=testing $(FOREVER) start $(TEST_SERVER) && $(WAIT_FOR_SERVER)
df8cd5d @evdb Add jslint to the project and tests
evdb authored
13
9241c85 @evdb Use a makefile
evdb authored
14
1c621a0 @evdb rename makefile tasks for clarity
evdb authored
15 all: node-modules css
56e054e @evdb Generate css form scss from the makefile 'make scss'
evdb authored
16
9022bdf @evdb npm actions in makefile
evdb authored
17
1c621a0 @evdb rename makefile tasks for clarity
evdb authored
18 node-modules:
9022bdf @evdb npm actions in makefile
evdb authored
19 npm install
1c621a0 @evdb rename makefile tasks for clarity
evdb authored
20 npm prune
9022bdf @evdb npm actions in makefile
evdb authored
21
22 npm-update:
23 rm npm-shrinkwrap.json
1c621a0 @evdb rename makefile tasks for clarity
evdb authored
24 npm install
9022bdf @evdb npm actions in makefile
evdb authored
25 npm update
1c621a0 @evdb rename makefile tasks for clarity
evdb authored
26 npm prune
9022bdf @evdb npm actions in makefile
evdb authored
27 npm shrinkwrap
28
29
df8cd5d @evdb Add jslint to the project and tests
evdb authored
30 lint:
31 find lib -name '*.js' | xargs -n 1 $(LINT) --node --
32 find instance-app -name '*.js' | xargs -n 1 $(LINT) --node --
33 find hosting-app -name '*.js' | xargs -n 1 $(LINT) --node --
34 find public/js -name '*.js' | xargs -n 1 $(LINT) --browser --
35
36
1744492 @evdb rename scss step to css as that is what it produces
evdb authored
37 css:
56e054e @evdb Generate css form scss from the makefile 'make scss'
evdb authored
38 compass compile
39
778bd17 @evdb add jade-amd and compile templates to js
evdb authored
40
49cbcb9 @evdb add optipng step
evdb authored
41 optipng:
42 find public -name '*.png' | xargs optipng --clobber -o4
43
44
778bd17 @evdb add jade-amd and compile templates to js
evdb authored
45 js-templates:
46 jade-amd --runtime > public/js/jadeRuntime.js
47 rm -rf public/js/templates
33d81a5 @evdb use instance app for templates, not hosting app
evdb authored
48 jade-amd --pretty --from instance-app/views --to public/js/templates
778bd17 @evdb add jade-amd and compile templates to js
evdb authored
49
50
1c621a0 @evdb rename makefile tasks for clarity
evdb authored
51 public-production: css js-templates
52 rm -rf public-build public-production
4bf1132 @dracos Use local bin location of require r.js script.
dracos authored
53 node_modules/.bin/r.js -o public/js/app.build.js
1c621a0 @evdb rename makefile tasks for clarity
evdb authored
54 mkdir public-production
55
56 # copy all the static assets
57 mv public-build/css public-production/
58 mv public-build/favicon.ico public-production/
59 mv public-build/fonts public-production/
60 mv public-build/img public-production/
61
62 # copy across only the javascript that we need
63 mkdir -p public-production/js/libs
64 mv public-build/js/libs/require-* public-production/js/libs/
65 mv public-build/js/main-* public-production/js/
66
67 # clean up generated content that we don't need now
68 rm -r public-build
5c4824d @evdb Don't track jade templates converted to js
evdb authored
69 rm -r public/js/templates
f3ac0ff @evdb Minify assets
evdb authored
70
71
56e054e @evdb Generate css form scss from the makefile 'make scss'
evdb authored
72 tidy:
73 # this should tidy, but not implemented yet
74 # The output is not as nice as I'd like
75 # sass-convert --recursive --in-place --from scss --to scss public/sass/
76
77
1c621a0 @evdb rename makefile tasks for clarity
evdb authored
78 test: node-modules test-unit test-api test-browser
9241c85 @evdb Use a makefile
evdb authored
79
80 test-unit:
81 @NODE_ENV=testing ./node_modules/.bin/nodeunit \
82 --reporter $(REPORTER) \
83 tests/unit
84
1c621a0 @evdb rename makefile tasks for clarity
evdb authored
85 test-browser: css public-production
72437b7 @evdb Make the start and stop test server commands reusable
evdb authored
86 $(START_TEST_SERVER)
2e26eb4 @evdb Test the correct port based on the test mode. Start the test server from...
evdb authored
87 @NODE_ENV=testing ruby tests/browser_based/run_tests.rb
72437b7 @evdb Make the start and stop test server commands reusable
evdb authored
88 $(STOP_TEST_SERVER)
9241c85 @evdb Use a makefile
evdb authored
89
c60c058 @evdb Add API testing to makefile
evdb authored
90 test-api:
1eedef1 @evdb Make sure that the test server is not running
evdb authored
91 $(STOP_TEST_SERVER)
c60c058 @evdb Add API testing to makefile
evdb authored
92 @NODE_ENV=testing ./node_modules/.bin/nodeunit \
93 --reporter $(REPORTER) \
94 tests/api
95
c5e1cee @evdb Added production task
evdb authored
96
97 production:
98 git checkout production
99 git merge master
100 make optipng
101 make public-production
102 git st
103 echo "Ready to commit now"
104
56e054e @evdb Generate css form scss from the makefile 'make scss'
evdb authored
105 clean:
aaee0bb @evdb Don't track generated CSS
evdb authored
106 compass clean
1c621a0 @evdb rename makefile tasks for clarity
evdb authored
107 rm -rf public/js/templates
108 rm -rf public-build
0122914 @evdb rename public-minified to public-production to be clearer about its purp...
evdb authored
109 rm -rf public-production
56e054e @evdb Generate css form scss from the makefile 'make scss'
evdb authored
110
111
1c621a0 @evdb rename makefile tasks for clarity
evdb authored
112 .PHONY: test test-unit test-browser test-api css public-production clean tidy node-modules npm-update
9241c85 @evdb Use a makefile
evdb authored
113
Something went wrong with that request. Please try again.