-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathMakefile
201 lines (145 loc) · 7.12 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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html#Phony-Targets
# introduced port variable:
# you can explicitely pass a port, e.g. $ make hugo port=1313
# open a version with and without drafts in parallel:
# make hugo hugoWOD
.PHONY : hugo linkCheck linkcheck
.RECIPEPREFIX = -
# default port
port=4545
#baseURL=http://localhost:$(port)/~kleinen/
baseURL=http://localhost:$(port)
hugo : node_modules open # open_current # open_m1 # openH
- hugo --config bin/local-modules.toml --navigateToChanged --buildDrafts --baseURL $(baseURL) -p $(port) server
hugo2 : node_modules open # open_current # open_m1 # openH
- hugo --navigateToChanged --buildDrafts --baseURL "http://localhost:$(port)/~kleinen/" -p $(port) server
# without drafts, more like production
portProduction=4444
baseURLProduction=http://localhost:$(portProduction)
production : openP # open_current # open_m1 # openH
- hugo --disableFastRender --navigateToChanged --buildFuture --baseURL "$(baseURLProduction)" -p $(portProduction) server
openP:
- open $(baseURLProduction)
build:
- hugo --environment production --baseURL "$(baseURL)"
open:
- open "$(baseURL)"
open_current:
- open http://localhost:$(port)/~kleinen/classes/m1
open_m1:
- open http://localhost:$(port)/~kleinen/classes/ws2019/m1-web/
- open http://localhost:$(port)/~kleinen/classes/ss2020/m1-web/
- open http://localhost:$(port)/~kleinen/classes/ws2020/m1-web/
- open http://localhost:$(port)/~kleinen/classes/ss2021/m1-web/
- open http://localhost:$(port)/~kleinen/classes/ws2021/m1-web/
- open http://localhost:$(port)/~kleinen/classes/ss2022/m1-web/
- open http://localhost:$(port)/~kleinen/classes/ws2022/m1-web/
- open http://localhost:$(port)/~kleinen/classes/ss2023/m1-web/
- open http://localhost:$(port)/~kleinen/classes/ws2023/m1-web/
- open http://localhost:$(port)/~kleinen/classes/ss2024/m1-web/
hugo1 : node_modules openI
- hugo --disableFastRender --navigateToChanged --buildDrafts -p $(port) server
openBib:
- open http://localhost:4242/~kleinen/bibliographies
debug : node_modules
- open http://localhost:$(port)/~kleinen/classes/ss2023/info3
- open http://localhost:4242/~kleinen/classes/
- hugo --disableFastRender --buildDrafts --navigateToChanged --environment debug -p $(port) server
node_modules :
- npm install
hugoWT : port = 4241
hugoWT : node_modules open
- hugo --buildDrafts --environment progwebtec -p $(port) server
hugoWOD : port = 4243
hugoWOD : node_modules openH
- hugo -p $(port) --baseURL "http://localhost:$(port)/~kleinen/" server
hugoLC : port = 4244
hugoLC : node_modules
- hugo --environment production -p $(port) --baseURL "http://host.docker.internal:4244/~kleinen/" server --disableFastRender
hugoS : node_modules openS # staging; without drafts
- hugo --environment staging -p 4242 server
hugoSD : node_modules openSD # staging; like production but with drafts
- hugo --buildDrafts --environment stagingdrafts -p 4242 server
c :
- git add .
- git commit -m "$m"
# variable definition is executed when needed
# variable can also be set when calling target, e.g.
# make deploy tag=v0.42
# zum ausprobieren
# tag = $(shell echo DEF_TAG)
tag = $(shell bin/hugo_deployment/gitautotag.sh --minor)
tag : check_on_main push
- echo "created new tag $(tag)"
push :
- git push origin main
# indirection needed to only create tag if conditions are met
deploy : check_on_main push deployIMPLYOUDONTWANNATYPETHIS
deployIMPLYOUDONTWANNATYPETHIS : # dont call this directly!!!!
- git push origin $(tag)
ERR = $(error error is "not on main branch")
current_branch = $(shell git branch --show-current)
check_on_main :
ifneq ($(current_branch),main)
- echo $(ERR)
endif
openH :
- open http://localhost:$(port)/~kleinen
openRoot :
- open http://localhost:$(port)
openS :
- open http://localhost:4242/staging
openSD :
- open http://localhost:4242/stagingdrafts
openGH :
- gh browse
openActions :
- open https://github.com/bkleinen/bkleinen.github.io/actions
openSites:
- open https://home.htw-berlin.de/~kleinen/
- open https://bkleinen.github.io/
- open https://bkleinen.github.io/staging/
- open https://bkleinen.github.io/stagingdrafts/
openI:
- open http://localhost:4242/~kleinen/classes/ss2023/info3/labs
openN:
- open http://localhost:4242/~kleinen/classes/ss2022/networks/
ps:
- ps -ax | grep hugo
aliases_list:
- grep -R "aliases: " content
aliases_update:
- echo "# this file is generated from front matter aliases with make aliases_update" > data/aliases.yml
- echo "# these shortcuts/aliases are used in the back to course link in material, " >> data/aliases.yml
- echo "# they do not work as an url alias!" >> data/aliases.yml
#- grep -R "aliases: " content | sed -e "s%content\(.*\)\(/\.md\|\)\(_index.md\)*:aliases: /\([^/]*\)/*%\4: \1%g" >> data/aliases.yml
- grep -R "aliases: " content | sed -e "s%content\(.*\):aliases: /\([^/]*\)/*%\2: \1%g" >> data/aliases.yml
aliases_update_try:
- echo "# this file is generated from front matter aliases with make aliases_update" > data/aliases.yml
- echo "# these shortcuts/aliases are used in the back to course link in material, " >> data/aliases.yml
- echo "# they do not work as an url alias!" >> data/aliases.yml
- grep -R "aliases: " content | sed -e "s%content\(.*\):aliases: /\([^/]*\)/*%\2: \1%g"
# https://hub.docker.com/r/tennox/linkcheck
links: build
- grep -rn "a href" public | sed -E "s/([0-9]+:).*href\s*=\s*\"/\1 /g" | sed -E "s/\".*//g"
internal: build
- grep -rn "a href" public | grep "localhost:4000" | sed -E "s/([0-9]+:).*href\s*=\s*\"/\1 /g" | sed -E "s/\".*//g"
internal2:
- grep -rn "http://localhost:4000/~kleinen" public | sed -E "s#([0-9]:).*http://localhost:4000/~kleinen/*#\1 #g" | sed -E "s/\"*>.*//g"
internal3:
- grep -rn "http://localhost:4000/~kleinen" public | sed -E "s#.*http://localhost:4000/~kleinen/*##g" | sed -E "s/\"*>.*//g"
- grep -rn "http://localhost:4000/~kleinen" public | sed -E "s#.*http://localhost:4000/~kleinen/*##g" | sed -E "s/\".*//g" | sed -E "s/<.*//g" | sort -u
- grep -rn "http://localhost:4000/~kleinen" public | sed -E "s#.*http://localhost:4000/~kleinen/*##g" | sed -E "s/\".*//g" | sed -E "s/<.*//g" | grep -v "&#" | sort -u
audit:
- HUGO_MINIFY_TDEWOLFF_HTML_KEEPCOMMENTS=true HUGO_ENABLEMISSINGTRANSLATIONPLACEHOLDERS=true hugo && grep -inorE "<\!-- raw HTML omitted -->|ZgotmplZ|\[i18n\]|\(<nil>\)|(<nil>)|hahahugo" public/
wget-linkcheck: # build hugoP
- wget --input-file=public/index.html --force-html --spider -nv --base=http://localhost:4444/~kleinen/ -r -D localhost 2&> tmp/wget-error.log
# note: das automatische seitenöffnen funktioniert nur mit ohne ~kleinen in der baseURL.
wget-linkcheck-verbose:
- wget --input-file=public/index.html --force-html --spider --base=http://localhost:4444/~kleinen/ -r -D localhost 2&> tmp/wget-error-verbose.log
wget-brief:
- grep -B 1 "Die Datei auf dem Server existiert nicht" tmp/wget-error.log | grep http | sort -u
wget-loop:
- wget --input-file=public/index.html --force-html --spider --base=http://localhost:4444/~kleinen/ -r -D localhost 2&> tmp/wget-error-verbose.log
hugoP-wget : node_modules open # open_current # open_m1 # openH
- hugo --disableFastRender --baseURL "$(baseURL)" -p $(port) server