-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjustfile
94 lines (74 loc) · 3.11 KB
/
justfile
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
#!/usr/bin/env just -f
# This help
# Help it showed if just is called without arguments
@help:
just -lu | column -s '#' -t | sed 's/[ \t]*$//'
###############################################################################
# pre-commit
###############################################################################
# Setup pre-commit
precommit-install:
#!/usr/bin/env bash
test ! -f .git/hooks/pre-commit && pre-commit install || true
# Update pre-commit
@precommit-update:
pre-commit autoupdate
# precommit check
@precommit-check:
pre-commit run --all-files
###############################################################################
# Hugo
###############################################################################
[private]
hugo-download-theme:
#!/usr/bin/env bash
[ -e themes/hugo-geekdoc ] && rm -rf themes/hugo-geekdoc || true
mkdir -p themes/hugo-geekdoc
curl -L https://github.com/thegeeklab/hugo-geekdoc/releases/latest/download/hugo-geekdoc.tar.gz | tar -xz -C themes/hugo-geekdoc/ --strip-components=1
# Init hugo documentation site
@hugo-init: hugo-download-theme
hugo new site . > /dev/null
# Hugo serve the locally content
@hugo-serve:
GIT_COMMIT_SHA=`git rev-parse --verify HEAD` GIT_COMMIT_SHA_SHORT=`git rev-parse --short HEAD` hugo serve --debug --cleanDestinationDir -D
# Hugo build the content
hugo-build:
GIT_COMMIT_SHA=`git rev-parse --verify HEAD` GIT_COMMIT_SHA_SHORT=`git rev-parse --short HEAD` hugo --cleanDestinationDir
# Hugo test publish the content
hugo-publishtest: hugo-build
rsync -avrn --delete public/ [email protected]:/datas/vol3/w4a153382/var/www/devops.jesuislibre.org/htdocs/
# Hugo publish the content
hugo-publish: hugo-build
rsync -avr --delete public/ [email protected]:/datas/vol3/w4a153382/var/www/devops.jesuislibre.org/htdocs/
###############################################################################
# Tools
###############################################################################
# Show uniq domain links
@show-links filename:
grep -Eo '(http|https)://[^ /]+' {{ filename }} | sed 's/https*:\/\///' | sort | uniq
# Generate documentation samples
doc-generate-tex-sample:
#!/usr/bin/env bash
find . -type f -name '*.tex' | while read file; do
# get file informations
filename=$(basename -- "$file")
filename="${filename%.*}"
dirname=$(dirname -- "$file")
# generate pdf
pdflatex --output-dir "$dirname" "$file"
# convert pdf to png
convert -background white -alpha remove -alpha off -density 150 "$dirname/$filename.pdf" "$dirname/$filename.png"
montage -geometry +0+0 -tile 2x -bordercolor black -border 3 "$dirname/${filename}-*.png" "$dirname/$filename.png" | true
done
# Update documentation
@doc-update FAKEFILENAME:
./updatedoc.ts
# Lint the project
@lint:
pre-commit run --all-files
# Repl the project
@repl:
nix repl --extra-experimental-features repl-flake .#
# Show installed packages
@packages:
echo $PATH | tr ":" "\n" | grep -E "/nix/store" | sed -e "s/\/nix\/store\/[a-z0-9]\+\-//g" | sed -e "s/\/.*//g"