blob: 10d073bdc60bd87c6a18eaaf0a7c2e8adc6f6953 [file] [log] [blame]
John DeNisco06dcd452018-07-26 12:45:10 -04001.. _buildingrst:
2
3**********************
4Building VPP Documents
5**********************
6
7Overview
8========
9
10These instructions show how the VPP documentation sources are built.
11
12FD.io VPP Documentation uses `reStructuredText <http://www.sphinx-doc.org/en/master/usage/restructuredtext/index.html>`_ (rst) files, which are used by `Sphinx <http://www.sphinx-doc.org/en/master/>`_.
13We will also cover how to view your build on Read the Docs in `Using Read the Docs`_.
14
15
16To build your files, you can either `Create a Virtual Environment using virtualenv`_, which installs all the required applications for you, or you can `Install Sphinx manually`_.
17
18Create a Virtual Environment using virtualenv
19_____________________________________________
20
21For more information on how to use the Python virtual environment check out
22`Installing packages using pip and virtualenv`_.
23
24.. _`Installing packages using pip and virtualenv`: https://packaging.python.org/guides/installing-using-pip-and-virtualenv/
25
26Get the Documents
27^^^^^^^^^^^^^^^^^
28
29For example start with a clone of the vpp-docs.
30
31.. code-block:: console
32
33 $ git clone https://gerrit.fd.io/r/vpp
34 $ cd vpp
35
36
37Install the virtual environment
38^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
39
javierfernandezvalles7d84c162018-08-09 08:54:55 -070040In the vpp root directory on your system, run:
John DeNisco06dcd452018-07-26 12:45:10 -040041
42.. code-block:: console
43
44 $ python -m pip install --user virtualenv
45 $ python -m virtualenv env
46 $ source env/bin/activate
47 $ pip install -r docs/etc/requirements.txt
48 $ cd docs
49
50Which installs all the required applications into it's own, isolated, virtual environment, so as to not
51interfere with other builds that may use different versions of software.
52
53Build the html files
54^^^^^^^^^^^^^^^^^^^^
55
56Be sure you are in your vpp-docs/docs directory, since that is where Sphinx will look for your **conf.py**
57file, and build the **.rst** files into an **index.html** file:
58
59.. code-block:: console
60
61 $ make html
62
63View the results
64^^^^^^^^^^^^^^^^
65
66| If there are no errors during the build process, you should now have an **index.html** file in your
67| **vpp/docs/_build/html** directory, which you can then view in your browser.
68
69.. figure:: /_images/htmlBuild.png
70 :alt: Figure: My directory containing the index.html file
71 :scale: 35%
72 :align: center
73
74Whenever you make changes to your **.rst** files that you want to see, repeat this build process.
75
76.. note::
77
78 To exit from the virtual environment execute:
79
80.. code-block:: console
81
82 $ deactivate
83
84
85Install Sphinx manually
86_______________________
87
88Skip this step if you created a *virtualenv* in the previous step. If you dont want to create a *virtualenv*, you should install Sphinx `here <http://www.sphinx-doc.org/en/master/usage/installation.html>`_, and follow their `getting started guide <http://www.sphinx-doc.org/en/master/usage/quickstart.html>`_.
89
90Building these files will generate an **index.html** file, which you can then view in your browser to verify and see your file changes.
91
92
93To *build* your files, make sure you're in your **vpp-docs/docs** directory, where your **conf.py** file is located, and run:
94
95.. code-block:: console
96
97 $ make html
98
99
100| If there are no errors during the build process, you should now have an **index.html** file in your
101| **vpp-docs/docs/_build/html** directory, which you can then view in your browser.
102
103.. figure:: /_images/htmlBuild.png
104 :scale: 35%
105 :align: center
106
107Whenever you make changes to your **.rst** files that you want to see, repeat this build process.
108
109
110Using Read the Docs
111___________________
112
113`Read the Docs <https://readthedocs.org/>`_ is a website that "simplifies software documentation by automating building, versioning, and hosting of your docs for you". Essentially, it accesses your Github repo to generate the **index.html** file, and then displays it on its own *Read the Docs* webpage so others can view your documentation.
114
115Create an account on *Read the Docs* if you haven't already.
116
117Go to your `dashboard <https://readthedocs.org/dashboard/>`_ , and click on "Import a Project".
118
119.. figure:: /_images/importReadDocs.png
120 :scale: 35%
121 :align: left
122
123 This will bring you to a page where you can choose to import a repo from your Github account (only if you've linked your Github account to your Read the Docs account), or to import a repo manually. In this example, we'll do it manually. Click "Import Manually".
124
125|
126|
127|
128|
129|
130|
131|
132
133
134
135This will bring you to a page that asks for your repo details. Set "Name" to your forked repo name, or whatever you want. Set "Repository URL" to the URL of your forked repo (https://github.com/YOURUSERNAME/vpp-docs). "Repository type" should already be selected to "Git". Then click "Next".
136
137
138.. figure:: /_images/importRTDManually.png
139 :scale: 35%
140 :align: left
141
142|
143|
144|
145|
146|
147|
148|
149|
150|
151|
152|
153|
154|
155|
156|
157|
158|
159|
160|
161|
162|
163|
164|
165
166
167This will bring you to a project page of your repo on Read the Docs. You can confirm it's the correct repo by checking on the right side of the page the Repository URL.
168
169Then click on "Build Version".
170
171.. figure:: /_images/buildVerRTD.png
172 :scale: 35%
173 :align: left
174
175|
176|
177|
178|
179|
180|
181|
182|
183|
184|
185|
186|
187|
188|
189|
190|
191|
192|
193|
194|
195|
196|
197|
198
199Which takes you to another page showing your recent builds.
200
201Then click on "Build Version:". This should "Trigger" a build. After about a minute or so you can refresh the page and see that your build "Passed".
202
203
204.. figure:: /_images/passedBuild.png
205 :scale: 35%
206 :align: left
207
208
209|
210|
211|
212|
213|
214|
215|
216|
217|
218|
219|
220|
221|
222|
223|
224|
225|
226|
227|
228|
229|
230
231
232Now on your builds page from the previous image, you can click "View Docs" at the top-right, which will take you a *readthedocs.io* page of your generated build!
233
234.. figure:: /_images/rtdWebpage.png
235 :scale: 30%
236 :align: left