-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
85 lines (70 loc) · 2.94 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
generated_files = \
test/db-scripts/create-database.sql \
.database-created \
composer.lock \
test/schema.php \
vendor
default: run-unit-tests
.DELETE_ON_ERROR:
.SILENT: \
.database-created
.PHONY: \
default \
clean \
run-unit-tests
util/test-psql: test/config/dbc.json util/generate-psql-script
php util/generate-psql-script "$<" > "$@"
chmod +x "$@"
util/SchemaSchemaDemo.jar: util/SchemaSchemaDemo.jar.urn
rm -f $@
mkdir -p `dirname $@`
java -jar util/TJFetcher.jar \
-repo pvps1.nuke24.net \
-repo fs.marvin.nuke24.net \
-repo robert.nuke24.net:8080 \
-o $@ `cat $<`
run_schema_processor = \
java -jar util/SchemaSchemaDemo.jar \
-o-schema-php test/schema.php -php-schema-class-namespace EarthIT_Schema \
-o-create-tables-script test/db-scripts/create-tables.sql \
test/schema.txt
test/schema.php: test/schema.txt util/SchemaSchemaDemo.jar
${run_schema_processor}
test/db-scripts/create-tables.sql: test/schema.txt util/SchemaSchemaDemo.jar
${run_schema_processor}
composer.lock: composer.json
rm -f composer.lock
composer install
vendor: composer.lock
composer install
touch "$@"
clean:
rm -rf ${generated_files}
test/config/dbc.json:
cp test/config/dbc.json.example test/config/dbc.json
test/db-scripts/create-database.sql: test/config/dbc.json vendor
mkdir -p test/db-scripts
php util/generate-database-creation-script test/config/dbc.json >"$@"
.database-created: test/config/dbc.json test/db-scripts/create-database.sql | util/test-psql
echo "-------------------------------------------------------------------" >&2
echo "Creating database on default postgres server based on configuration" >&2
echo "in test/config/dbc.json." >&2
echo "To do this yourself, create the database and 'touch $@'." >&2
echo "If the configuration is not correct, abort this Make invocation, edit" >&2
echo "the config file, and run Make again." >&2
echo "The current configuration is as follows:" >&2
echo "--------------------- test/config/dbc.json ----------------------" >&2
cat test/config/dbc.json >&2
echo "--------------------- SQL to be executed ------------------------" >&2
cat test/db-scripts/create-database.sql
echo "-------------------------------------------------------------------" >&2
cat test/db-scripts/create-database.sql | sudo -u postgres psql
echo "This file is a marker created/used by the build process to indicate" >"$@"
echo "that a database has been created. If you've deleted the datbase" >>"$@"
echo "or need to re-create it for some other reason, you may delete this file" >>"$@"
cat util/create-test-tables.sql | util/test-psql -v ON_ERROR_STOP=1
run-unit-tests: vendor .database-created test/schema.php test/db-scripts/create-tables.sql
util/test-psql -v ON_ERROR_STOP=1 <test/db-scripts/drop-schema.sql
util/test-psql -v ON_ERROR_STOP=1 <test/db-scripts/create-schema.sql
util/test-psql -v ON_ERROR_STOP=1 <test/db-scripts/create-tables.sql
vendor/bin/phpunit --bootstrap vendor/autoload.php test