-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
114 lines (89 loc) · 2.54 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
.ONESHELL:
SERVER_IP=127.0.0.1
SERVER_PORT=4004
GREP=/opt/homebrew/opt/grep/libexec/gnubin/grep
build: bundler # adjust-config
bundle exec jekyll build
Gemfile.lock: Gemfile
bundle install && touch Gemfile.lock
start: bundler Gemfile.lock # adjust-config
bundle exec jekyll serve --port $(SERVER_PORT) --host $(SERVER_IP)
s: start
adjust-config:
@THEME_VERSION=`$(GREP) -Po '(?<=jekyll-theme-mint", branch: ")[^"]+' Gemfile` && \
sed -i "s|remote_theme: aidewoode/jekyll-theme-mint@$$THEME_VERSION|theme: jekyll-theme-mint|" _config.yml
(sleep 3 && sed -i "s|theme: jekyll-theme-mint|remote_theme: aidewoode/jekyll-theme-mint@$$THEME_VERSION|" _config.yml) &
open:
open http://$(SERVER_IP):$(SERVER_PORT)
o: open
post: bundler
@if env | grep -i 'TERM_PROGRAM=vscode' > /dev/null; then \
read -p "Article title: " title; \
EDITOR=code bundle exec jekyll post "$$title"; \
else \
make edit; \
fi
install: bundler git-hook
git-hook:
cp -v pre-commit .git/hooks/
RUBY_VERSION=$(shell cat .ruby-version)
BUNDLER=$(HOME)/.rvm/gems/ruby-$(RUBY_VERSION)/bin/bundle
bundler: $(BUNDLER)
$(BUNDLER):
gem install bundler
bundle install
edit:
code -n .
e: edit
pre-commit: build
pc: pre-commit
re-fonts: rm-fonts fonts
rm-fonts:
rm -rf assets/fonts/ _sass/_fonts.scss
fonts: _sass/_fonts.scss
_sass/_fonts.scss: assets/fonts/
set -e
if [ -e "$@" ]; then mv "$@" "[email protected]"; fi
( \
echo 'https://fonts.googleapis.com/css2?family=Merriweather:ital,wght@0,400;0,700;1,400;1,700&display=swap'; \
) | while read url; do \
curl \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:69.0) Gecko/20100101 Firefox/69.0' \
--fail "$$url" >> $@ \
; done
rm -rf assets/fonts
mkdir -p assets/fonts
grep -Po 'https://fonts.gstatic.com\S+.woff2' $@ | xargs wget --directory-prefix=assets/fonts/
/usr/local/opt/gnu-sed/libexec/gnubin/sed -i 's|https://fonts.gstatic.com/.*/|fonts/|' $@
if [ -e "[email protected]" ]; then rm "[email protected]"; fi
assets/fonts/:
mkdir assets/fonts
favicon: favicon.ico
rm favicon.png
favicon.png: favicon.svg
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" \
--headless \
--screenshot \
--window-size=100,100 \
--default-background-color=0 \
--screenshot=favicon.png \
favicon.svg
favicon.ico: favicon.png
convert favicon.png \
-units PixelsPerInch \
-resample 300 \
-resize 64x64 \
favicon.ico
tagging:
@:
grep -Rl 'tags: \[]' _posts/ |
xargs code -n .
a: audit
audit:
bundle exec bundle-audit
au: audit-update
audit-update:
bundle exec bundle-audit update
i: install
install:
bundle install