Skip to content

Commit 9f3d9e1

Browse files
committed
Start providing some documentation using Sphinx
1 parent f88789f commit 9f3d9e1

File tree

13 files changed

+819
-0
lines changed

13 files changed

+819
-0
lines changed

docs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_build

docs/Creating a contest.rst

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Creating a contest
2+
******************
3+
4+
Creating a contest from scratch
5+
===============================
6+
7+
The most immediate (and less practical) way to create a contest in CMS is using the admin interface. You can start the AdminWebServer using the command ``cmsAdminWebServer``.
8+
9+
After that, you can connect to the server using the address and port specified in :file:`cms.conf`; typically, http://localhost:8889/.
10+
11+
Here, you can create a contest clicking the "+" next to the drop down on the left. After that, you must add the tasks and the users. Up to now, each of these operations are manual; plus, it is usually more practical to work, for example, on a file specifying the contestants' details instead of using the web interface.
12+
13+
Luckily, there is another way to create a contest.
14+
15+
16+
Creating a contest from the filesystem
17+
======================================
18+
19+
The idea we wanted to implement is that CMS does not get into the way you create your contest and your tasks (unless you want to). We think that every national IOI selection team and every contest administrator has a preferred way of developing the tasks, and of storing their data in the filesystem, and we do not want to change the way you work.
20+
21+
Instead, you are encouraged to write an "importer", that is a piece of software that reads data from your filesystem structure and create the contest in the database. You can also write a "reimporter" if you want to change the contest details without losing the data (submissions, user tests, ...) already uploaded.
22+
23+
We provide examples of both importer and reimporter that target the format used by the Italian IOI selection team. You can either adapt them to the format you use, or decide to use the Italian format. Examples of contest written in this format are at https://github.com/cms-dev/con_test, while its explanation is :doc:`here <Importing formats>`.
24+
25+
26+
Creating a contest from an exported contest
27+
===========================================
28+
29+
This option is not really suited for creating new contests but to store and move contest already used in CMS. If you have the dump of a contest exported from CMS, you can import it with ``cmsContestImporter <source>``, where ``<source>`` is the archive filename or directory of the contest.
30+

docs/Importing formats.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Importing formats
2+
*****************
3+

docs/Installation.rst

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
Installation
2+
************
3+
4+
Dependencies
5+
============
6+
7+
These are our requirements (in particular we highlight those that are not usually installed by default) - previous versions may or may not work:
8+
9+
* build environment for the programming languages allowed in the competition;
10+
11+
* postgreSQL >= 8.4;
12+
13+
* gettext >= 0.18;
14+
15+
* python >= 2.7 (and < 3.0);
16+
17+
* python-setuptools >= 0.6;
18+
19+
* python-tornado >= 2.0;
20+
21+
* python-psycopg2 >= 2.4;
22+
23+
* python-simplejson >= 2.1;
24+
25+
* python-sqlalchemy >= 0.7;
26+
27+
* python-psutil >= 0.2;
28+
29+
* python-netifaces >= 0.5;
30+
31+
* python-crypto >= 2.3;
32+
33+
* python-yaml >= 3.10 (only for YamlImporter);
34+
35+
* python-beautifulsoup >= 3.2 (only for running tests);
36+
37+
* python-mechanize >= 0.2 (only for running tests);
38+
39+
* python-coverage >= 3.4 (only for running tests).
40+
41+
42+
On Ubuntu 12.04, one will need to run the following script to satisfy all dependencies:
43+
44+
.. sourcecode:: bash
45+
46+
sudo apt-get install postgresql postgresql-client python-setuptools \
47+
python-tornado python-psycopg2 python-sqlalchemy \
48+
python-psutil gettext build-essential fpc stl-manual \
49+
python-simplejson python-netifaces python-beautifulsoup \
50+
python-coverage python-crypto python-tz iso-codes shared-mime-info
51+
52+
# Optional.
53+
# sudo apt-get install phppgadmin python-yaml
54+
55+
If you prefer using Python Package Index, you can retrieve all Python dependencies with this line:
56+
57+
.. sourcecode:: bash
58+
59+
sudo pip install -r REQUIREMENTS.txt
60+
61+
62+
Installing CMS
63+
==============
64+
65+
You can download CMS 0.9.0 from https://github.com/cms-dev/cms/archive/v0.9.0.tar.gz and extract in your filesystem. After that, you can install it (recommended, not necessary though):
66+
67+
.. sourcecode:: bash
68+
69+
./setup.py build
70+
sudo ./setup.py install
71+
72+
73+
If you install CMS, you also need to add your user to the ``cmsuser`` group and logout to make the change effective:
74+
75+
.. sourcecode:: bash
76+
77+
sudo usermod -a -G cmsuser
78+
79+
You can verify to be in the group issuing the command:
80+
81+
.. sourcecode:: bash
82+
83+
groups
84+
85+
86+
Updating CMS
87+
============
88+
89+
If you were using CMS before the release of version 0.9.0, you can update the content of your database with:
90+
91+
.. sourcecode:: bash
92+
93+
cd cms/db
94+
python UpdateDB.py -l # To see which updating scripts are available.
95+
python UpdateDB.py -s YYYYMMDD # To update the DB, where YYYYMMDD is
96+
# the last date in which you created or
97+
# updated the DB.
98+

docs/Makefile

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
# Makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line.
5+
SPHINXOPTS =
6+
SPHINXBUILD = sphinx-build
7+
PAPER =
8+
BUILDDIR = _build
9+
10+
# Internal variables.
11+
PAPEROPT_a4 = -D latex_paper_size=a4
12+
PAPEROPT_letter = -D latex_paper_size=letter
13+
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
14+
# the i18n builder cannot share the environment and doctrees with the others
15+
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
16+
17+
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
18+
19+
help:
20+
@echo "Please use \`make <target>' where <target> is one of"
21+
@echo " html to make standalone HTML files"
22+
@echo " dirhtml to make HTML files named index.html in directories"
23+
@echo " singlehtml to make a single large HTML file"
24+
@echo " pickle to make pickle files"
25+
@echo " json to make JSON files"
26+
@echo " htmlhelp to make HTML files and a HTML help project"
27+
@echo " qthelp to make HTML files and a qthelp project"
28+
@echo " devhelp to make HTML files and a Devhelp project"
29+
@echo " epub to make an epub"
30+
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
31+
@echo " latexpdf to make LaTeX files and run them through pdflatex"
32+
@echo " text to make text files"
33+
@echo " man to make manual pages"
34+
@echo " texinfo to make Texinfo files"
35+
@echo " info to make Texinfo files and run them through makeinfo"
36+
@echo " gettext to make PO message catalogs"
37+
@echo " changes to make an overview of all changed/added/deprecated items"
38+
@echo " linkcheck to check all external links for integrity"
39+
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
40+
41+
clean:
42+
-rm -rf $(BUILDDIR)/*
43+
44+
html:
45+
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
46+
@echo
47+
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
48+
49+
dirhtml:
50+
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
51+
@echo
52+
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
53+
54+
singlehtml:
55+
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
56+
@echo
57+
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
58+
59+
pickle:
60+
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
61+
@echo
62+
@echo "Build finished; now you can process the pickle files."
63+
64+
json:
65+
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
66+
@echo
67+
@echo "Build finished; now you can process the JSON files."
68+
69+
htmlhelp:
70+
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
71+
@echo
72+
@echo "Build finished; now you can run HTML Help Workshop with the" \
73+
".hhp project file in $(BUILDDIR)/htmlhelp."
74+
75+
qthelp:
76+
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
77+
@echo
78+
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
79+
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
80+
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/cms.qhcp"
81+
@echo "To view the help file:"
82+
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/cms.qhc"
83+
84+
devhelp:
85+
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
86+
@echo
87+
@echo "Build finished."
88+
@echo "To view the help file:"
89+
@echo "# mkdir -p $$HOME/.local/share/devhelp/cms"
90+
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/cms"
91+
@echo "# devhelp"
92+
93+
epub:
94+
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
95+
@echo
96+
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
97+
98+
latex:
99+
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
100+
@echo
101+
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
102+
@echo "Run \`make' in that directory to run these through (pdf)latex" \
103+
"(use \`make latexpdf' here to do that automatically)."
104+
105+
latexpdf:
106+
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
107+
@echo "Running LaTeX files through pdflatex..."
108+
$(MAKE) -C $(BUILDDIR)/latex all-pdf
109+
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
110+
111+
text:
112+
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
113+
@echo
114+
@echo "Build finished. The text files are in $(BUILDDIR)/text."
115+
116+
man:
117+
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
118+
@echo
119+
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
120+
121+
texinfo:
122+
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
123+
@echo
124+
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
125+
@echo "Run \`make' in that directory to run these through makeinfo" \
126+
"(use \`make info' here to do that automatically)."
127+
128+
info:
129+
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
130+
@echo "Running Texinfo files through makeinfo..."
131+
make -C $(BUILDDIR)/texinfo info
132+
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
133+
134+
gettext:
135+
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
136+
@echo
137+
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
138+
139+
changes:
140+
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
141+
@echo
142+
@echo "The overview file is in $(BUILDDIR)/changes."
143+
144+
linkcheck:
145+
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
146+
@echo
147+
@echo "Link check complete; look for any errors in the above output " \
148+
"or in $(BUILDDIR)/linkcheck/output.txt."
149+
150+
doctest:
151+
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
152+
@echo "Testing of doctests in the sources finished, look at the " \
153+
"results in $(BUILDDIR)/doctest/output.txt."

0 commit comments

Comments
 (0)