-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
Makefile
661 lines (491 loc) · 19.4 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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
MAKEFLAGS+=--no-print-directory
# Show a list of available tasks
_help:
@echo Available tasks:
@grep '^[^_#\\$$[:space:]][^=/[:space:]]*:' Makefile | cut -d: -f1 | xargs -n1 echo ' make'
#----------------------------------------------------------
# On Mac my user's main group id is too low and I get this:
# addgroup: The GID `20' is already in use.
# Fix it by setting a higher group id, e.g.:
# GROUP_ID=501 make build-base
# The number shouldn't matter too much.
USER_ID ?= $(shell id -u)
GROUP_ID ?= $(shell id -g)
#----------------------------------------------------------
# The idea here is that I want to pin the base image in Dockerfile.base
# for reproducibility but also have an easy way to keep it updated when
# a new version is available.
#
RUBY_VER=3.3
RUBY_TAG=$(RUBY_VER)-slim
# Set it to plain for detailed build output
ifdef PROGRESS
PROGRESS_OPT=--progress $(PROGRESS)
endif
pull-ruby:
$(D) pull ruby:$(RUBY_TAG)
NO_COMMIT=1 bin/pin-digest.sh docker.io/library/ruby:$(RUBY_TAG) docker/Dockerfile.base "Newer ruby base image pulled from docker hub"
# Build base docker image
# (The build args are important here, the build will fail without them)
build-base:
$(DC) $(PROGRESS_OPT) build --no-cache --build-arg USER_ID=$(USER_ID) --build-arg GROUP_ID=$(GROUP_ID) app
# Use this if you're hacking on docker/Dockerfile.base and building repeatedly
fast-build-base:
$(DC) $(PROGRESS_OPT) build --build-arg USER_ID=$(USER_ID) --build-arg GROUP_ID=$(GROUP_ID) app
build-push-base: cleanup build-base push-base
NO_COMMIT=1 bin/pin-digest.sh docker.io/sbaird/tiddlyhost-base:latest docker/Dockerfile.prod "Tiddlyhost base image rebuilt"
# To set up your environment right after doing a git clone
# Beware: This command runs `rails db:setup` which will clear out your local database
DB_VOL_MOUNT=docker/postgresql-data/data16
APP_VOL_MOUNTS=docker/bundle docker/node_modules docker/log docker/config docker/secrets docker/dotcache
rails-init: build-info js-math download-empty-prerelease gzip-core-js-files
mkdir -p $(DB_VOL_MOUNT) $(APP_VOL_MOUNTS)
$(DC) run --rm app bash -c "bin/bundle install && bin/rails yarn:install && bin/rails db:setup"
# Identical to the above but with an extra chown command since the user id in
# the container doesn't match the local user id when running in GitHub workflow
rails-init-ci:
mkdir -p $(DB_VOL_MOUNT) $(APP_VOL_MOUNTS)
sudo chown $(USER_ID):$(GROUP_ID) -R rails $(APP_VOL_MOUNTS)
$(DC) run --rm app bash -c "bin/bundle install && bin/rails yarn:install && bin/rails db:setup"
#----------------------------------------------------------
docker/secrets:
@mkdir -p $@
docker/secrets/master.key: docker/secrets
@cp rails/config/master.key $@
docker/secrets/credentials.yml.enc: docker/secrets
@cp rails/config/credentials.yml.enc $@
prod-secrets: docker/secrets/master.key docker/secrets/credentials.yml.enc
#----------------------------------------------------------
# Fun way to reuse the ansible templates to create local config
docker/%: ansible/playbooks/templates/docker/%.j2
@mkdir -p $$(dirname $@)
@env primary_host=tiddlyhost.local tiddlyspot_host=tiddlyspot.local \
python -c "import os,sys,jinja2; print(jinja2.Template(sys.stdin.read()).render(os.environ))" \
< $< > $@
@echo $@ created using $<
local-nginx: docker/nginx-conf/nginx.conf docker/nginx-conf/server-common.conf
local-rails: docker/config/settings_local.yml
local-config: local-nginx local-rails
#----------------------------------------------------------
# Brings up the web container only and runs bash in it
run-base:
-$(DC) run --rm --no-deps app bash
# Brings up the db and the web container and runs bash in the web container
shell:
-$(DC) run --rm app bash
D=docker
DC=docker compose
DC_PROD=docker compose -f docker-compose-prod.yml
# Figure out if there's already a container running and use exec or run accordingly
# Call it DCC for "Docker Compose Command"
EXEC_OR_RUN=$(shell [[ $$($(DC) ps --services --filter status=running | grep app ) ]] && echo 'exec' || echo 'run --rm')
DCCF=$(DC) $(EXEC_OR_RUN) app bash -c
DCC=-$(DCCF)
# This is faster if you don't need the database or anything else
# Let's call it DR for "Docker Run"
DRF=$(DC) run --rm --no-deps app bash -c
DR=-$(DRF)
join:
$(DCC) bash
sandbox:
$(DCC) 'bin/rails console --sandbox'
console:
$(DCC) 'bin/rails console'
db-migrate:
$(DCC) 'bin/rails db:migrate'
tmp-clear:
$(DCC) 'bin/rails tmp:clear'
log-clear:
$(DCC) 'rm -f log/*.log'
docker/log:
mkdir -p docker/log
app-log: docker/log
#----------------------------------------------------------
# Start Tiddlyhost locally - app only, no container, no SSL
db-start:
@$(DC) up --detach db
db-stop:
$(DC) stop
rstart: db-start
@cd rails && bundle install && rails s
rtest: db-start
@cd rails && bundle install && rails t
#----------------------------------------------------------
# Start Tiddlyhost locally - containerized full stack with SSL
start: local-config cert app-log
-$(DC) up
#----------------------------------------------------------
# Run bundle-install
bundle-install:
@mkdir -p docker/bundle
$(DR) "bin/bundle install"
# Run bundle-update
bundle-update:
$(DR) "bin/bundle update --quiet"
# Run bundle-clean
bundle-clean:
$(DR) "bin/bundle clean"
# Run yarn install
yarn-install:
$(DR) "bin/yarn install"
# Run yarn upgrade
yarn-upgrade:
$(DR) "bin/yarn upgrade --silent --no-progress"
# Update deps and make a commit
LOCK_FILES=rails/Gemfile.lock rails/yarn.lock
deps-update: pull-ruby build-push-base bundle-update yarn-upgrade
git add $(LOCK_FILES)
git commit -m 'chore: Refresh base images and update dependencies' \
-m 'Commit created with `make deps-update`'
#----------------------------------------------------------
haml-lint:
$(DCCF) "bundle exec haml-lint"
rubocop:
$(DRF) "bundle exec rubocop"
brakeman:
$(DR) "bin/brakeman"
# Example usage:
# ONLY=Layout/EmptyLinesAroundModuleBody,Layout/EmptyLinesAroundClassBody make rubycop-fix
rubocop-fix:
$(DR) "bundle exec rubocop --only $(ONLY) --autocorrect-all"
git commit -a \
-m "rubocop: $$(echo $(ONLY) | cut -d, -f1)..." \
-m "Rubocop autocorrect for the following:" \
-m "$$(echo $(ONLY) | tr , '\n' | sed 's/^/- /')"
haml-lint-refresh-todos:
$(DR) "bundle exec haml-lint --auto-gen-config"
haml-lint-with-todo:
$(DR) "bundle exec haml-lint --config .haml-lint_todo.yml"
delint: haml-lint-with-todo rubocop
ansible-lint:
@ansible-lint -p ansible/playbooks/deploy.yml -x yaml[indentation],no-handler
#----------------------------------------------------------
# View or edit encrypted secrets
# (Todo maybe: Switch to newer per-environment credentials and use
# `--environment=production` and `--environment=development` here)
#
secrets:
$(DR) "EDITOR=vi bin/rails credentials:edit"
dump-secrets:
@$(DR) "EDITOR=cat bin/rails credentials:edit" | tail -n +2
#----------------------------------------------------------
# Run test suite
run-tests:
$(DCC) 'bin/rails test:all'
test-ci:
$(DC) run --rm app bash -c "bin/rails test:all"
coverage:
$(DCC) 'env COVERAGE=1 bin/rails test:all'
onetest:
$(DCC) 'bin/rails test $(TEST)'
test: run-tests
tests: run-tests
#----------------------------------------------------------
# (Use these if you want to run the prod container locally)
shell-prod: local-config prod-secrets prod-prerelease
-$(DC_PROD) run --rm app bash
join-prod:
-$(DC_PROD) exec app bash -c bash
start-prod: local-config prod-secrets prod-prerelease
-$(DC_PROD) up
#----------------------------------------------------------
# Stop and remove containers, clean up unused images and remove
# the static files volume used by the prod container so to ensure
# it gets recreated fresh on startup
cleanup: tmp-clear log-clear
$(DC) stop
$(DC_PROD) stop
$(DC) rm -f
$(DC_PROD) rm -f
$(D) image prune -f
$(D) volume rm -f th_rails_static
#----------------------------------------------------------
# Get the email confirmation link when you sign up a new user locally.
# Grep them in the plain text part of the email.
#
signup-link:
@$(DCC) 'grep "tiddlyhost.local/users/confirmation?confirmation_token=" log/development.log | grep -v "Started GET" | tail -1 | cut -d" " -f2'
# Get the reset password link after clicking "Forgot your password?" locally
#
forgot-link:
@$(DCC) 'grep "tiddlyhost.local/users/password/edit?reset_password_token=" log/development.log | grep -v "Started GET" | tail -1 | cut -d" " -f2'
#----------------------------------------------------------
EMPTY_DIR=rails/tw_content/empties
EMPTY_URL_tw5=https://tiddlywiki.com/empty.html
EMPTY_URL_tw5x=https://tiddlywiki.com/empty-external-core.html
EMPTY_URL_feather=https://feather.wiki/builds/v1.8.x/FeatherWiki_$(FEATHER_BIRD).html
EMPTY_URL_classic=https://classic.tiddlywiki.com/empty.html
EMPTY_URL_prerelease=https://tiddlywiki.com/prerelease/empty.html
CURL_FETCH=curl -sL $(EMPTY_URL_$1) -o $(EMPTY_DIR)/$1.html
download-empty-%: $(EMPTY_DIR)
$(call CURL_FETCH,$*)
CORE_JS_URL=https://tiddlywiki.com/tiddlywikicore-$(VER).js
download-core-js:
cd rails/public && curl -sL $(CORE_JS_URL) -O
download-core-js-prerelease:
PRERELEASE_VER=$$(curl -s --range 0-1000 $(EMPTY_URL_prerelease) | grep '<meta name="tiddlywiki-version"' | cut -d'"' -f4) && \
CORE_JS_PRERELEASE_URL=https://tiddlywiki.com/prerelease/tiddlywikicore-$${PRERELEASE_VER}.js && \
cd rails/public && \
curl -sL $${CORE_JS_PRERELEASE_URL} -O
download-empties: download-empty-tw5 download-empty-tw5x download-empty-feather download-empty-classic download-empty-prerelease download-core-js download-core-js-prerelease
PROD_PRERELEASE=docker/config/prerelease.html
$(PROD_PRERELEASE): $(EMPTY_DIR)/prerelease.html
cp $< $@
prod-prerelease: $(PROD_PRERELEASE)
# Now that we have Feather Wiki included in ansible/fetch_empties
# this isn't used regularly, but keep it in case I ever want to
# build my own Feather Wiki empty for some reason.
#
FEATHER_BUILD=../FeatherWiki/builds/FeatherWiki_$(FEATHER_BIRD).html
FEATHER_EMPTY=$(EMPTY_DIR)/feather.html
$(FEATHER_EMPTY): $(FEATHER_BUILD)
cp $? $@
feather-empty: $(FEATHER_EMPTY)
refresh-empties: empty-versions clear-empties download-empties
clear-empties:
@rm -rf $(EMPTY_DIR)/*.html
empty-versions:
@$(DCC) 'bin/rails runner "puts Empty.versions.to_yaml"' \
| grep -v 'Spring preloader' | grep -v '\-\-\-'
#----------------------------------------------------------
# Run this at build time since I don't want to check in the gzipped files
gzip-core-js-files:
@for f in $$( ls rails/public/tiddlywikicore-*.js ); do \
gzip -c $$f > $$f.gz; \
echo Created $$f.gz; \
done
#----------------------------------------------------------
EMPTIES_DIR=rails/tw_content/empties
require-var-%:
@[[ ! -z "$$$(*)" ]] || ( echo "Environment var $(*) is required." && exit 1 )
ver-set: require-var-VER
# All the steps needed for a TiddlyWiki upgrade
# The version number must be provided manually like this:
# VER=5.3.1 make tw5-update
#
tw5-update: ver-set $(TW5_DIR) download-empty-tw5 download-empty-tw5x download-core-js
cp $(EMPTIES_DIR)/tw5.html $(EMPTIES_DIR)/tw5/$(VER).html
cp $(EMPTIES_DIR)/tw5x.html $(EMPTIES_DIR)/tw5x/$(VER).html
git add \
$(EMPTIES_DIR)/tw5.html \
$(EMPTIES_DIR)/tw5/$(VER).html \
$(EMPTIES_DIR)/tw5x.html \
$(EMPTIES_DIR)/tw5x/$(VER).html \
rails/public/tiddlywikicore-$(VER).js
git commit -m 'chore: Upgrade TiddlyWiki empties to version $(VER)' \
-m 'Commit created with `VER=$(VER) make tw5-update`'
# Same thing for Feather Wiki
# You must specify the version manually here too:
# VER=1.7.0 make feather-update
#
FEATHER_BIRD=Skylark
feather-update: ver-set download-empty-feather
cp $(EMPTIES_DIR)/feather.html $(EMPTIES_DIR)/feather/$(VER).html
git add \
$(EMPTIES_DIR)/feather.html \
$(EMPTIES_DIR)/feather/$(VER).html
git commit -m 'chore: Upgrade Feather Wiki empties to version $(VER)' \
-m 'Commit created with `VER=$(VER) make feather-update`'
# Same thing for Classic
# VER=2.10.1 make classic-update
classic-update: ver-set download-empty-classic
cp $(EMPTIES_DIR)/classic.html $(EMPTIES_DIR)/classic/$(VER).html
git add \
$(EMPTIES_DIR)/classic.html \
$(EMPTIES_DIR)/classic/$(VER).html
git commit -m 'chore: Upgrade TiddlyWiki Classic empties to $(VER)' \
-m 'Commit created with `VER=$(VER) make classic-update`'
#----------------------------------------------------------
# Generate an SSL cert
# (If the cert exists, assume the key exists too.)
CERTS_DIR=docker/letsencrypt/live/tiddlyhost.local
cert: $(CERTS_DIR)/fullchain.pem
$(CERTS_DIR)/fullchain.pem:
@bin/create-local-ssl-cert.sh $(CERTS_DIR)
clear-cert:
@rm -f $(CERTS_DIR)/privkey.pem
@rm -f $(CERTS_DIR)/fullchain.pem
redo-cert: clear-cert cert
#----------------------------------------------------------
no-uncommitted-diffs:
@if ! git diff-index --quiet HEAD --; then \
echo "Aborting due to uncommitted diffs!"; \
git diff --numstat; \
exit 1; \
fi
no-uncommitted-rails-files:
@if [[ -n "$$( git status rails --porcelain )" ]]; then \
echo "Aborting due to uncommitted files under rails directory!"; \
git status rails --porcelain; \
exit 1; \
fi
# Avoid accidentally deploying junk
build-ready: no-uncommitted-diffs no-uncommitted-rails-files
build-info:
@bin/create-build-info.sh | tee rails/public/build-info.txt
build-prod: build-ready build-info js-math download-empty-prerelease download-core-js-prerelease gzip-core-js-files
$(DC_PROD) $(PROGRESS_OPT) build app
build-prod-ci:
$(DC_PROD) build app
fast-build-prod: build-info
$(DC_PROD) $(PROGRESS_OPT) build app
push-base:
$(D) --config etc/docker-conf push sbaird/tiddlyhost-base
push-prod:
$(D) --config etc/docker-conf push sbaird/tiddlyhost
# Fixme: There are too many options here...
build-push: delint tests build-prod push-prod
build-full-deploy: build-push full-deploy
build-deploy: build-push deploy-app
fast-build-deploy: fast-build-prod push-prod fast-deploy-app
PLAY=ANSIBLE_CONFIG=ansible/ansible.cfg ansible-playbook -i ansible/inventory.yml $(V)
DEPLOY=$(PLAY) ansible/playbooks/deploy.yml --limit prod
RESTART=$(PLAY) ansible/playbooks/restart.yml --limit prod
BACKUP=$(PLAY) ansible/playbooks/backup.yml --limit prod
FETCH_LOGS=$(PLAY) ansible/playbooks/fetch-logs.yml --limit prod
LOCAL_DEPLOY=$(PLAY) ansible/playbooks/deploy.yml --limit localhost --ask-become-pass --connection local
full-deploy:
$(DEPLOY) --skip-tags cleanup
deploy-deps:
$(DEPLOY) --tags=deps
deploy-certs:
$(DEPLOY) --tags=certs
deploy-scripts:
$(DEPLOY) --tags=scripts
refresh-prerelease:
$(DEPLOY) --tags=refresh-prerelease
deploy-app:
$(DEPLOY) --tags=app
fast-deploy-app:
$(DEPLOY) --tags=fast-upgrade
deploy-app-bootstrap:
$(DEPLOY) --tags=app,db-create
deploy-cleanup:
$(DEPLOY) --tags=cleanup
deploy-secrets:
$(DEPLOY) --tags=secrets
# If you want to run selected tasks givem them the foo tag
deploy-foo:
$(DEPLOY) --tags=foo --diff
# To change some docker configuration locally since dnf update seems to reverts it
local-docker-fix:
$(LOCAL_DEPLOY) --tags=local-docker-fix
restart-jobs:
$(RESTART) -e restart_list=jobs
restart-app:
$(RESTART) -e restart_list=app
#----------------------------------------------------------
TIMESTAMP := $(shell date +%Y%m%d%H%M%S)
TOP_DIR=$(shell git rev-parse --show-toplevel)
BACKUPS_DIR=$(TOP_DIR)/../thost-backups
S3_BACKUPS=$(BACKUPS_DIR)/s3
DB_BACKUPS=$(BACKUPS_DIR)/db
db-backup:
mkdir -p $(DB_BACKUPS)/$(TIMESTAMP)
$(BACKUP) -e local_backup_subdir=$(TIMESTAMP) -e local_backup_dir=$(DB_BACKUPS) --limit=prod
ls -l $(DB_BACKUPS)/$(TIMESTAMP)
zcat $(DB_BACKUPS)/$(TIMESTAMP)/dbdump.gz | grep '^-- ' | head -3
du -h -s $(DB_BACKUPS)/$(TIMESTAMP)
du -h -s $(DB_BACKUPS)
fetch-logs:
$(FETCH_LOGS)
s3-bucket-name: require-var-BUCKET_NAME
# Assume you have suitable s3 credentials available
# Copy down new versions of sites, keeping old versions locally
s3-backup: s3-bucket-name
aws s3 sync s3://$(BUCKET_NAME) $(S3_BACKUPS)/latest
du -h $(S3_BACKUPS)
# Copy down new versions of sites, removing old versions locally
s3-backup-and-prune: s3-bucket-name
aws s3 sync s3://$(BUCKET_NAME) $(S3_BACKUPS)/latest --delete
du -h $(S3_BACKUPS)
# Ineffiently copy down everything to a timestamp directory
# Deprecated. Use s3-snapshot-and-prune instead.
s3-full-snapshot: s3-bucket-name
aws s3 sync s3://$(BUCKET_NAME) $(S3_BACKUPS)/$(TIMESTAMP)
du -h $(S3_BACKUPS)
s3-local-timestamped-copy:
cp -r $(S3_BACKUPS)/latest $(S3_BACKUPS)/latest-$(TIMESTAMP)
# Keep some deleted sites, but try not to keep multiples of them
s3-snapshot-and-prune: s3-backup s3-local-timestamped-copy s3-backup-and-prune
show-backups:
@du -h $(BACKUPS_DIR)
show-latest-db-backup:
@NEWEST=$$( ls -t $(DB_BACKUPS) | head -1 ) && \
ls -l $(DB_BACKUPS)/$$NEWEST && \
zcat $(DB_BACKUPS)/$$NEWEST/dbdump | wc -l && \
zcat $(DB_BACKUPS)/$$NEWEST/dbdump | head && \
echo . && echo . && echo . && \
zcat $(DB_BACKUPS)/$$NEWEST/dbdump | tail -4
# Example usage:
# make s3-extract FILEKEY=bc1viib59bbw3cpqvvd2x7dnth9b
s3-extract:
openssl zlib -d -in $(S3_BACKUPS)/latest/$(FILEKEY) > $(FILEKEY).html
full-backup: db-backup s3-backup
full-backup-and-snapshot: db-backup s3-snapshot-and-prune
#----------------------------------------------------------
PROD_INFO_URL=https://tiddlyhost.com/build-info.txt
prod-info:
@-curl -s $(PROD_INFO_URL)
prod-diff:
@-( \
echo '## Prod build info' && \
$(MAKE) prod-info && \
echo '' && \
echo '## Prod diff' && \
git diff --color=always $$(curl -s $(PROD_INFO_URL) | grep 'sha:' | cut -d: -f2) \
) | less -REXS
#----------------------------------------------------------
JS_MATH_ZIP=jsMath-3.3g.zip
JS_MATH_FONTS_ZIP=jsMath-fonts-1.3.zip
JS_MATH_DOWNLOADS=https://sourceforge.net/projects/jsmath/files
$(JS_MATH_ZIP):
curl -sL $(JS_MATH_DOWNLOADS)/jsMath/3.3g/$(JS_MATH_ZIP)/download -o $(JS_MATH_ZIP)
$(JS_MATH_FONTS_ZIP):
curl -sL $(JS_MATH_DOWNLOADS)/jsMath%20Image%20Fonts/1.3/$(JS_MATH_FONTS_ZIP)/download -o $(JS_MATH_FONTS_ZIP)
rails/public/jsMath/jsMath.js: $(JS_MATH_ZIP) $(JS_MATH_FONTS_ZIP)
cd rails/public && unzip -q ../../$(JS_MATH_ZIP)
cd rails/public/jsMath && unzip -q ../../../$(JS_MATH_FONTS_ZIP)
@touch rails/public/jsMath/jsMath.js # so make doesn't think it's stale
js-math: rails/public/jsMath/jsMath.js
js-math-clean:
rm -rf rails/public/jsMath
js-math-purge: js-math-clean
rm -f $(JS_MATH_ZIP) $(JS_MATH_FONTS_ZIP)
#----------------------------------------------------------
version-bump: require-var-VER
sed 's/major_version: ".*"/major_version: "$(VER)"/' -i rails/config/settings.yml
git add rails/config/settings.yml
git commit -m 'chore: Bump version to $(VER)' \
-m 'Commit created with `VER=$(VER) make version-bump`'
git tag 'v$(VER)'
echo 'You probably want to do this also:'
echo ' git push origin v$(VER)'
#----------------------------------------------------------
stripe-dev-listen:
stripe listen --forward-to https://tiddlyhost.local/pay/webhooks/stripe --skip-verify
#----------------------------------------------------------
/tmp/Simon\ Baird.png:
@curl -s -o '$@' \
https://www.gravatar.com/avatar/bfaba91f41f0c01aba1ef0751458b537
gource-image: /tmp/Simon\ Baird.png
pretty-colors: gource-image
@SDL_VIDEODRIVER=x11 gource \
--user-image-dir /tmp \
--seconds-per-day 0.07 \
--key \
--title 'Tiddlyhost Development' \
--fullscreen \
--frameless \
--auto-skip-seconds 0.3 \
--elasticity 0.1 \
--font-scale 5 \
--font-size 6 \
--dir-font-size 5 \
--user-font-size 5 \
--file-font-size 5 \
--bloom-multiplier 0.2 \
--bloom-intensity 0.2 \
--filename-colour 555555 \
--dir-colour 555555 \
;