diff --git a/docs/src/cdist-library.rst b/docs/src/cdist-library.rst new file mode 100644 index 00000000..ea1c95c9 --- /dev/null +++ b/docs/src/cdist-library.rst @@ -0,0 +1,61 @@ +Library +======= + +Description +----------- +The library features the sharing of common code. There is a global and +a type library to match the specific use case. + +The library feature is simply making the path to the library folder +available to all scripts. With it, they can load files out of the library +from different locations. Through it, code must only written once, which +makes code easier and less redundant. Also, better code can be provided +by shared libraries. + +Synopsis +-------- + +From `manifest`, `gencode-*` and `code-local`: + +.. code-block:: + + $__library (global library directory path) + $__type/library (type library folder) + +From the remote side (`explorer` and `code-remote`): + +.. code-block:: + + $__library (remote copied library directory path) + $__type_library (remote copied type library folder) + +*Type libraries are only available if the code is available in an object- +realated content. As example, there are not available in global explorer +or the initial manifest.* + +How to use +---------- +Because the library features only distribute files, it's not bond to +`posix shell scripts` or any programming or scripting language. To use +the library, you only need to load the library from the given path. + +In shell scripts, it works as follow (here as a `type manifest`): + +.. code-block:: sh + + # loading a global library + . "$__library/manifest" + + # loading type library + . "$__type/library/foo-bar" + + + # now, sourced shell functions can be used + # ... + +Remote handling +--------------- +The libraries may also required on the remote side. For this, the +library is completly copied to the remote. Therefor, it's completly +available on the remote side and can be used in the explorers and +generated remote code. diff --git a/docs/src/cdist-type.rst b/docs/src/cdist-type.rst index 582c0938..a0fedd4b 100644 --- a/docs/src/cdist-type.rst +++ b/docs/src/cdist-type.rst @@ -106,6 +106,7 @@ A type consists of - explorer (optional) - gencode (optional) - nonparallel (optional) +- library (optional) Types are stored below cdist/conf/type/. Their name should always be prefixed with two underscores (__) to prevent collisions with other executables in $PATH. diff --git a/docs/src/index.rst b/docs/src/index.rst index 31c044dc..a6f36582 100644 --- a/docs/src/index.rst +++ b/docs/src/index.rst @@ -30,6 +30,7 @@ It natively supports IPv6 since the first release. cdist-type cdist-types cdist-explorer + cdist-library cdist-messaging cdist-parallelization cdist-inventory