|
1 | 1 | SHELL := /bin/bash |
2 | 2 |
|
3 | | -user=postgres |
4 | | -password=1234 |
5 | | -host=localhost |
6 | | -port=5432 |
7 | | -database=postgres |
8 | | -verbose=false |
| 3 | +connectionString=postgres:// |
9 | 4 |
|
10 | | -params := -u $(user) --password $(password) -p $(port) -d $(database) -h $(host) --verbose $(verbose) |
| 5 | +params := $(connectionString) |
11 | 6 |
|
12 | 7 | node-command := xargs -n 1 -I file node file $(params) |
13 | 8 |
|
14 | | -.PHONY : test test-connection test-integration bench test-native build/default/binding.node |
| 9 | +.PHONY : test test-connection test-integration bench test-native \ |
| 10 | + build/default/binding.node jshint upgrade-pg publish |
| 11 | + |
| 12 | +all: |
| 13 | + npm install |
| 14 | + |
| 15 | +help: |
| 16 | + @echo "make prepare-test-db [connectionString=postgres://<your connection string>]" |
| 17 | + @echo "make test-all [connectionString=postgres://<your connection string>]" |
| 18 | + |
15 | 19 | test: test-unit |
16 | 20 |
|
17 | | -test-all: test-unit test-integration test-native test-binary |
| 21 | +test-all: jshint test-unit test-integration test-native test-binary |
| 22 | + |
| 23 | +test-travis: test-all upgrade-pg |
| 24 | + @make test-all connectionString=postgres://postgres@localhost:5433/postgres |
| 25 | + |
| 26 | +upgrade-pg: |
| 27 | + @chmod 755 script/travis-pg-9.2-install.sh |
| 28 | + @./script/travis-pg-9.2-install.sh |
18 | 29 |
|
19 | 30 | bench: |
20 | 31 | @find benchmark -name "*-bench.js" | $(node-command) |
21 | 32 |
|
22 | 33 | build/default/binding.node: |
23 | | - @node-waf configure build |
| 34 | + @node-gyp rebuild |
24 | 35 |
|
25 | 36 | test-unit: |
26 | 37 | @find test/unit -name "*-tests.js" | $(node-command) |
27 | 38 |
|
28 | 39 | test-connection: |
| 40 | + @echo "***Testing connection***" |
29 | 41 | @node script/test-connection.js $(params) |
30 | 42 |
|
31 | 43 | test-connection-binary: |
32 | | - @node script/test-connection.js $(params) --binary true |
| 44 | + @echo "***Testing binary connection***" |
| 45 | + @node script/test-connection.js $(params) binary |
33 | 46 |
|
34 | 47 | test-native: build/default/binding.node |
35 | 48 | @echo "***Testing native bindings***" |
36 | 49 | @find test/native -name "*-tests.js" | $(node-command) |
37 | | - @find test/integration -name "*-tests.js" | $(node-command) --native true |
| 50 | + @find test/integration -name "*-tests.js" | $(node-command) native |
38 | 51 |
|
39 | | -test-integration: test-connection |
| 52 | +test-integration: test-connection |
40 | 53 | @echo "***Testing Pure Javascript***" |
41 | 54 | @find test/integration -name "*-tests.js" | $(node-command) |
42 | 55 |
|
43 | 56 | test-binary: test-connection-binary |
44 | 57 | @echo "***Testing Pure Javascript (binary)***" |
45 | | - @find test/integration -name "*-tests.js" | $(node-command) --binary true |
| 58 | + @find test/integration -name "*-tests.js" | $(node-command) binary |
| 59 | + |
| 60 | +prepare-test-db: |
| 61 | + @echo "***Preparing the database for tests***" |
| 62 | + @find script/create-test-tables.js | $(node-command) |
| 63 | + |
| 64 | +jshint: |
| 65 | + @echo "***Starting jshint***" |
| 66 | + @./node_modules/.bin/jshint lib |
| 67 | + |
| 68 | +publish: |
| 69 | + @rm -r build || (exit 0) |
| 70 | + @npm publish |
0 commit comments