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
Pierre-Yves Chibon 9b7133
The doc repository is a simple git repo, whose content will appear under the
Pierre-Yves Chibon 5bdf0e
`Docs` tab in pagure and on https://docs.pagure.org/<project>/.</project>
Pierre-Yves Chibon 9b7133
Pierre-Yves Chibon 5bdf0e
There are a few ways you can put your documentation in this repo:
Pierre-Yves Chibon 9b7133
Pierre-Yves Chibon 9b7133
* Simple text files
Pierre-Yves Chibon 9b7133
Pierre-Yves Chibon 9b7133
Pagure will display them as plain text. If one of these is named ``index``
Pierre-Yves Chibon 9b7133
it will be presented as the front page.
Pierre-Yves Chibon 9b7133
Pierre-Yves Chibon 9b7133
* rst or markdown files
Pierre-Yves Chibon 9b7133
Pierre-Yves Chibon 9b7133
Pagure will convert them to html on the fly and display them as such.
Pierre-Yves Chibon 5bdf0e
The rst files must end with `.rst` and the markdown ones must end with
Pierre-Yves Chibon 5bdf0e
``.mk``, ``.md`` or simply ``.markdown``.
Pierre-Yves Chibon 9b7133
Pierre-Yves Chibon 9b7133
* html files
Pierre-Yves Chibon 9b7133
Pierre-Yves Chibon 9b7133
Pagure will simply show them as such.
Pierre-Yves Chibon 9b7133
Pierre-Yves Chibon 9b7133
Pierre-Yves Chibon 5bdf0e
.. note: By default the `Docs` tab in the project's menu is disabled, you
Pierre-Yves Chibon 5bdf0e
         will have to visit the project's settings page and turn it on
Pierre-Yves Chibon 5bdf0e
         in the ``Project options`` section.
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:>
Pierre-Yves Chibon 9b7133
`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