forked from gluetool/gluetool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate-docs.yml
65 lines (58 loc) · 1.76 KB
/
generate-docs.yml
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
---
- hosts: localhost
vars:
sphinx_builder: html
generate_dir: ./docs
log_path: "{{ generate_dir }}/build/sphinx_build_stderr.log"
clean: false
static_rst:
- source/framework.rst
- source/modules.rst
- source/howto-tests.rst
- source/howto-docs.rst
- source/index.rst
- source/DEVELOPMENT.rst
base_files:
- source/conf.py
clean_files:
- build
- source/gluetool.*
tasks:
- name: Ensure directory hierarchy exists
file:
path: "{{ item }}"
state: directory
with_items:
- "{{ generate_dir }}/"
- "{{ generate_dir }}/source/"
- name: "Clean doc in '{{ generate_dir }}'"
shell: rm -rf {{ generate_dir }}/{{ item }}
args:
removes: "{{ generate_dir }}/{{ item }}"
when: clean
with_items: "{{ clean_files }}"
tags:
- clean
- name: Copy static_rst files
copy:
src: "docs/{{ item }}"
dest: "{{ generate_dir }}/{{ item }}"
with_items: "{{ static_rst }}"
- name: Copy base files
copy:
src: "docs/{{ item }}"
dest: "{{ generate_dir }}/{{ item }}"
with_items: "{{ base_files }}"
- name: Generate apidoc
command: sphinx-apidoc -T -e -o "{{ generate_dir }}/source/" gluetool/
- name: Generate documentation
command: sphinx-build -M "{{ sphinx_builder }}" source build
register: sphinx_build
args:
chdir: "{{ generate_dir }}"
- name: "Create error log file {{log_path}}"
copy:
content: "{{ sphinx_build.stderr }}"
dest: "{{ log_path }}"
- name: "Check log file for errors"
command: awk '/ERROR:/ { print "Errors were detected, check log file and your docs"; exit 1; }' "{{ log_path }}"