Skip to content

Commit 879a300

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

File tree

8 files changed

+175
-0
lines changed

8 files changed

+175
-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

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
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.extlinks",
14+
"sphinx.ext.intersphinx",
15+
"sphinx.ext.todo",
16+
"sphinxarg.ext", # Automatic argparse command line argument documentation
17+
]
18+
19+
# The suffix(es) of source filenames.
20+
source_suffix = {
21+
".rst": "restructuredtext"
22+
}
23+
24+
master_doc = "index"
25+
26+
project = u"Introduction to TDD and CI With VUnit"
27+
copyright = u"2014-2021, Lars Asplund"
28+
author = u"LarsAsplund and contributors"
29+
30+
version = ""
31+
release = ""
32+
33+
language = None
34+
35+
exclude_patterns = []
36+
37+
pygments_style = "sphinx"
38+
39+
todo_include_todos = False
40+
41+
# -- Options for HTML output ----------------------------------------------
42+
43+
html_theme_path = ["."]
44+
html_theme = "_theme"
45+
46+
html_theme_options = {
47+
"analytics_id": "UA-abcdefghi-j",
48+
"logo_only": True,
49+
"vcs_pageview_mode": "blob",
50+
"style_nav_header_background": "#0c479d",
51+
"home_breadcrumbs": False,
52+
}
53+
html_context = {
54+
"conf_py_path": "%s/" % Path(__file__).parent.name,
55+
"display_github": True,
56+
"github_user": "VUnit",
57+
"github_repo": "vunit",
58+
"github_version": "master/",
59+
}
60+
61+
html_static_path = ["_static"]
62+
63+
html_logo = str(Path(html_static_path[0]) / "VUnit_logo_175x175.png")
64+
65+
html_favicon = str(Path(html_static_path[0]) / "vunit.ico")
66+
67+
# Output file base name for HTML help builder.
68+
htmlhelp_basename = "VUnitDoc"
69+
70+
# -- InterSphinx ----------------------------------------------------------
71+
72+
intersphinx_mapping = {
73+
"ghdl": ("https://ghdl.github.io/ghdl", None),
74+
"python": ("https://docs.python.org/3.8/", None),
75+
"vunit": ("https://vunit.github.io", None),
76+
}
77+
78+
# -- ExtLinks -------------------------------------------------------------
79+
80+
extlinks = {
81+
"vunit_example": ("https://github.com/VUnit/vunit/tree/master/examples/%s/", ""),
82+
"vunit_file": ("https://github.com/VUnit/vunit/tree/master/%s/", ""),
83+
"vunit_commit": ("https://github.com/vunit/vunit/tree/%s/", "@"),
84+
"vunit_issue": ("https://github.com/VUnit/vunit/issues/%s/", "#"),
85+
}

docs/index.rst

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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: Tutorial
18+
:hidden:

0 commit comments

Comments
 (0)