Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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