tiramisu/doc/getting-started.txt

81 lines
2.4 KiB
Plaintext
Raw Normal View History

==================================
2013-05-17 12:11:14 +02:00
Getting started
==================================
2013-08-23 11:16:26 +02:00
What is options handling ?
2012-11-20 17:14:58 +01:00
=================================
2013-08-23 11:42:22 +02:00
Due to more and more available options required to set up an operating system,
2013-08-28 09:22:44 +02:00
to set up compiler options, and so on. it became quite annoying to hand the
2013-08-23 11:42:22 +02:00
necessary options to where they are actually used and even more annoying to add
new options. To circumvent these problems the configuration management was
2013-08-23 11:16:26 +02:00
introduced...
What is Tiramisu ?
2012-11-20 17:14:58 +01:00
===================
2013-08-23 11:42:22 +02:00
Tiramisu is an options handler and an options controller, wich aims at
producing flexible and fast options access. The main advantages are its access
2013-08-23 11:16:26 +02:00
rules and the fact that the whole consistency is preserved at any time, see
2013-08-23 11:42:22 +02:00
:doc:`consistency`. There is of course type and structure validations, but also
2013-08-23 11:16:26 +02:00
validations towards the whole options.
2013-08-23 11:42:22 +02:00
Last but not least, options can be reached and changed according to the access
2013-08-23 11:16:26 +02:00
rules from nearly everywhere in your appliance.
2012-11-20 17:14:58 +01:00
Just the facts
==============
2012-11-20 17:14:58 +01:00
.. _gettingtiramisu:
Download
---------
2013-08-23 11:42:22 +02:00
To obtain a copy of the sources, check it out from the repository using `git`.
We suggest using `git` if one wants to access the current developments.
::
git clone git://git.labs.libre-entreprise.org/tiramisu.git
2013-08-23 11:42:22 +02:00
This will get you a fresh checkout of the code repository in a local directory
named ``tiramisu``.
Getting started
-------------------
2013-08-23 11:42:22 +02:00
Option objects can be created in different ways. Let's perform very basic
:class:`~tiramisu.option.Option` and :class:`~tiramisu.config.Config` object
2013-08-23 11:16:26 +02:00
manipulations:
::
>>> from tiramisu.config import Config
>>> from tiramisu.option import OptionDescription, BoolOption
>>> descr = OptionDescription("optgroup", "", [
... BoolOption("bool", "", default=False)])
>>>
2013-08-23 11:42:22 +02:00
>>> c = Config(descr)
>>> # now we have a container, wich contains an option:
>>> c.bool
False
2013-08-23 11:42:22 +02:00
>>> c.bool = True
>>> c.bool
True
So by now, we have
2013-08-23 11:42:22 +02:00
- a namespace (which is `c` here)
- the access of an option's value by the
attribute access way (here `bool`, wich is a boolean option:
2013-08-23 11:42:22 +02:00
:class:`~tiramisu.option.BoolOption()`.
2013-08-23 11:42:22 +02:00
So, option objects are produced at the entry point and then handed down to
where they are actually used. This keeps options local but available everywhere
2013-08-23 11:16:26 +02:00
and consistent.
2013-08-23 11:42:22 +02:00
The namespace is created, we can set a `read_write` access to the options::
>>> c.read_write()