-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
120 lines (93 loc) · 3.54 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
config_files := \
test/ccouch-repos.lst \
test/dbc-mysql.json \
test/dbc-postgres.json
generated_resources := \
test/postgres-scripts/create-tables.sql \
test/postgres-scripts/create-database.sql \
test/postgres-scripts/drop-database.sql \
util/phpstoragetest-psql \
util/phpstoragetest-pg_dump \
util/SchemaSchemaDemo.jar \
test/schema.php \
vendor
build_resources := ${generated_resources} ${config_files}
runtime_resources := \
test/schema.php \
vendor
resources := ${build_resources} ${runtime_resources}
schemaschemademo := java -jar util/SchemaSchemaDemo.jar test/schema.txt
fetch := vendor/bin/fetch -repo @test/ccouch-repos.lst
default: resources run-tests
.DELETE_ON_ERROR:
.PHONY: \
create-postgres-database \
default \
drop-postgres-database \
everything \
empty-postgres-database \
rebuild-postgres-database \
resources \
run-tests \
run-unit-tests \
run-web-server \
upgrade-postgres-database \
clean \
everything
build-resources: ${build_resources}
runtime-resources: ${runtime_resources}
resources: ${resources}
clean:
rm -rf ${generated_resources}
vendor: composer.json
rm -f composer.lock
composer install
touch "$@"
${config_files}: %: | %.example
cp "$|" "$@"
util/phpstoragetest-psql: test/dbc-postgres.json
vendor/bin/generate-psql-script -psql-exe psql "$<" >"$@"
chmod +x "$@"
util/phpstoragetest-pg_dump: test/dbc-postgres.json
vendor/bin/generate-psql-script -psql-exe pg_dump "$<" >"$@"
chmod +x "$@"
util/SchemaSchemaDemo.jar: \
%: %.urn | vendor test/ccouch-repos.lst
${fetch} -o "$@" `cat "$<"`
test/postgres-scripts/create-tables.sql: test/schema.txt util/SchemaSchemaDemo.jar
${schemaschemademo} -o-create-tables-script "$@"
test/schema.php: test/schema.txt util/SchemaSchemaDemo.jar
${schemaschemademo} -o-schema-php "$@" -php-schema-class-namespace EarthIT_Schema
test/postgres-scripts/create-database.sql: test/dbc-postgres.json vendor
mkdir -p test/postgres-scripts
vendor/bin/generate-create-database-sql "$<" >"$@"
test/postgres-scripts/drop-database.sql: test/dbc-postgres.json vendor
mkdir -p test/postgres-scripts
vendor/bin/generate-drop-database-sql "$<" >"$@"
# Postgres!
create-postgres-database: test/postgres-scripts/create-database.sql
cat '$<' | sudo -u postgres psql -v ON_ERROR_STOP=1
sudo -u postgres psql -v ON_ERROR_STOP=1 phpstoragetest <test/postgres-scripts/create-postgis-extension.sql
drop-postgres-database: test/postgres-scripts/drop-database.sql
cat '$<' | sudo -u postgres psql -v ON_ERROR_STOP=1
empty-postgres-database: test/postgres-scripts/empty-database.sql util/phpstoragetest-psql
util/phpstoragetest-psql <"$<"
upgrade-postgres-database: \
test/postgres-scripts/drop-schema.sql \
test/postgres-scripts/create-schema.sql \
test/postgres-scripts/create-tables.sql \
util/phpstoragetest-psql
util/phpstoragetest-psql -v ON_ERROR_STOP=1 <test/postgres-scripts/drop-schema.sql
util/phpstoragetest-psql -v ON_ERROR_STOP=1 <test/postgres-scripts/create-schema.sql
util/phpstoragetest-psql -v ON_ERROR_STOP=1 <test/postgres-scripts/create-tables.sql
rebuild-postgres-database: empty-postgres-database upgrade-postgres-database
# MySQL!
create-mysql-database: test/mysql-scripts/create-database.sql
cat '$<' | mysql -uroot
drop-mysql-database: test/mysql-scripts/drop-database.sql
cat '$<' | mysql -uroot
upgrade-mysql-database: test/mysql-scripts/create-tables.sql
cat '$<' | util/phpstoragetest-mysql
run-unit-tests: runtime-resources upgrade-postgres-database upgrade-mysql-database
vendor/bin/phpunit --bootstrap test/phpuinit-bootstrap.php test
run-tests: run-unit-tests