-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
50 lines (37 loc) · 1.06 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
.PHONY: server deploy clean new repos
print = @echo "=> $(1)"\
"\n-----------------------"
dasherize = $(shell echo $(strip $(1)) | tr ' [A-Z]-' '-[a-z]-')
createPost = $(shell sed 's/{TITLE}/$(strip $(2))/g' "blog/_template.md" > "blog/$(strip $(1)).md")
teste = $(shell bundle exec jekyll serve)
server:
$(call print, "Starting server")
$(call teste)
deploy:
make clean
$(call print, "Compile site")
npm run build
$(call print, "Copy not scanned files")
cp Makefile CNAME LICENSE README.md dist/
$(call print, "Checkout master branch")
git checkout master
$(call print, "Clean unwanted files and folders")
cp -r dist/* ./
make clean
$(call print, "Commit changes to master")
git add .
git commit -m ":rocket: deploy website"
git push origin master
$(call print, "Go back to source")
git checkout source
clean:
rm -rf dist > /dev/null
new:
ifeq ($(post),)
@echo Qual nome do novo post? Ex: make new post="Meu novo post"
else
$(call print, "Novo post: $(post)")
$(call createPost, $(call dasherize, $(post)), $(post))
endif
repos:
node _repos.js