Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 137 lines (103 sloc) 3.133 kB
00690e7 @lancejpollard better test setup
lancejpollard authored
1 SRC = $(shell find test/cases -name client -prune -o -name '*Test.coffee' -print)
8896d38 @lancejpollard Makefile for running tests on a per-database level
lancejpollard authored
2 STORES = memory mongodb
b0e670b @lancejpollard set default store
lancejpollard authored
3 CMD = ./node_modules/mocha/bin/mocha
4d9bcdc @lancejpollard ROADMAP and some makefile ideas
lancejpollard authored
4 DIR = $(shell pwd)
b30a495 @lancejpollard client tests on travis
lancejpollard authored
5 GRUNT = grunt
6 FOREVER = forever
bbd5d2a @lancejpollard messing with the makefile
lancejpollard authored
7 PORT = 3210
8 TEST_URL = http://localhost:$(PORT)/?test=support,application,store,model
9 CLIENT_PID = null
10 TEST_SERVER_PATH = test/example/server
b30a495 @lancejpollard client tests on travis
lancejpollard authored
11
111afb1 @lancejpollard cleanup
lancejpollard authored
12 all: clean
13 $(GRUNT) --config ./grunt.coffee
14
b30a495 @lancejpollard client tests on travis
lancejpollard authored
15 check-grunt:
16 ifeq ($(shell which $(GRUNT)),)
7fad24c @lancejpollard absolute path to grunt in makefile
lancejpollard authored
17 $(eval GRUNT = $(shell pwd)/node_modules/grunt/bin/grunt)
b30a495 @lancejpollard client tests on travis
lancejpollard authored
18 ifeq ($(shell which ./node_modules/grunt/bin/grunt),)
19 npm install grunt
20 endif
21 endif
22
23 check-forever:
24 ifeq ($(shell which $(FOREVER)),)
7fad24c @lancejpollard absolute path to grunt in makefile
lancejpollard authored
25 $(eval FOREVER = $(shell pwd)/node_modules/forever/bin/forever)
b30a495 @lancejpollard client tests on travis
lancejpollard authored
26 ifeq ($(shell which ./node_modules/forever/bin/forever),)
27 npm install forever
28 endif
29 endif
30
31 # ps -ef | awk '/node server -p 3210/{print $2}' | wc -l | awk '{print $1}'
32 # check-server: check-forever
8896d38 @lancejpollard Makefile for running tests on a per-database level
lancejpollard authored
33
b30a495 @lancejpollard client tests on travis
lancejpollard authored
34 check-phantomjs:
4d9bcdc @lancejpollard ROADMAP and some makefile ideas
lancejpollard authored
35 ifeq ($(shell which phantomjs),) # if it's blank
36 $(error PhantomJS is not installed. Download from http://phantomjs.org or run `brew install phantomjs` if you have Homebrew)
37 endif
38
a114a9c @lancejpollard readme
lancejpollard authored
39 test: test-server test-client
40
41 test-server: test-memory test-mongodb
8896d38 @lancejpollard Makefile for running tests on a per-database level
lancejpollard authored
42
b0e670b @lancejpollard set default store
lancejpollard authored
43 test-memory:
44 $(CMD) $(SRC) --store memory
45
46 test-mongodb:
47 $(CMD) $(SRC) --store mongodb
48
53cb29e @lancejpollard primitive phantomjs integration
lancejpollard authored
49 test-client:
e0eca36 @lancejpollard test browsers, and close if successful
lancejpollard authored
50 phantomjs test/client.coffee $(TEST_URL)
4d9bcdc @lancejpollard ROADMAP and some makefile ideas
lancejpollard authored
51
b30a495 @lancejpollard client tests on travis
lancejpollard authored
52 setup-test-client: check-phantomjs check-grunt
ba11a85 @lancejpollard makefile
lancejpollard authored
53 # tmp way of downloading vendor files
54 rm -rf test/example/vendor
1fe9beb @lancejpollard ignore vendor files
lancejpollard authored
55 ./bin/tower new example
56 mv example/vendor test/example
57 rm -rf ./example
b30a495 @lancejpollard client tests on travis
lancejpollard authored
58 $(GRUNT) --config ./grunt.coffee
7bf9dd2 @lancejpollard test client app node_modules for travis
lancejpollard authored
59 cd test/example && pwd && npm install .
f52b90d @lancejpollard relative grunt
lancejpollard authored
60 $(GRUNT) --config ./test/example/grunt.coffee
b30a495 @lancejpollard client tests on travis
lancejpollard authored
61
62 start-test-client:
bbd5d2a @lancejpollard messing with the makefile
lancejpollard authored
63 node $(TEST_SERVER_PATH) -p $(PORT)
64
65 start-test-client-conditionally: test-client-pid
66 ifeq ($(CLIENT_PID),)
67 $(shell node $(TEST_SERVER_PATH) -p $(PORT) &)
68 else
69 @echo Server already running on port $(PORT)
70 endif
71
72 test-client-pid:
73 $(eval CLIENT_PID = $(call get-pids,node $(TEST_SERVER_PATH)))
74 @echo $(CLIENT_PID): node $(TEST_SERVER_PATH) -p $(PORT)
75
76 stop-test-client: test-client-pid
77
78 client: start-test-client test-client
b30a495 @lancejpollard client tests on travis
lancejpollard authored
79
e0eca36 @lancejpollard test browsers, and close if successful
lancejpollard authored
80 define open-browser
81 open -a "$(1)" $(TEST_URL)\&complete=close
82 endef
83
84 test-firefox:
85 $(call open-browser,Firefox)
86
87 test-safari:
88 $(call open-browser,Safari)
89
90 test-chrome:
91 $(call open-browser,"Google\ Chrome")
92
93 test-opera:
94 $(call open-browser,Opera)
95
b30a495 @lancejpollard client tests on travis
lancejpollard authored
96 test-all:
97 for i in $(STORES); do ./node_modules/mocha/bin/mocha $(SRC) --store $$i; done
98
0c9a855 @lancejpollard compiles to lib
lancejpollard authored
99 clean:
bbd5d2a @lancejpollard messing with the makefile
lancejpollard authored
100 rm -rf dist/*
0c9a855 @lancejpollard compiles to lib
lancejpollard authored
101 rm -rf lib/*
102
103 whitespace:
104 cake clean
105
106 install:
7a3b21e @lancejpollard fine-tuned installation
lancejpollard authored
107 npm install
108 npm install-dev
0c9a855 @lancejpollard compiles to lib
lancejpollard authored
109
bbd5d2a @lancejpollard messing with the makefile
lancejpollard authored
110 watch: clean
b30a495 @lancejpollard client tests on travis
lancejpollard authored
111 $(GRUNT) start --config ./grunt.coffee
0c9a855 @lancejpollard compiles to lib
lancejpollard authored
112
113 build:
b30a495 @lancejpollard client tests on travis
lancejpollard authored
114 $(GRUNT) build:client --config ./grunt.coffee
cc8f4cc @lancejpollard grunt task to publish client tower.js to github
lancejpollard authored
115
116 dist:
b30a495 @lancejpollard client tests on travis
lancejpollard authored
117 $(GRUNT) dist --config ./grunt.coffee
0c9a855 @lancejpollard compiles to lib
lancejpollard authored
118
119 publish:
120 npm publish
121
bbd5d2a @lancejpollard messing with the makefile
lancejpollard authored
122 define kill-processes
123 @echo 'killing processes...'
124 @echo $(call get-processes,$(1))
125 kill -9 $(call get-pids,$(1))
126 endef
127
128 define get-pids
129 $(shell ps -ef | grep -e '$(1)' | grep -v grep | awk '{print $$2}')
130 endef
131
132 define get-processes
133 $(shell ps -ef | grep -e '$(1)' | grep -v grep)
134 endef
135
111afb1 @lancejpollard cleanup
lancejpollard authored
136 .PHONY: all test-memory test-mongodb test test-all test-client build dist check-phantomjs check-grunt check-forever setup-test-client start-test-client
Something went wrong with that request. Please try again.