forked from oubiwann/lxml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
101 lines (82 loc) · 2.91 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
PROJECT = lxml
ROOT_DIR = $(shell pwd)
REPO = $(shell git config --get remote.origin.url)
LFE = _build/default/lib/lfe/bin/lfe
DOCS_DIR = $(ROOT_DIR)/docs
GUIDE_DIR = $(DOCS_DIR)/user-guide
GUIDE_BUILD_DIR = $(GUIDE_DIR)/build
DOCS_PROD_DIR = $(DOCS_DIR)/gh-pages
SUBMODULE_DOCS = docs/gh-pages
GUIDE_PROD_DIR = $(DOCS_PROD_DIR)/current/user-guide
LOCAL_DOCS_HOST = localhost
LOCAL_DOCS_PORT = 5099
DOCKER_IMG = lfex/slate:2.10.0-ruby2.6
compile:
rebar3 compile
check:
@rebar3 as test lfe ltest -tall
repl: compile
rebar3 lfe repl
shell:
@rebar3 shell
clean:
@rebar3 clean
@rm -rf ebin/* _build/default/lib/$(PROJECT)
clean-all: clean
@rebar3 lfe clean
build-slate-image:
@echo "\nBuilding Slate ..."
@git clone [email protected]:lfe-support/slate.git
@cd slate && make image
$(DOCS_PROD_DIR):
git submodule add -b gh-pages `git remote get-url --push origin` $(SUBMODULE_DOCS)
gh-pages: $(DOCS_PROD_DIR)
docs-setup:
@echo "\nInstalling and setting up dependencies ..."
@docker pull $(DOCKER_IMG)
docs-clean:
@echo "\nCleaning build directories ..."
@rm -rf $(GUIDE_BUILD_DIR) $(GUIDE_PROD_DIR)
docs-slate:
@echo
@cd $(GUIDE_DIR) && docker run \
-i \
-p 4567:4567 \
-v `pwd`/build:/srv/slate/build \
-v `pwd`/source/index.html.md:/srv/slate/source/index.html.md \
-v `pwd`/source/includes:/srv/slate/source/includes \
-v `pwd`/source/images:/srv/slate/source/images \
-v `pwd`/source/stylesheets/_variables.scss:/srv/slate/source/stylesheets/_variables.scss \
-t $(DOCKER_IMG)
@mkdir $(GUIDE_PROD_DIR)
@cp -r $(GUIDE_BUILD_DIR)/* $(GUIDE_PROD_DIR)/
docs: clean docs-clean compile
@echo "\nBuilding docs ..."
@make docs-slate
devdocs: docs
@echo
@echo "Running docs server on http://$(LOCAL_DOCS_HOST):$(LOCAL_DOCS_PORT) ... (To quit, hit ^c twice)"
@echo
@erl -s inets -noshell -eval 'inets:start(httpd,[{server_name,"devdocs"},{document_root, "$(DOCS_PROD_DIR)"},{server_root, "$(DOCS_PROD_DIR)"},{port, $(LOCAL_DOCS_PORT)},{mime_types,[{"html","text/html"},{"htm","text/html"},{"js","text/javascript"},{"css","text/css"},{"gif","image/gif"},{"jpg","image/jpeg"},{"jpeg","image/jpeg"},{"png","image/png"}]}]).'
setup-temp-repo:
@echo "\nSetting up temporary git repos for gh-pages ...\n"
@rm -rf $(DOCS_PROD_DIR)/.git $(DOCS_PROD_DIR)/*/.git
@cd $(DOCS_PROD_DIR) && git init
@cd $(DOCS_PROD_DIR) && git add * > /dev/null
@cd $(DOCS_PROD_DIR) && git commit -a -m "Generated content." > /dev/null
teardown-temp-repo:
@echo "\nTearing down temporary gh-pages repos ..."
@rm $(DOCS_DIR)/.git $(GUIDE_DIR)/Gemfile.lock
@rm -rf $(DOCS_PROD_DIR)/.git $(DOCS_PROD_DIR)/*/.git
publish-docs: docs setup-temp-repo
@echo "\nPublishing docs ...\n"
@cd $(DOCS_PROD_DIR) && git push -f $(REPO) master:gh-pages
@make teardown-temp-repo
.PHONY: docs
hex-publish:
@echo "\nPublishing to hex.pm ...\n"
rm -rf doc
mkdir doc
cp priv/html/docs-redirect.html doc/index.html
rebar3 hex publish
rm -rf doc