-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile
66 lines (52 loc) · 2.66 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
help:
@echo "uptcex update tcex documentation"
@echo "clean clean unneeded files"
@echo "test run the tests"
@echo "upstream set upstream to https://github.com/ThreatConnect-Inc/threatconnect-developer-docs.git (useful when working on a fork of the TC docs)"
@echo "doctest run sphinx on the documentation to view errors"
today := $(shell date +"%B %d, %Y")
uptcex:
# This script is to be run in the top directory of the TC Documentation (available here: https://github.com/ThreatConnect-Inc/threatconnect-developer-docs)
rm -rf ./tcex/;
# clone the most recent commit to the master branch of the tcex repo into the ./tcex directory
git clone --depth 1 --branch master https://github.com/ThreatConnect-Inc/tcex.git;
# remove the .git directory of the recently cloned tcex repo
rm -rf ./tcex/.git/;
rm -rf ./tcex/.gitignore;
# remove all of the old tcex documentation files
rm -rf ./docs/tcex/*;
# move all of the .rst files from the tcex repo's documentation into this repo's documentation directory
mv ./tcex/docs/src/*.rst ./docs/tcex/;
# move all of the .inc files from the tcex repo's documentation into this repo's documentation directory
mv ./tcex/docs/src/*.inc ./docs/tcex/;
# move all of the tcex module documentation files into this repo's documentation directory
mv ./tcex/docs/src/tcex_docs/ ./docs/tcex/;
# rename the landing page for the tcex docs
mv ./docs/tcex/index.rst ./docs/tcex/tcex.rst;
# remove the docs directory
rm -rf ./tcex/docs;
# remove unused files
rm -f ./tcex/LICENSE ./tcex/README.md ./tcex/setup.cfg ./tcex/setup.py;
# change the variable name of the tcex version used in the tcex docs
sed -i.bak 's/|version|/|tcex_version|/g' ./docs/tcex/tcex.rst && rm ./docs/tcex/tcex.rst.bak;
# stage all changes (including deletions)
git add -A;
# commit
git commit -m "Auto-update TCEX docs: $(today)";
clean:
# This script is to be run in the top directory of the TC Documentation (available here: https://github.com/ThreatConnect-Inc/threatconnect-developer-docs)
rm -rf ./.cache/
rm -rf ./tests/__pycache__/
rm -rf ./tests/test.py
rm -rf ./docs/_build/
test:
# run the tests and remove the junk created by the tests
pytest;
rm -rf ./tests/__pycache__/;
rm -rf ./tests/test.py;
upstream:
# set upstream for a clone of this repo
git remote add upstream https://github.com/ThreatConnect-Inc/threatconnect-developer-docs.git;
git remote -v;
doctest:
cd docs && virtualenv ~/.venv/tc_developer_docs && source ~/.venv/tc_developer_docs/bin/activate && pip install sphinx && pip install recommonmark && pip install tcex && pip install sphinx_rtd_theme && sphinx-build -T -E -d _build/doctrees-readthedocs -D language=en . _build/html