-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
95 lines (71 loc) · 2.38 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
LIBSRC := $(shell find lib -name "*.php")
PHPSERVER = php -S localhost:8080 -t www tst/integration/router.php
EC2_SERVER= php -S localhost:8081 tst/integration/ec2-instance-metadata-router.php
COVERAGE_DIR = etc/coverage
COVERAGE_TEMP_DIR = /tmp
PHPUNIT = phpunit --stderr --bootstrap tst/conf.php --testdox
default: lib/conf.local.php src/apache.conf src/crontab css-admin js-admin src/md5sum db
lib/conf.local.php: lib/conf.default.php
@echo "Manually create lib/conf.local.php from lib/conf.default.php" && exit 1
src/crontab: src/crontab.default bin/Make.php lib/conf.local.php
php bin/Make.php crontab && \
echo -e "\nPlease reinstall src/crontab!\n"
src/apache.conf: src/apache.conf.default bin/Make.php lib/conf.local.php
php bin/Make.php apache.conf
src/md5sum: $(LIBSRC) bin/Make.php
php bin/Make.php md5sum
.PHONY: doc school-404 db
db:
@php bin/cli.php MigrateDB
school-404: lib/scripts/Update404.php
php lib/scripts/Update404.php schools
doc:
rm -r doc/* && \
phpdoc --ignore conf.*php \
--target doc \
--title "TechScore Documentation" \
--directory lib \
--defaultpackagename regatta \
--output "HTML:Smarty:PHP"
# CSS goodness
www/inc/css/%.css: res/www/inc/css/%.css
mkdir -pv www/inc/css && \
tr "\n" " " < $^ | \
tr -s " " | \
sed -e 's:/\*[^(\*/)]*\*/::g' -e 's/\(;\|:\|}\|{\)[ ]*/\1/g' \
-e 's/[ ]*{/{/g' -e 's/^[ ]*//' > $@
css-admin: $(subst res/www,www,$(wildcard res/www/inc/css/*.css))
# Javascript goodness
www/inc/js/%.js: res/www/inc/js/%.js
mkdir -pv www/inc/js && \
minijs.sh < $^ > $@ || cp $^ $@
js-admin: $(subst res/www,www,$(wildcard res/www/inc/js/*.js))
# Unit and integration testing
unit-test:
${PHPUNIT} tst/unit
single-unit-test:
${PHPUNIT} --include-path tst/unit $(class)
integration-test:
${PHPSERVER} & \
PID=$$!; \
${EC2_SERVER} & \
EC2_PID=$$!; \
echo "Servers started in PIDs: $$PID/$$EC2_PID"; \
${PHPUNIT} tst/integration; \
kill $$PID $$EC2_PID
single-integration-test:
${PHPSERVER} & \
PID=$$!; \
${EC2_SERVER} & \
EC2_PID=$$!; \
echo "Servers started in PIDs: $$PID/$$EC2_PID"; \
${PHPUNIT} --include-path tst/integration $(class); \
kill $$PID $$EC2_PID
tests: unit-test integration-test
coverage:
mkdir -p ${COVERAGE_DIR}; \
${PHPUNIT} --coverage-html ${COVERAGE_DIR} tst/unit
single-coverage:
${PHPUNIT} --coverage-html ${COVERAGE_TEMP_DIR} --include-path tst/unit $(class)
server:
${PHPSERVER}