Skip to content

Commit bee824d

Browse files
committed
docs: add infrastructure taken from the Vunit main project
1 parent f39466b commit bee824d

File tree

8 files changed

+184
-0
lines changed

8 files changed

+184
-0
lines changed

.github/build_docs.py

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# This Source Code Form is subject to the terms of the Mozilla Public
2+
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
3+
# You can obtain one at http://mozilla.org/MPL/2.0/.
4+
#
5+
# Copyright (c) 2014-2021, Lars Asplund [email protected]
6+
7+
"""
8+
Command line utility to build documentation/website
9+
"""
10+
11+
from subprocess import check_call
12+
from pathlib import Path
13+
import sys
14+
from sys import argv
15+
from shutil import copyfile
16+
17+
18+
DROOT = Path(__file__).parent.parent / 'docs'
19+
20+
21+
def get_theme(path: Path, url: str):
22+
"""
23+
Check if the theme is available locally, retrieve it with curl and tar otherwise
24+
"""
25+
tpath = path / "_theme"
26+
if not tpath.is_dir() or not (tpath / "theme.conf").is_file():
27+
if not tpath.is_dir():
28+
tpath.mkdir()
29+
zpath = path / "theme.tgz"
30+
if not zpath.is_file():
31+
check_call(["curl", "-fsSL", url, "-o", str(zpath)])
32+
tar_cmd = ["tar", "--strip-components=1", "-C", str(tpath), "-xvzf", str(zpath)]
33+
check_call(tar_cmd)
34+
35+
36+
def main():
37+
"""
38+
Build documentation/website
39+
"""
40+
get_theme(
41+
DROOT,
42+
"https://codeload.github.com/buildthedocs/sphinx.theme/tar.gz/v0"
43+
)
44+
check_call(
45+
[
46+
sys.executable,
47+
"-m",
48+
"sphinx"
49+
] + ([] if len(argv) < 2 else argv[2:]) + [
50+
"-TEWanb",
51+
"html",
52+
Path(__file__).parent.parent / "docs",
53+
argv[1],
54+
]
55+
)
56+
57+
58+
if __name__ == "__main__":
59+
main()

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/docs/_build
2+
/docs/_theme
3+
*.tgz

docs/_static/VUnit_logo_175x175.png

12.4 KB
Loading

docs/_static/VUnit_logo_420x420.png

19.3 KB
Loading

docs/_static/vunit.ico

2.19 KB
Binary file not shown.

docs/_static/vunit.svg

+10
Loading

docs/conf.py

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# -*- coding: utf-8 -*-
2+
3+
import os
4+
import sys
5+
from pathlib import Path
6+
7+
# -- Sphinx Options -----------------------------------------------------------
8+
9+
# If your project needs a minimal Sphinx version, state it here.
10+
needs_sphinx = "3.0"
11+
12+
extensions = [
13+
"sphinx.ext.autodoc",
14+
"sphinx.ext.extlinks",
15+
"sphinx.ext.intersphinx",
16+
"sphinx.ext.todo",
17+
"sphinxarg.ext", # Automatic argparse command line argument documentation
18+
]
19+
20+
autodoc_default_options = {
21+
"members": True,
22+
}
23+
24+
# The suffix(es) of source filenames.
25+
source_suffix = {
26+
".rst": "restructuredtext",
27+
# '.txt': 'markdown',
28+
# '.md': 'markdown',
29+
}
30+
31+
master_doc = "index"
32+
33+
project = u"Introduction to TDD and CI With VUnit"
34+
copyright = u"2014-2021, Lars Asplund"
35+
author = u"LarsAsplund, kraigher and contributors"
36+
37+
version = ""
38+
release = ""
39+
40+
language = None
41+
42+
exclude_patterns = []
43+
44+
pygments_style = "sphinx"
45+
46+
todo_include_todos = False
47+
48+
# -- Options for HTML output ----------------------------------------------
49+
50+
html_theme_path = ["."]
51+
html_theme = "_theme"
52+
53+
html_theme_options = {
54+
"analytics_id": "UA-abcdefghi-j",
55+
"logo_only": True,
56+
"vcs_pageview_mode": "blob",
57+
"style_nav_header_background": "#0c479d",
58+
"home_breadcrumbs": False,
59+
}
60+
html_context = {
61+
"conf_py_path": "%s/" % Path(__file__).parent.name,
62+
"display_github": True,
63+
"github_user": "VUnit",
64+
"github_repo": "vunit",
65+
"github_version": "master/",
66+
}
67+
68+
html_static_path = ["_static"]
69+
70+
html_logo = str(Path(html_static_path[0]) / "VUnit_logo_175x175.png")
71+
72+
html_favicon = str(Path(html_static_path[0]) / "vunit.ico")
73+
74+
# Output file base name for HTML help builder.
75+
htmlhelp_basename = "VUnitDoc"
76+
77+
# -- InterSphinx ----------------------------------------------------------
78+
79+
intersphinx_mapping = {
80+
"python": ("https://docs.python.org/3.8/", None),
81+
}
82+
83+
# -- ExtLinks -------------------------------------------------------------
84+
85+
extlinks = {
86+
"vunit_example": ("https://github.com/VUnit/vunit/tree/master/examples/%s/", ""),
87+
"vunit_file": ("https://github.com/VUnit/vunit/tree/master/%s/", ""),
88+
"vunit_commit": ("https://github.com/vunit/vunit/tree/%s/", "@"),
89+
"vunit_issue": ("https://github.com/VUnit/vunit/issues/%s/", "#"),
90+
}

docs/index.rst

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
.. centered:: |shieldRepo|_ |shieldGitter|_ |shieldTwitter|_
3+
4+
.. |shieldRepo| image:: https://img.shields.io/badge/VUnit/vunit-0c479d.svg?longCache=true&style=flat-square&logo=github
5+
.. _shieldRepo: https://github.com/VUnit/tdd-intro
6+
7+
.. |shieldGitter| image:: https://img.shields.io/gitter/room/VUnit/vunit.svg?longCache=true&style=flat-square&logo=gitter&logoColor=4db797&color=4db797
8+
.. _shieldGitter: https://gitter.im/VUnit/vunit
9+
10+
.. |shieldTwitter| image:: https://img.shields.io/twitter/follow/VUnitFramework.svg?longCache=true&style=flat-square&color=1DA1F2&label=%40VUnitFramework&logo=twitter&logoColor=fff
11+
.. _shieldTwitter: https://www.twitter.com/VUnitFramework
12+
13+
Introduction to Test-Driven Development and Continuous Integration With VUnit
14+
=============================================================================
15+
16+
.. toctree::
17+
:caption: TDD tutorial
18+
:hidden:
19+
20+
.. toctree::
21+
:caption: CI tutorial
22+
:hidden:

0 commit comments

Comments
 (0)