table of contents
App::Cme::Command::meta(3pm) | User Contributed Perl Documentation | App::Cme::Command::meta(3pm) |
NAME¶
App::Cme::Command::meta - Work on the configuration model of an application
VERSION¶
version 2.023
SYNOPSIS¶
# 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
DESCRIPTION¶
"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.
USAGE¶
"cme meta" supports several sub commands like "edit" or "plugin". These sub commands are detailed below.
edit¶
"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:
check¶
"cme meta check" reads the model files from "./lib/Config/Model/models" directory and checks their validity.
plugin¶
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.
gen-dot [ file.dot ]¶
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 [ file.cds ]¶
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-yaml [ file.yml ]¶
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
save¶
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.
Options¶
- -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'
LOGGING¶
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
Dogfooding¶
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.
AUTHOR¶
Dominique Dumont, ddumont at cpan dot org
SEE ALSO¶
- 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
AUTHOR¶
Dominique Dumont
COPYRIGHT AND LICENSE¶
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
2022-01-30 | perl v5.32.1 |