-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
82 lines (56 loc) · 1.75 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
PORT := 4001
all: clear pull build deploy
pull:
git pull
git-prepare:
git clone -b gh-pages --single-branch git@github.com:igrishaev/interview.git gh-pages
docker-build:
docker build --no-cache -t blog .
DOCKER_BASE=docker run -it --rm -p $(PORT):$(PORT) -v $(CURDIR):/blog blog
run:
$(DOCKER_BASE)
build:
$(DOCKER_BASE) jekyll build
serve:
$(DOCKER_BASE) jekyll serve --watch --incremental
.PHONY: deploy
deploy:
cd gh-pages && git pull
cp -r _site/* gh-pages
cd gh-pages && git add -A && git commit -m "updated" && git push
static:
open "http://127.0.0.1:8000"
cd _site && python -m SimpleHTTPServer 8000
.PHONY: clear
clear:
rm -rf _site
gh-pages-init:
git clone --branch gh-pages git@github.com:igrishaev/blog.git gh-pages
aws-upload:
aws s3 sync aws s3://igrishaev.public --acl public-read --exclude '*.DS_Store'
aws-download:
aws s3 sync s3://igrishaev.public aws
aws-rm:
aws s3 rm s3://igrishaev.public/foo --recursive
grep-github:
grep --no-filename -r --include="*.md" -o -E -i '(https://user-images.githubusercontent.com.+?(\.\w+))' . > urls.txt
wget-github:
wget -i urls.txt -x
# !\[(.*)\]\((https://user-images.githubusercontent.com/(.*?))\)
# {% include static.html path="$3" title="$1" %}
slug ?= $(error Please specify the slug=... argument)
post_date = $(shell date +'%Y-%m-%d')
new_file = _posts/${post_date}-${slug}.md
slug_dir = assets/static/aws/${slug}
new-post:
touch ${new_file}
echo '---' >> ${new_file}
echo 'layout: post' >> ${new_file}
echo 'title: ""' >> ${new_file}
echo "permalink: /${slug}/" >> ${new_file}
echo 'tags: programming' >> ${new_file}
echo '---' >> ${new_file}
echo '' >> ${new_file}
echo "{% include static.html path=\"${slug}/1.png\" %}" >> ${new_file}
mkdir -p ${slug_dir}
open ${slug_dir}