Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 164 lines (125 sloc) 4.059 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
56f8688 @thehydroimpulse Makefile now supports windows
thehydroimpulse 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
56f8688 @thehydroimpulse Makefile now supports windows
thehydroimpulse authored
12 PATH_SEP = $(shell node -e "console.log(require('path').sep)")
13 # darwin (mac), linux, win32 (windows)
14 OS = $(shell node -e "console.log(require('os').platform())")
15 DEPENDENCIES = bin$(PATH_SEP)dependencies
16
17 ifeq (win32,$(OS))
18 # Windows:
19 RUN =
20 else
21 # Unix
22 RUN = ./
23 endif
24
25 install-dependencies:
26 $(shell $(DEPENDENCIES))
111afb1 @lancejpollard cleanup
lancejpollard authored
27
56f8688 @thehydroimpulse Makefile now supports windows
thehydroimpulse authored
28 all: clean
29 $(GRUNT) --config $(RUN)grunt.coffee
30
b30a495 @lancejpollard client tests on travis
lancejpollard authored
31 check-grunt:
32 ifeq ($(shell which $(GRUNT)),)
56f8688 @thehydroimpulse Makefile now supports windows
thehydroimpulse authored
33 $(eval GRUNT = $(shell pwd)$(PATH_SEP)node_modules$(PATH_SEP)grunt$(PATH_SEP)bin$(PATH_SEP)grunt)
34 ifeq ($(shell which $(RUN)node_modules$(PATH_SEP)grunt$(PATH_SEP)bin$(PATH_SEP)grunt),)
b30a495 @lancejpollard client tests on travis
lancejpollard authored
35 npm install grunt
36 endif
37 endif
38
39 check-forever:
40 ifeq ($(shell which $(FOREVER)),)
56f8688 @thehydroimpulse Makefile now supports windows
thehydroimpulse authored
41 $(eval FOREVER = $(shell pwd)$(PATH_SEP)node_modules$(PATH_SEP)forever/bin$(PATH_SEP)forever)
42 ifeq ($(shell which node_modules$(PATH_SEP)forever$(PATH_SEP)bin$(PATH_SEP)forever),)
b30a495 @lancejpollard client tests on travis
lancejpollard authored
43 npm install forever
44 endif
45 endif
46
47 # ps -ef | awk '/node server -p 3210/{print $2}' | wc -l | awk '{print $1}'
48 # check-server: check-forever
8896d38 @lancejpollard Makefile for running tests on a per-database level
lancejpollard authored
49
b30a495 @lancejpollard client tests on travis
lancejpollard authored
50 check-phantomjs:
4d9bcdc @lancejpollard ROADMAP and some makefile ideas
lancejpollard authored
51 ifeq ($(shell which phantomjs),) # if it's blank
52 $(error PhantomJS is not installed. Download from http://phantomjs.org or run `brew install phantomjs` if you have Homebrew)
53 endif
54
a114a9c @lancejpollard readme
lancejpollard authored
55 test: test-server test-client
56
57 test-server: test-memory test-mongodb
8896d38 @lancejpollard Makefile for running tests on a per-database level
lancejpollard authored
58
b0e670b @lancejpollard set default store
lancejpollard authored
59 test-memory:
60 $(CMD) $(SRC) --store memory
61
62 test-mongodb:
63 $(CMD) $(SRC) --store mongodb
64
53cb29e @lancejpollard primitive phantomjs integration
lancejpollard authored
65 test-client:
56f8688 @thehydroimpulse Makefile now supports windows
thehydroimpulse authored
66 phantomjs test$(PATH_SEP)client.coffee $(TEST_URL)
4d9bcdc @lancejpollard ROADMAP and some makefile ideas
lancejpollard authored
67
1d06935 @lancejpollard setup -> build
lancejpollard authored
68 build-test-client: check-phantomjs check-grunt
ba11a85 @lancejpollard makefile
lancejpollard authored
69 # tmp way of downloading vendor files
56f8688 @thehydroimpulse Makefile now supports windows
thehydroimpulse authored
70 rm -rf test$(PATH_SEP)example$(PATH_SEP)vendor
71 $(RUN)bin$(PATH_SEP)tower new example
72 mv example$(PATH_SEP)vendor test$(PATH_SEP)example
73 rm -rf $(RUN)example
74 $(GRUNT) --config $(RUN)grunt.coffee
75 cd test$(PATH_SEP)example && pwd && npm install .
76 $(GRUNT) --config $(RUN)test$(PATH_SEP)example$(PATH_SEP)grunt.coffee
b30a495 @lancejpollard client tests on travis
lancejpollard authored
77
78 start-test-client:
bbd5d2a @lancejpollard messing with the makefile
lancejpollard authored
79 node $(TEST_SERVER_PATH) -p $(PORT)
80
81 start-test-client-conditionally: test-client-pid
82 ifeq ($(CLIENT_PID),)
83 $(shell node $(TEST_SERVER_PATH) -p $(PORT) &)
84 else
85 @echo Server already running on port $(PORT)
86 endif
87
88 test-client-pid:
89 $(eval CLIENT_PID = $(call get-pids,node $(TEST_SERVER_PATH)))
90 @echo $(CLIENT_PID): node $(TEST_SERVER_PATH) -p $(PORT)
91
92 stop-test-client: test-client-pid
93
94 client: start-test-client test-client
b30a495 @lancejpollard client tests on travis
lancejpollard authored
95
e0eca36 @lancejpollard test browsers, and close if successful
lancejpollard authored
96 define open-browser
97 open -a "$(1)" $(TEST_URL)\&complete=close
98 endef
99
100 test-firefox:
101 $(call open-browser,Firefox)
102
103 test-safari:
104 $(call open-browser,Safari)
105
106 test-chrome:
107 $(call open-browser,"Google\ Chrome")
108
109 test-opera:
110 $(call open-browser,Opera)
111
b30a495 @lancejpollard client tests on travis
lancejpollard authored
112 test-all:
56f8688 @thehydroimpulse Makefile now supports windows
thehydroimpulse authored
113 for i in $(STORES); do $(RUN)node_modules$(PATH_SEP)mocha$(PATH_SEP)bin$(PATH_SEP)mocha $(SRC) --store $$i; done
b30a495 @lancejpollard client tests on travis
lancejpollard authored
114
4e0ba2a @lancejpollard travisci ECONNRESET test
lancejpollard authored
115 # make push message='Committing changes'
116 push:
117 cd wiki && git add . && git commit -a -m 'updates' && git push
118 git add .
119 git commit -a -m '$(message)'
120 git push origin master
121
0c9a855 @lancejpollard compiles to lib
lancejpollard authored
122 clean:
bbd5d2a @lancejpollard messing with the makefile
lancejpollard authored
123 rm -rf dist/*
0c9a855 @lancejpollard compiles to lib
lancejpollard authored
124 rm -rf lib/*
125
126 whitespace:
127 cake clean
128
129 install:
7a3b21e @lancejpollard fine-tuned installation
lancejpollard authored
130 npm install
131 npm install-dev
0c9a855 @lancejpollard compiles to lib
lancejpollard authored
132
bbd5d2a @lancejpollard messing with the makefile
lancejpollard authored
133 watch: clean
56f8688 @thehydroimpulse Makefile now supports windows
thehydroimpulse authored
134 $(GRUNT) start --config $(RUN)grunt.coffee
0c9a855 @lancejpollard compiles to lib
lancejpollard authored
135
136 build:
56f8688 @thehydroimpulse Makefile now supports windows
thehydroimpulse authored
137 $(GRUNT) build:client --config $(RUN)grunt.coffee
cc8f4cc @lancejpollard grunt task to publish client tower.js to github
lancejpollard authored
138
139 dist:
56f8688 @thehydroimpulse Makefile now supports windows
thehydroimpulse authored
140 $(GRUNT) dist --config $(RUN)grunt.coffee
0c9a855 @lancejpollard compiles to lib
lancejpollard authored
141
142 publish:
143 npm publish
144
586f673 @lancejpollard `make docs`
lancejpollard authored
145 docs:
146 rm -rf doc/*
147 codo $(shell find packages/* -name templates -prune -o -name '*.coffee' -print) --title 'Tower API Documentation'
148
bbd5d2a @lancejpollard messing with the makefile
lancejpollard authored
149 define kill-processes
150 @echo 'killing processes...'
151 @echo $(call get-processes,$(1))
152 kill -9 $(call get-pids,$(1))
153 endef
154
155 define get-pids
156 $(shell ps -ef | grep -e '$(1)' | grep -v grep | awk '{print $$2}')
157 endef
158
159 define get-processes
160 $(shell ps -ef | grep -e '$(1)' | grep -v grep)
161 endef
162
1d06935 @lancejpollard setup -> build
lancejpollard authored
163 .PHONY: all test-memory test-mongodb test test-all test-client build dist check-phantomjs check-grunt check-forever build-test-client start-test-client
Something went wrong with that request. Please try again.