Larry Peterson | 8014352 | 2018-06-28 10:43:40 -0700 | [diff] [blame] | 1 | # Makefile for building CORD docs site, guide.opencord.org |
| 2 | # Building docs requires the following tools: |
| 3 | # - Gitbook toolchain: https://toolchain.gitbook.com/setup.html |
| 4 | # - NPM (for Gitbook and Swagger) |
| 5 | # - Python (for build glossary script) |
| 6 | # - linkchecker (for test target) http://wummel.github.io/linkchecker/ |
Zack Williams | da8a5d8 | 2017-09-08 12:45:14 -0700 | [diff] [blame] | 7 | |
Larry Peterson | 8014352 | 2018-06-28 10:43:40 -0700 | [diff] [blame] | 8 | default: serve |
Matteo Scandolo | 431781c | 2017-09-06 15:33:07 -0700 | [diff] [blame] | 9 | |
Larry Peterson | 8014352 | 2018-06-28 10:43:40 -0700 | [diff] [blame] | 10 | # use bash for pushd/popd, and to fail if commands within a pipe fail |
| 11 | SHELL = bash -o pipefail |
Zack Williams | da8a5d8 | 2017-09-08 12:45:14 -0700 | [diff] [blame] | 12 | |
Larry Peterson | 8014352 | 2018-06-28 10:43:40 -0700 | [diff] [blame] | 13 | GENERATED_DOCS = |
Matteo Scandolo | 431781c | 2017-09-06 15:33:07 -0700 | [diff] [blame] | 14 | |
Larry Peterson | 8014352 | 2018-06-28 10:43:40 -0700 | [diff] [blame] | 15 | LINT_STYLE ?= mdl_relaxed.rb |
Zack Williams | 6c78f91 | 2018-06-21 10:56:24 -0700 | [diff] [blame] | 16 | |
Larry Peterson | 8014352 | 2018-06-28 10:43:40 -0700 | [diff] [blame] | 17 | serve: setup |
| 18 | gitbook serve |
Matteo Scandolo | 431781c | 2017-09-06 15:33:07 -0700 | [diff] [blame] | 19 | |
Larry Peterson | 8014352 | 2018-06-28 10:43:40 -0700 | [diff] [blame] | 20 | build: setup |
| 21 | gitbook build |
Zack Williams | da8a5d8 | 2017-09-08 12:45:14 -0700 | [diff] [blame] | 22 | |
Larry Peterson | 5adc6e9 | 2018-07-02 13:45:38 -0700 | [diff] [blame] | 23 | setup: xos-gui xos-tosca kubernetes openstack onos simpleexampleservice exampleservice |
Larry Peterson | 8014352 | 2018-06-28 10:43:40 -0700 | [diff] [blame] | 24 | gitbook init |
| 25 | gitbook install |
Matteo Scandolo | 431781c | 2017-09-06 15:33:07 -0700 | [diff] [blame] | 26 | |
Larry Peterson | 8014352 | 2018-06-28 10:43:40 -0700 | [diff] [blame] | 27 | test: linkcheck lint |
| 28 | |
| 29 | linkcheck: build |
| 30 | linkchecker -a _book/ |
| 31 | |
| 32 | lint: |
| 33 | @echo "markdownlint(mdl) version: `mdl --version`" |
| 34 | @echo "style config:" |
| 35 | @echo "---" |
| 36 | @cat $(LINT_STYLE) |
| 37 | @echo "---" |
| 38 | mdl -s $(LINT_STYLE) `find -L . ! -path "./_book/*" ! -path "./node_modules/*" -name "*.md"` |
| 39 | |
| 40 | # link directories that contain other documentation |
| 41 | xos-gui: |
| 42 | ln -s ../../xos-gui/docs xos-gui |
| 43 | |
| 44 | xos-tosca: |
| 45 | ln -s ../../xos-tosca/docs xos-tosca |
| 46 | |
Larry Peterson | 5adc6e9 | 2018-07-02 13:45:38 -0700 | [diff] [blame] | 47 | kubernetes: |
Larry Peterson | 63cf726 | 2018-07-05 14:55:17 -0700 | [diff] [blame^] | 48 | ln -s ../../xos-services/kubernetes-service/docs kubernetes |
Larry Peterson | 5adc6e9 | 2018-07-02 13:45:38 -0700 | [diff] [blame] | 49 | |
| 50 | openstack: |
Larry Peterson | 63cf726 | 2018-07-05 14:55:17 -0700 | [diff] [blame^] | 51 | ln -s ../../xos-services/openstack/docs openstack |
Larry Peterson | 5adc6e9 | 2018-07-02 13:45:38 -0700 | [diff] [blame] | 52 | |
| 53 | onos: |
Larry Peterson | 63cf726 | 2018-07-05 14:55:17 -0700 | [diff] [blame^] | 54 | ln -s ../../xos-services/onos-service/docs onos |
Larry Peterson | 5adc6e9 | 2018-07-02 13:45:38 -0700 | [diff] [blame] | 55 | |
| 56 | exampleservice: |
Larry Peterson | 63cf726 | 2018-07-05 14:55:17 -0700 | [diff] [blame^] | 57 | ln -s ../../xos-services/exampleservice/docs exampleservice |
Larry Peterson | 5adc6e9 | 2018-07-02 13:45:38 -0700 | [diff] [blame] | 58 | |
| 59 | simpleexampleservice: |
Larry Peterson | 63cf726 | 2018-07-05 14:55:17 -0700 | [diff] [blame^] | 60 | ln -s ../../xos-services/simpleexampleservice/docs simpleexampleservice |
Larry Peterson | 5adc6e9 | 2018-07-02 13:45:38 -0700 | [diff] [blame] | 61 | |
| 62 | |
Larry Peterson | b658e8b | 2018-06-29 09:21:16 -0700 | [diff] [blame] | 63 | # HOW TO |
| 64 | # - load the virtual env (https://guide.opencord.org/xos/dev/local_env.html) |
| 65 | # - run `make` |
| 66 | # - open the browser at `http://127.0.0.1:8080/ui` |
| 67 | # - you'll see the 'core' apis |
| 68 | # - you can see a list of available apis at `http://127.0.0.1:8080/specs/` |
| 69 | # - just replace the swagger file (top bar) with another one to see different APIs (to be improved) |
Larry Peterson | 8014352 | 2018-06-28 10:43:40 -0700 | [diff] [blame] | 70 | |
Larry Peterson | b658e8b | 2018-06-29 09:21:16 -0700 | [diff] [blame] | 71 | DOCSDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) |
| 72 | |
| 73 | swagger: swagger_clean swagger_docs swagger_serve_spec |
| 74 | |
| 75 | venv-xosdocs: |
| 76 | ./venv-xosdocs.sh |
| 77 | |
| 78 | swagger_docs: venv-xosdocs |
| 79 | bash -c 'source $(DOCSDIR)venv-xosdocs/bin/activate && python $(DOCSDIR)scripts/swagger_docs.py' |
| 80 | |
| 81 | swagger_clean: |
| 82 | rm -rf swagger/specs/* |
| 83 | |
| 84 | venv_clean: |
| 85 | rm -rf $(DOCSDIR)venv-xosdocs |
| 86 | |
| 87 | swagger_serve_spec: |
| 88 | http-server --cors ./swagger |
| 89 | |
| 90 | clean: swagger_clean venv_clean |
Larry Peterson | 8014352 | 2018-06-28 10:43:40 -0700 | [diff] [blame] | 91 | rm -rf $(GENERATED_DOCS) |
| 92 | rm -rf _book |
| 93 | rm -rf node_modules |
Larry Peterson | 5adc6e9 | 2018-07-02 13:45:38 -0700 | [diff] [blame] | 94 | rm -rf xos xos-gui xos-tosca kubernetes openstack onos simpleexampleservice exampleservice |