App::Cme::Command::meta - Work on the configuration model of an application
version 2.023
# edit meta model
cme meta [ options ] edit [ model_class ]
# check meta model
cme meta [ options ] check [ model_class ]
# model plugin mode
cme meta [options] plugin application plugin_name
"cme meta edit" provides a Perl/Tk graphical interface to create or
edit configuration models that will be used by Config::Model.
This tool enables you to create configuration checker or editor for
configuration files of an application.
"cme meta" supports several sub commands like "edit" or
"plugin". These sub commands are detailed below.
"cme meta edit" is the most useful sub command. It will read and write
model file from "./lib/Config/Model/models" directory.
Only configuration models matching the optional 4th parameter will be loaded.
I.e.
cme meta edit Xorg
will load models "Xorg" (file "Xorg.pl") and all other
"Xorg::*" like "Xorg::Screen" (file
"Xorg/Screen.pl").
Besides "edit", the following sub commands are available:
"cme meta check" reads the model files from
"./lib/Config/Model/models" directory and checks their validity.
This sub command is used to create model plugins. A model plugin is an addendum
to an existing model. The resulting file is saved in a ".d"
directory besides the original file to be taken into account.
For instance:
$ cme meta plugin dpkg my-plugin
# perform additions to Dpkg and Dpkg::Control and save
$ find lib/Config/Model/models/Dpkg.d -type f
lib/Config/Model/models/Debian/Dpkg.d/my-plugin/Dpkg.pl
lib/Config/Model/models/Debian/Dpkg.d/my-plugin/Dpkg/Control.pl
Use "-dev" option if you need to add plugins to a model located in
current directory.
Create a dot file that represent the structure of the configuration model. By
default, the generated dot file is "model.dot"
$ cme meta gen-dot Itself itself.dot
$ dot -T png itself.dot > itself.png
"include" are represented by solid lines. Class usage (i.e.
"config_class_name" parameter) is represented by dashed lines. The
name of the element is attached to the dashed line.
Dump configuration content in the specified file (or "model.cds")
using Config::Model dump string syntax (hence the "cds" file
extension). See Config::Model::Loader for details on the syntax)
By default, dump only custom values, i.e. different from application built-in
values or model default values. See -dumptype option for other types of dump
$ cme meta dump Itself
Dump configuration content in the specified file (or "model.yml") in
YAML format.
For instance:
$ cme meta dump-yaml Ssh::PortForward contrib/ssh-portforward.yml
Force a save of the model even if no edition was done. This option is useful to
migrate a model when Config::Model model feature changes.
- -system
- Read model from system files, i.e. from installed files,
not from "./lib" directory.
- -trace
- Provides a full stack trace when exiting on error.
- -load <cds_file_to_load> | -
- Load model from cds file (using Config::Model serialisation
format, typically done with -dump option). This option can be used with
"save" to directly save a model loaded from the cds file or from
STDIN.
- -load-yaml <yaml_file_to_load> | -
- Load configuration data in model from YAML file. This
option can be used with "save" to directly save a model loaded
from a YAML file or from STDIN.
- -force-load
- Load file even if error are found in data. Bad data are
loaded, but should be cleaned up before saving the model. See menu
"File -> check" in the GUI.
- -dumptype [ full | preset | custom ]
- Choose to dump every values (full), only preset values or
only customized values (default) (only for "dump" sub
command)
- -open-item 'path'
- In graphical mode, force the UI to open the specified node.
E.g.
-open_item 'class:Fstab::FsLine element:fs_mntopts rules'
All Config::Model logging was moved from klunky debug and verbose prints to
Log::Log4perl. Logging can be configured in the following files:
- •
-
~/.log4config-model
- •
-
/etc/log4config-model.conf
Without these files, the following Log4perl config is used:
log4perl.logger=WARN, Screen
log4perl.appender.Screen = Log::Log4perl::Appender::Screen
log4perl.appender.Screen.stderr = 0
log4perl.appender.Screen.layout = Log::Log4perl::Layout::PatternLayout
log4perl.appender.Screen.layout.ConversionPattern = %d %m %n
Log4Perl categories are shown in "LOGGING" in cme
The GUI shown by "cme meta edit" is created from a configuration model
that describes the structure and parameters of a configuration model. (which
explains the "Itself" name. This module could also be named
"Config::Model::DogFooding").
This explains why the GUI shown by "cme meta edit" looks like the GUI
shown by "cme edit": the same GUI generator is used.
If you're new to Config::Model, I'd advise not to peek under
"Config::Model::Itself" hood lest you loose your sanity.
Dominique Dumont, ddumont at cpan dot org
- •
- Config::Model::Manual::ModelCreationIntroduction
- •
- cme,
- •
- Config::Model,
- •
- Config::Model::Itself,
- •
- Config::Model::Node,
- •
- Config::Model::Instance,
- •
- Config::Model::HashId,
- •
- Config::Model::ListId,
- •
- Config::Model::WarpedNode,
- •
- Config::Model::Value
Dominique Dumont
This software is Copyright (c) 2007-2019 by Dominique Dumont.
This is free software, licensed under:
The GNU Lesser General Public License, Version 2.1, February 1999