Blame doc/usage/using_doc.rst

Pierre-Yves Chibon 9b7133
Using the doc repository of your project
Pierre-Yves Chibon 9b7133
========================================
Pierre-Yves Chibon 9b7133
Pierre-Yves Chibon 5bdf0e
In this section of the documentation, we are interested in the doc repository.
Pierre-Yves Chibon 9b7133
René Genz bf835a
The doc repository is a simple Git repo. It can be displayed as a subfolder
René Genz bf835a
of a project or as a dedicated Git repo.
René Genz bf835a
Either way its content can be displayed in 2 ways:
Pierre-Yves Chibon 9b7133
René Genz dadd94
* inline under the `Docs` tab in Pagure:
Pierre-Yves Chibon 9b7133
René Genz bf835a
  * https://pagure.io/docs/<project>/ or</project>
Pierre-Yves Chibon 9b7133
René Genz bf835a
  * https://pagure.io/docs/<namespace>/<project>/</project></namespace>
Pierre-Yves Chibon 9b7133
René Genz dadd94
* standalone:
Pierre-Yves Chibon 9b7133
René Genz bf835a
  * https://docs.pagure.org/<project>/ or</project>
Pierre-Yves Chibon 9b7133
René Genz bf835a
  * https://docs.pagure.org/<namespace>.<project>/</project></namespace>
Pierre-Yves Chibon 9b7133
Pierre-Yves Chibon 9b7133
René Genz dadd94
By default the `Docs` tab in the project's menu is disabled, you
René Genz dadd94
will have to visit the project's settings page and turn it on
René Genz dadd94
in the ``Project options`` section.
Pierre-Yves Chibon 9b7133
René Genz dadd94
René Genz bf835a
The URL to clone the doc repo is:
René Genz dadd94
René Genz bf835a
* https://pagure.io/docs/<namespace>/<project>.git</project></namespace>
René Genz bf835a
René Genz bf835a
René Genz bf835a
To view the doc source files in the browser:
René Genz bf835a
René Genz bf835a
* if the doc repo is kept in the project's sources, use the project's website
René Genz bf835a
René Genz bf835a
* if the doc repo is a dedicated repo, use https://pagure.io/<namespace>/<name></name></namespace>
René Genz dadd94
René Genz dadd94
René Genz dadd94
Different file types can be used for your documentation in this repo:
René Genz dadd94
René Genz dadd94
* simple text files
René Genz dadd94
René Genz dadd94
  Pagure will display them as plain text. If one of these is named ``index``
René Genz dadd94
  it will be presented as the front page.
René Genz dadd94
René Genz dadd94
* RST or markdown files
René Genz dadd94
René Genz dadd94
  Pagure will convert them to HTML on the fly and display them as such.
René Genz dadd94
  The RST files must end with ``.rst`` and the markdown ones must end with
René Genz dadd94
  ``.mk``, ``.md`` or simply ``.markdown``.
René Genz dadd94
René Genz dadd94
* HTML files
René Genz dadd94
René Genz dadd94
  Pagure will simply show them as such.
René Genz dadd94
René Genz dadd94
Updating documentation hosted in a dedicated repo is like
René Genz dadd94
`using other repos <https: docs.pagure.org="" forks.html="" pagure="" usage="">`_.</https:>
Pierre-Yves Chibon e9515f
Pierre-Yves Chibon e9515f
Pierre-Yves Chibon 9b7133
Example
Pierre-Yves Chibon 9b7133
-------
Pierre-Yves Chibon 9b7133
Pierre-Yves Chibon 9b7133
Pagure's documentation is kept in pagure's sources, in the `doc` folder there.
Pierre-Yves Chibon 9b7133
You can see it at: `https://pagure.io/pagure/blob/master/f/doc
Pierre-Yves Chibon 9b7133
<https: blob="" doc="" f="" master="" pagure="" pagure.io="">`_. This doc can be built with</https:>
René Genz dadd94
`Sphinx <http: sphinx-doc.org="">`_ to make it HTML and prettier.</http:>
Pierre-Yves Chibon 9b7133
Pierre-Yves Chibon 5bdf0e
The built documentation is available at: `https://docs.pagure.org/pagure/
Pierre-Yves Chibon 9b7133
<https: docs.pagure.org="" pagure="">`_.</https:>
Pierre-Yves Chibon 9b7133
Pierre-Yves Chibon 5bdf0e
This is how it is built/updated:
Pierre-Yves Chibon 9b7133
Pierre-Yves Chibon 9b7133
* Clone pagure's sources::
Pierre-Yves Chibon 9b7133
Aleksandra Fedorova (bookwar) 059356
    git clone https://pagure.io/pagure.git
Pierre-Yves Chibon 9b7133
Pierre-Yves Chibon 9b7133
* Move into its doc folder::
Pierre-Yves Chibon 9b7133
Pierre-Yves Chibon 9b7133
    cd pagure/doc
Pierre-Yves Chibon 9b7133
Pierre-Yves Chibon 9b7133
* Build the doc::
Pierre-Yves Chibon 9b7133
Pierre-Yves Chibon 9b7133
    make html
Pierre-Yves Chibon 9b7133
Pierre-Yves Chibon 9b7133
* Clone pagure's doc repository::
Pierre-Yves Chibon 9b7133
Pierre-Yves Chibon 9b7133
    git clone ssh://git@pagure.io/docs/pagure.git
Pierre-Yves Chibon 9b7133
Pierre-Yves Chibon 9b7133
* Copy the result of sphinx's build to the doc repo::
Pierre-Yves Chibon 9b7133
Pierre-Yves Chibon 9b7133
    cp -r _build/html/* pagure/
Pierre-Yves Chibon 9b7133
Pierre-Yves Chibon 9b7133
* Go into the doc repo and update it::
Pierre-Yves Chibon 9b7133
Pierre-Yves Chibon 9b7133
    cd pagure
Pierre-Yves Chibon 9b7133
    git add .
Pierre-Yves Chibon 9b7133
    git commit -am "Update documentation"
Pierre-Yves Chibon 9b7133
    git push
Pierre-Yves Chibon 9b7133
Pierre-Yves Chibon 9b7133
* Clean the sources::
Pierre-Yves Chibon 9b7133
Pierre-Yves Chibon 9b7133
    cd ..
Pierre-Yves Chibon 9b7133
    rm -rf pagure  # remove the doc repo
Pierre-Yves Chibon 9b7133
    rm -rf _build  # remove the output from the sphinx's build
Pierre-Yves Chibon 9b7133
Pierre-Yves Chibon 9b7133
Pierre-Yves Chibon 9b7133
To make things simpler, the following script (name `update_doc.sh`) can be
Pierre-Yves Chibon 9b7133
used:
Pierre-Yves Chibon 9b7133
Pierre-Yves Chibon 9b7133
::
Pierre-Yves Chibon 9b7133
Pierre-Yves Chibon 9b7133
    #!/bin/bash
Pierre-Yves Chibon 9b7133
Pierre-Yves Chibon 9b7133
    make html
Pierre-Yves Chibon 9b7133
Pierre-Yves Chibon 9b7133
    git clone "ssh://git@pagure.io/docs/$1.git"
Pierre-Yves Chibon 9b7133
    cp -r _build/html/* $1/
Pierre-Yves Chibon 111849
    (
Pierre-Yves Chibon 111849
        cd $1
Pierre-Yves Chibon 9a4323
        git add .
Pierre-Yves Chibon 111849
        git commit -av
Pierre-Yves Chibon 111849
        git push
Pierre-Yves Chibon 111849
    )
Pierre-Yves Chibon 9b7133
Pierre-Yves Chibon 9b7133
    rm -rfI _build
Pierre-Yves Chibon 9b7133
    rm -rfI $1
Pierre-Yves Chibon 9b7133
Pierre-Yves Chibon 9b7133
It can be used by running `update_doc.sh <project>` from within the folder</project>
Pierre-Yves Chibon 9b7133
containing the doc.
Pierre-Yves Chibon 9b7133
Pierre-Yves Chibon 9b7133
So for pagure it would be something like:
Pierre-Yves Chibon 9b7133
Pierre-Yves Chibon 9b7133
::
Pierre-Yves Chibon 9b7133
Pierre-Yves Chibon 9b7133
    cd pagure/doc
Pierre-Yves Chibon 9b7133
    update_doc.sh pagure