1
0
Fork 0
mirror of https://github.com/yweber/lodel2.git synced 2026-01-14 02:32:14 +01:00

fixes #133 : Documenting lodel_admin.py actions implementation

Commit refs #122 and fixes #133
This commit is contained in:
Yann 2016-08-29 10:44:47 +02:00
commit 80b8122dc4
4 changed files with 84 additions and 2 deletions

View file

@ -11,5 +11,5 @@ init_db: dyncode
list_hooks: dyncode
$(python) -c 'import lodel_admin; lodel_admin.list_registered_hooks()'
discover_plugins:
refresh_plugins:
$(python) -c 'import lodel_admin; lodel_admin.update_plugin_discover_cache()'

View file

@ -14,3 +14,43 @@ dyncode = None
# 4. "lodel2_bootstraped" hooks are called
# 5. "lodel2_loader_main" hooks are called (if runned from loader.py as main executable)
#
##@page lodel2_instance_admin Lodel2 instance administration
#
#@section lodel2_instance_adm_tools Tools
#
#@subsection lodel2_instance_makefile Makefile
#
#The Makefile allows to run automated without arguments such as :
#- refresh the dynamic code using conf + EM (target **dyncode**)
#- update databases (target **init_db**)
#- refresh plugins list (target **refresh_plugins**)
#
#@subsection lodel2_instance_adm_scripts lodel_admin.py scripts
#
#In all instances you find a symlink named lodel_admin.py . This script
#contains the code run by @ref lodel2_instance_makefile "Makefile targets"
#and a main function that allows to run it as a CLI script.
#
#@par Script help
#<pre>
#usage: lodel_admin.py [-h] [-L] [ACTION] [OPTIONS [OPTIONS ...]]
#
#Lodel2 script runner
#
#positional arguments:
# ACTION One of the following actions : discover-plugin [...]
# OPTIONS Action options. Use lodel_admin.py ACTION -h to have
# help on a specific action
#
#optional arguments:
# -h, --help show this help message and exit
# -L, --list-actions List available actions
#</pre>
#
#@par Script customization
#
#See @ref lodel2_script_doc "Lodel2 scripting"
#
#

View file

@ -1,6 +1,7 @@
#-*- coding: utf-8 -*-
##@defgroup lodel2_plugins Plugins
#@ingroup lodel2_leapi
#
#Groups all stuff that concerns plugins

View file

@ -21,7 +21,7 @@ __registered_scripts = dict()
#@ingroup lodel2_script
#@ingroup lodel2_plugins
#
#Automatic script registration on child class declaration
#Automatic action registration on child class declaration
class MetaLodelScript(type):
def __init__(self, name, bases, attrs):
@ -177,3 +177,44 @@ def main_run():
ret = script._run()
ret = 0 if ret is None else ret
exit(ret)
##@page lodel2_script_doc Lodel2 scripting
#@ingroup lodel2_script
#
#@section lodel2_script_adm Lodel2 instance administration scripts
#
#Lodel2 provides instance administration operation using Makefiles or
#lodel_admin.py script ( see @ref lodel2_instance_admin ).
#
#The lodel_admin.py script take as first option an action. Each action
#correspond to a sub-script with it's own options etc. To get a list
#of all available action run <code>python3 lodel_admin.py -L</code>.
#
#@section lodel2_script_action lodel_admin.py actions
#
#Action implementation is done by class inheritance. To create a new action
#write a @ref lodel.plugin.scripts.LodelScript "LodelScript" derived class (
#see @ref lodel.plugin.core_scripts "core_scripts.py" file as example )
#
#@subsection lodel2_script_inheritance LodelScript inheritance
#
#In order to implement properly a new action you have to write a new
#@ref lodel.plugin.scripts.LodelScript "LodelScript" derivated class.
#Some methods and attributes are mandatory to write a fully functionnal
#derivated class. Here is a list :
#
#- mandatory methods
# - @ref plugin.scripts.LodelScript.argparser_config() "argparser_config()" :
#(classmethod) initialize argparse.Parser
# - @ref plugin.scripts.LodelScript.run() "run()" : (classmethod) contains the
#code that runs to perform the action
#- mandatory attributes
# - @ref plugin.scripts.LodelScript::_action "_action" : (class attribute)
#stores action name
# - @ref plugin.scripts.LodelScript::_description "_description" : (class
#attribute) sotres a short action description
#
#@note On script's action registration : once child class is written you only
#need to import it to trigger script's action registration (see
#@ref plugin.scripts.MetaLodelScript )
#