xonecas.io
8356
Wx

www-xonecas-io / files

www-xonecas-io / Makefile

1.4 KB
1TAILWIND_VERSION := v4.3.3
2REPOS ?= repos
3
4.PHONY: site import index serve test login-shell
5
6bin/tailwindcss:
7	mkdir -p bin
8	curl -fsSLo $@ https://github.com/tailwindlabs/tailwindcss/releases/download/$(TAILWIND_VERSION)/tailwindcss-linux-x64
9	chmod +x $@
10
11# site builds the command, so bin/site remote add <url> and the rest work from here.
12site:
13	go build -o bin/site ./cmd/site
14
15import:
16	go run ./cmd/site import -sources sources.txt -store $(REPOS)
17
18index:
19	go run ./cmd/site index -sources sources.txt -store $(REPOS)
20
21# serve runs the site on :8080, with the Rats devnotes script for Ctrl+click tickets.
22serve: bin/tailwindcss
23	go run ./cmd/site serve -data data/projects.json -devnotes
24
25test:
26	go test ./...
27
28# login-shell makes git push <you>@<this host>:<name>.git reach the site. Run it once, on the server, in the site folder,
29# as the user that owns it. Your logins, ssh commands, scp and sftp still get your own shell, LOGIN_SHELL.
30LOGIN ?= /usr/local/bin/site-login
31LOGIN_SHELL ?= $(shell getent passwd $(USER) | cut -d: -f7)
32login-shell: site
33	@test "$(LOGIN_SHELL)" != "$(LOGIN)" || { echo "already set up; to redo it, pass your own shell: make login-shell LOGIN_SHELL=/bin/bash"; exit 1; }
34	sed -e 's|@SITE@|$(CURDIR)/bin/site|' -e 's|@SHELL@|$(LOGIN_SHELL)|' login-shell.sh | sudo tee $(LOGIN) >/dev/null
35	sudo chmod 755 $(LOGIN)
36	grep -qx $(LOGIN) /etc/shells || echo $(LOGIN) | sudo tee -a /etc/shells >/dev/null
37	sudo chsh -s $(LOGIN) $(USER)