-
Notifications
You must be signed in to change notification settings - Fork 95
/
Makefile
170 lines (139 loc) · 3.89 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
MAKEFLAGS += --warn-undefined-variables
SHELL := bash
.SHELLFLAGS := -eu -o pipefail -c
.DEFAULT_GOAL := all
.DELETE_ON_ERROR:
.SUFFIXES:
.SECONDARY:
conf_dir := /etc/nginx/conf.d
domain := http://hyperpolyglot.wikidot.com
extract := ./bin/extract.rb
log_dir := /var/log/nginx
nginx := /etc/init.d/nginx
paths := start scripting scripting2 more cpp c pascal lisp ml logic stack
paths += shell data fortran computer-algebra computer-algebra2 more-computer-algebra unix-shells
paths += text-mode-editors version-control build multiplexers db
paths += lightweight-markup vector-graphics rust gui json
paths += numerical-analysis numerical-analysis2 distributions misc-math web
math := $(patsubst %,%.math,$(paths))
html := $(patsubst %,master/%.html,$(paths))
wiki := $(patsubst %,%.wiki,$(paths))
markup := $(patsubst %,markup/%,$(paths))
errors := 404.html 500.html 502.html 503.html 504.html
icons := favicon.gif touch-icon-ipad-retina.png touch-icon-iphone-retina.png
robots := robots.txt
css := hyperpolyglot.css
static := $(errors) $(icons) $(robots) $(css)
builds := $(patsubst %,build/%.html,$(paths))
.PHONY: install
install:
cp ../hyperpolyglot-site-conf/site.conf $(conf_dir)
$(nginx) reload
.PHONY: error
error:
cat $(log_dir)/error.log
.PHONY: access
access:
cat $(log_dir)/access.log
%.wiki:
curl $(domain)/$* > $@
%.math: %.wiki
./bin/xslt.sh $< > $@
master:
mkdir -p $@
master/%.html: %.math | master
$(extract) $< math_pages.txt > $@
master/sitemap.xml: $(html) | master
./bin/sitemap.py master > $@
.PHONY: static | master
static:
cp $(static) master
.PHONY: refresh
refresh: master/sitemap.xml static | master
mv root root.$(shell date +%Y%m%d.%H%M)
mv master root
markup:
mkdir -p $@
markup/%: | markup
./bin/page_content.py --page=$* --download > $@
skeleton.db: skeleton.txt
rm -f $@
./bin/table.rb --parse-skeleton $< --database $@
.PHONY: generate_skeleton
generate_skeleton:
./bin/table.rb --generate-skeleton skeleton.txt --database skeleton.db
check.%: markup/%
@if [ ! -e skeleton.db ]; then echo "run 'make skeleton.db'"; false; fi
./bin/table.rb --columns=1,2,3,4,5,6 --file $< --database skeleton.db > /dev/null
.PHONY:
download: $(markup)
.PHONY:
upload.origin:
aws s3 cp origin/images $(AWS_ORIGIN_BUCKET)/images --recursive
.PHONY: instructions
instructions:
@echo
@echo '------------------------------------------------------------------------------'
@echo ' Go to '
@echo
@echo ' http://hyperpolyglot.wikidot.com/_admin/'
@echo
@echo ' and set'
@echo
@echo ' Security | Access policy'
@echo
@echo ' to "Closed" and click "Save changes". Then run'
@echo
@echo ' $$ make clobber'
@echo ' $$ make refresh'
@echo
@echo ' To download markup from the wiki:'
@echo
@echo ' $$ rm -rf markup'
@echo ' $$ make download'
@echo
@echo ' Remember to set the access policy back to "Private and click "Save changes".'
@echo
@echo ' To upload edited markup to the wiki, use this command:'
@echo
@echo ' $$ ./bin/page_content.py --page=PAGE --upload < markup/PAGE'
@echo
@echo ' To upload content to origin:'
@echo
@echo ' $$ make upload.origin'
@echo
@echo '------------------------------------------------------------------------------'
.PHONY: all
all: instructions
.PHONY: rubocop
rubocop:
find . -name '*.rb' | xargs rubocop -D
.PHONY: pep8
pep8:
find . -name '*.py' | xargs pep8
.PHONY: pylint
pylint:
find . -name '*.py' | xargs pylint -d missing-docstring
.PHONY: clean.math
clean.math:
-rm -f $(math)
.PHONY: clean.html
clean.html:
-rm -f $(html)
.PHONY: clean
clean: clean.math clean.html
.PHONY: clobber
clobber: clean
rm -f $(wiki)
wikidot_to_html = ./bin/wikidot_to_html.py
build:
mkdir -p $@
builds: $(builds)
build/%.html: markup/% | build
( echo '<% title="Lorem Ipsum"; math=true %>' \
&& cat header.html.erb ) \
| erb > $@
$(wikidot_to_html) < $< >> $@
( echo '<% foo=false %> ' \
&& cat footer.html.erb ) \
| erb >> $@