2013-09-05 18:12:04 +08:00
|
|
|
SHELL := /bin/sh
|
2010-12-15 08:50:18 +08:00
|
|
|
|
2013-07-23 01:45:26 +08:00
|
|
|
connectionString=postgres://
|
2010-12-15 08:50:18 +08:00
|
|
|
|
2012-05-31 11:12:14 +08:00
|
|
|
params := $(connectionString)
|
2010-12-25 10:09:55 +08:00
|
|
|
|
2010-12-25 10:22:15 +08:00
|
|
|
node-command := xargs -n 1 -I file node file $(params)
|
2010-12-15 08:50:18 +08:00
|
|
|
|
2013-01-21 18:46:29 +08:00
|
|
|
.PHONY : test test-connection test-integration bench test-native \
|
2014-10-18 12:20:18 +08:00
|
|
|
build/default/binding.node jshint upgrade-pg publish test-missing-native
|
2012-07-31 10:57:28 +08:00
|
|
|
|
2013-03-14 16:37:53 +08:00
|
|
|
all:
|
|
|
|
npm install
|
|
|
|
|
2013-09-02 10:44:02 +08:00
|
|
|
build:
|
|
|
|
node-gyp rebuild
|
|
|
|
|
2012-07-31 10:57:28 +08:00
|
|
|
help:
|
2013-07-23 01:45:26 +08:00
|
|
|
@echo "make prepare-test-db [connectionString=postgres://<your connection string>]"
|
|
|
|
@echo "make test-all [connectionString=postgres://<your connection string>]"
|
2012-07-31 10:57:28 +08:00
|
|
|
|
2013-09-02 10:44:02 +08:00
|
|
|
test: test-unit
|
2010-12-15 08:50:18 +08:00
|
|
|
|
2014-10-18 12:20:18 +08:00
|
|
|
test-all: jshint test-missing-native test-unit test-integration test-native test-binary
|
2010-12-15 08:50:18 +08:00
|
|
|
|
2013-04-22 18:52:41 +08:00
|
|
|
test-travis: test-all upgrade-pg
|
2013-11-21 13:01:31 +08:00
|
|
|
#@make test-all connectionString=postgres://postgres@localhost:5433/postgres
|
2013-04-22 18:18:13 +08:00
|
|
|
|
|
|
|
upgrade-pg:
|
2013-11-21 13:01:31 +08:00
|
|
|
#@chmod 755 script/travis-pg-9.2-install.sh
|
|
|
|
#@./script/travis-pg-9.2-install.sh
|
2013-04-22 18:18:13 +08:00
|
|
|
|
2010-12-31 11:26:23 +08:00
|
|
|
bench:
|
|
|
|
@find benchmark -name "*-bench.js" | $(node-command)
|
|
|
|
|
2010-12-25 10:22:15 +08:00
|
|
|
test-unit:
|
|
|
|
@find test/unit -name "*-tests.js" | $(node-command)
|
|
|
|
|
|
|
|
test-connection:
|
2013-01-16 17:53:06 +08:00
|
|
|
@echo "***Testing connection***"
|
2010-12-25 10:22:15 +08:00
|
|
|
@node script/test-connection.js $(params)
|
|
|
|
|
2011-11-22 11:59:54 +08:00
|
|
|
test-connection-binary:
|
2013-01-16 17:53:06 +08:00
|
|
|
@echo "***Testing binary connection***"
|
2012-05-31 11:12:14 +08:00
|
|
|
@node script/test-connection.js $(params) binary
|
2011-11-22 11:59:54 +08:00
|
|
|
|
2014-10-18 12:20:18 +08:00
|
|
|
test-missing-native:
|
|
|
|
@echo "***Testing optional native install***"
|
|
|
|
@rm -rf node_modules/pg-native
|
|
|
|
@node test/native/missing-native.js
|
|
|
|
@npm install pg-native@1.4.0
|
|
|
|
@node test/native/missing-native.js
|
|
|
|
@rm -rf node_modules/pg-native
|
|
|
|
|
|
|
|
node_modules/pg-native/index.js:
|
|
|
|
@npm i pg-native
|
|
|
|
|
|
|
|
test-native: node_modules/pg-native/index.js
|
2011-03-06 01:31:59 +08:00
|
|
|
@echo "***Testing native bindings***"
|
2011-02-24 10:19:27 +08:00
|
|
|
@find test/native -name "*-tests.js" | $(node-command)
|
2012-05-31 11:12:14 +08:00
|
|
|
@find test/integration -name "*-tests.js" | $(node-command) native
|
2011-02-23 12:48:51 +08:00
|
|
|
|
2014-09-14 13:23:02 +08:00
|
|
|
test-integration: test-connection
|
2011-03-06 01:31:59 +08:00
|
|
|
@echo "***Testing Pure Javascript***"
|
2010-12-25 10:22:15 +08:00
|
|
|
@find test/integration -name "*-tests.js" | $(node-command)
|
2011-11-22 11:59:54 +08:00
|
|
|
|
|
|
|
test-binary: test-connection-binary
|
|
|
|
@echo "***Testing Pure Javascript (binary)***"
|
2012-05-31 11:12:14 +08:00
|
|
|
@find test/integration -name "*-tests.js" | $(node-command) binary
|
2013-01-16 17:53:06 +08:00
|
|
|
|
|
|
|
prepare-test-db:
|
|
|
|
@echo "***Preparing the database for tests***"
|
|
|
|
@find script/create-test-tables.js | $(node-command)
|
|
|
|
|
2013-01-21 18:46:29 +08:00
|
|
|
jshint:
|
|
|
|
@echo "***Starting jshint***"
|
|
|
|
@./node_modules/.bin/jshint lib
|
2013-06-04 00:42:49 +08:00
|
|
|
|
|
|
|
publish:
|
|
|
|
@rm -r build || (exit 0)
|
|
|
|
@npm publish
|