-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathMakefile
56 lines (47 loc) · 1.5 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
UPSTREAM ?= upstream
default: clean view
.PHONY: build
build: site site/d3-chart/api site/dataset/api site/storyboard/api
site:
bundle exec staticmatic build .
cp -R src/* site
view: build
bundle exec staticmatic preview .
node_modules: package.json
npm install
@touch package.json node_modules
site/%/api : projects/% node_modules
$(eval commit=$(word 1, $(shell git submodule status $<)))
$(eval name=$(subst -,.,$(notdir $<)))
$(eval srcUrl=https://github.com/misoproject/$(name))
$(eval srcFileUrl=$(srcUrl)/blob/$(commit)/src/{{ fileName }})
$(eval srcLineUrl=$(srcFileUrl)\#L{{ lineNumber }})
$(eval exDir=$</examples/api)
mkdir -p $@
./node_modules/.bin/jsdoc $</src \
--destination $@ \
--template ./node_modules/miso-jsdoc-template/src \
--configure ./jsdoc-config.json \
--query "[email protected]&externalExBase=$(exDir)&sourceUrl=$(srcUrl)&sourceFileUrl=$(srcFileUrl)&sourceLineUrl=$(srcLineUrl)" \
.PHONY: clean
clean:
rm -rf site
.PHONY: check_working_dir
.SILENT: check_working_dir
check_working_dir:
if [ -n "`git status --porcelain`" ]; then\
echo "Untracked changes in working directory. Stash or commit them before deploying.";\
exit 1;\
fi
.PHONY: deploy
deploy: check_working_dir clean build
git checkout -B master
# Keep untracked files and .gitignore
git ls-files -z * | xargs -0 git rm
mv site/* .
# Prevent GitHub from attempting to build the site with Jekyll
touch .nojekyll
git add .
git commit -m "Deploy site"
git push --force ${UPSTREAM} master
git checkout -