Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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