Adding documentation

This commit is contained in:
luca.frosini 2023-08-30 17:40:36 +02:00
parent e2fb00c34f
commit a4e10e256c
5 changed files with 162 additions and 1 deletions

2
.gitignore vendored
View File

@ -29,5 +29,5 @@ replay_pid*
/.project
/.settings
/gcat/
/.DS_Store
**.DS_Store
/bin/

20
docs/Makefile Normal file
View File

@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

55
docs/conf.py Normal file
View File

@ -0,0 +1,55 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
# -- Project information -----------------------------------------------------
project = 'Software Versions Processor Lib'
copyright = '2023, Luca Frosini (ISTI-CNR)'
author = 'Luca Frosini (ISTI-CNR)'
# The full version, including alpha/beta/rc tags
# release = '6.0.0'
# -- General configuration ---------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = []
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
#html_theme = 'sphinx_rtd_theme'
html_theme = 'sphinxdoc'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

51
docs/index.rst Normal file
View File

@ -0,0 +1,51 @@
This library has been initially designed to deposit software artifacts programmatically in Zenodo.
It is actually a general-purpose library capable of analyzing a list of
software artifacts (represented by the metadata) and export them.
The library currently offers two exporters:
* **ZenodoExporter**: deposit the software artifact in Zenodo obtaining a DOI;
* **BibLaTeXExporter**: export the software artifact in a ``bib`` file using the BibLaTeX format.
Other exporters can be easily added in the future by extending the ``SoftwareVersionExporter`` class.
The core class of the library is Analyser, which must be initialized with:
* a configuration (JSON Object);
* a list of software artifacts described by their metadata (JSON Array).
The configuration must contain the list of exporters to be used and their configuration parameters.
Exporter configuration requires the 'elaboration' property, which can assume the following values
(see ``ElaborationType`` enumerated):
* **ALL**: The exporter analyses all the software artifacts;
* **UPDATE_ONLY**: The exporter analyes only the software artifact to be updated in the target.
* **NEW**: The exporter analyses only the software artifact that does not yet exist in the target.
* **NONE**: Does not export the software artifact in the target, but each software artifact is elaborated for the exporting without effectively doing it. It is a dry run.
The exporters are executed in the order they are defined.
An exporter could produce metadata obtained by the exporting phase (e.g., the obtained Zenodo DOI).
The input metadata + the metadata generated by an exporter are made available to the subsequent.
At the end of the exporting phase, the library produces the actual output of all the software artifact metadata.
Moreover, the configuration can optionally include an arbitrary set of metadata used as metadata default for all software artifacts defined in the list.
The list of software artifacts can contain an arbitrary set of metadata.
It is the exporter logic that uses certain metadata, among others.
While analyzing each software artifact, the ``Analyser`` set the previous to the exporter.
Relating the artifact with the previous one is helpful if an exporter needs to link them.
It is in charge of the exporter's logic of eventually connecting them under specific metadata values used as conditions.
The library dynamically calculates the value of metadata to elaborate using the following essential features:
* A property can contain the value of another property indicated as a variable using the referred property name;
* The library merges the metadata of the software artifact with the metadata defined in the configuration;
* The library calculates the final metadata values, replacing the variables only after merging the properties.
The following example show an example of configuration
.. literalinclude:: ../src/test/resources/gcat-test-sandbox.json
:language: JSON

35
docs/make.bat Normal file
View File

@ -0,0 +1,35 @@
@ECHO OFF
pushd %~dp0
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build
if "%1" == "" goto help
%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end
:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
:end
popd