diff -Nru cme-1.024/bin/cme cme-1.026/bin/cme --- cme-1.024/bin/cme 2017-10-22 11:02:22.000000000 +0000 +++ cme-1.026/bin/cme 2017-12-18 18:16:40.000000000 +0000 @@ -35,7 +35,7 @@ =head1 VERSION -version 1.024 +version 1.026 =head1 SYNOPSIS @@ -208,6 +208,12 @@ Load file even if error are found in data. Bad data are discarded +=item -canonical + +Write config data back using model order. By default, write items back +using the order found in the configuration file. This feature is +experimental and not supported by all backends. + =item -backup Create a backup of configuration files before saving. By default, C will @@ -256,11 +262,6 @@ Provides a full stack trace when exiting on error. -=item -backend - -Specify a read/write backend. The actual backend name depends on the model -passed to C<-model> option. See L for details. - =item -try-app-as-model When set, try to load a model using directly the application name specified as 3rd parameter diff -Nru cme-1.024/Build.PL cme-1.026/Build.PL --- cme-1.024/Build.PL 2017-10-22 11:02:22.000000000 +0000 +++ cme-1.026/Build.PL 2017-12-18 18:16:40.000000000 +0000 @@ -27,7 +27,7 @@ "Dominique Dumont" ], "dist_name" => "App-Cme", - "dist_version" => "1.024", + "dist_version" => "1.026", "license" => "lgpl", "module_name" => "App::Cme", "recommends" => { @@ -37,7 +37,7 @@ "recursive_test_files" => 1, "requires" => { "App::Cmd::Setup" => 0, - "Config::Model" => "2.103", + "Config::Model" => "2.116", "Config::Model::FuseUI" => 0, "Config::Model::Lister" => 0, "Config::Model::ObjTreeScanner" => 0, diff -Nru cme-1.024/Changes cme-1.026/Changes --- cme-1.024/Changes 2017-10-22 11:02:22.000000000 +0000 +++ cme-1.026/Changes 2017-12-18 18:16:40.000000000 +0000 @@ -1,3 +1,32 @@ +1.026 2017-12-18 + + New experimental feature: + * By default, Shellvar backend from Config::Model 2.116 keeps + parameter order when writing back configuration data. This broke + cme test that check that data is written with canonical order + * add -canonical option to let data be written back according to model + order (i.e. the previous behavior of shellvar backend) + * Fix test broken by new ShellVar behavior (using -canonical option) + * Depends on Config::Model 2.116 (for -canonical option) + + On-going deprecation of obscure multi backend feature + * cme: remove obsolete -backend option (since only one backend can now + be available, there's no need to an option to choose an alternative backend) + +1.025 2017-12-14 + + Some new features for the rather new 'run' subcommand: + * add -cat option option to show the script + * -doc option also shows commit message + + New feature for the older 'dump' subcommand + * -format accepts yaml or yml + * -format value is now case insensitive + * accept -format cds (alias to cml) + + Misc: + * improve doc of modify command + 1.024 2017-10-22 Some new features for the rather new 'run' subcommand: @@ -40,7 +69,7 @@ Bug fixes: * all: fix bash completion of -file option * cme run: fix bash_completion of -doc option - * cme dump: allow non_upstream_default mode + * cme allow non_upstream_default mode * all: remove -dev option which raises security issues. Use 'perl -Ilib -S cme' for the same effect @@ -192,7 +221,7 @@ * Common: pass cme messages through on_message_cb * update: call C::M::Instance->update (require Config::Model 2.068) - * dump: remove debug call to YYY + * remove debug call to YYY 1.002 2015-01-10 diff -Nru cme-1.024/debian/changelog cme-1.026/debian/changelog --- cme-1.024/debian/changelog 2017-10-25 11:25:58.000000000 +0000 +++ cme-1.026/debian/changelog 2017-12-19 12:21:45.000000000 +0000 @@ -1,3 +1,15 @@ +cme (1.026-1) unstable; urgency=medium + + * New upstream version 1.026 + * By default, Shellvar backend from Config::Model 2.116 keeps + parameter order when writing back configuration data. + * add -canonical option to let data be written back according to model + order (i.e. the previous behavior of shellvar backend) + * cme: remove obsolete -backend option + * control: depends on libconfig-model-perl >= 2.116 + + -- Dominique Dumont Tue, 19 Dec 2017 13:21:45 +0100 + cme (1.024-1) unstable; urgency=medium * New upstream version 1.024 diff -Nru cme-1.024/debian/control cme-1.026/debian/control --- cme-1.024/debian/control 2017-10-25 11:25:58.000000000 +0000 +++ cme-1.026/debian/control 2017-12-19 12:21:45.000000000 +0000 @@ -9,7 +9,7 @@ perl Build-Depends-Indep: bash-completion, libapp-cmd-perl, - libconfig-model-perl (>= 2.103), + libconfig-model-perl (>= 2.116), libjson-perl, liblog-log4perl-perl, libpath-tiny-perl, @@ -28,7 +28,7 @@ Depends: ${misc:Depends}, ${perl:Depends}, libapp-cmd-perl, - libconfig-model-perl (>= 2.103), + libconfig-model-perl (>= 2.116), libjson-perl, liblog-log4perl-perl, libpath-tiny-perl, diff -Nru cme-1.024/lib/App/Cme/Command/check.pm cme-1.026/lib/App/Cme/Command/check.pm --- cme-1.024/lib/App/Cme/Command/check.pm 2017-10-22 11:02:22.000000000 +0000 +++ cme-1.026/lib/App/Cme/Command/check.pm 2017-12-18 18:16:40.000000000 +0000 @@ -10,7 +10,7 @@ # ABSTRACT: Check the configuration of an application package App::Cme::Command::check ; -$App::Cme::Command::check::VERSION = '1.024'; +$App::Cme::Command::check::VERSION = '1.026'; use strict; use warnings; use 5.10.1; @@ -88,7 +88,7 @@ =head1 VERSION -version 1.024 +version 1.026 =head1 SYNOPSIS diff -Nru cme-1.024/lib/App/Cme/Command/dump.pm cme-1.026/lib/App/Cme/Command/dump.pm --- cme-1.024/lib/App/Cme/Command/dump.pm 2017-10-22 11:02:22.000000000 +0000 +++ cme-1.026/lib/App/Cme/Command/dump.pm 2017-12-18 18:16:40.000000000 +0000 @@ -10,7 +10,7 @@ # ABSTRACT: Dump the configuration of an application package App::Cme::Command::dump ; -$App::Cme::Command::dump::VERSION = '1.024'; +$App::Cme::Command::dump::VERSION = '1.026'; use strict; use warnings; use 5.10.1; @@ -44,7 +44,7 @@ [ "format=s" => "dump using specified format", { - regex => qr/^(?:json|yaml|perl|cml)$/, + regex => qr/^(?:json|ya?ml|perl|cml|cds)$/i, default => 'yaml' }, ], @@ -75,7 +75,7 @@ my $format = $opt->{format}; my $mode = $opt->{dumptype} || 'custom'; - if ($format eq 'cml') { + if ($format =~ /cml|cds/i) { $dump_string = $target_node->dump_tree( mode => $mode ); } else { @@ -83,9 +83,10 @@ ordered_hash_as_list => 0, mode => $mode ); - $dump_string = $format eq 'yaml' ? Dump($perl_data) - : $format eq 'JSON' ? encode_json($perl_data) - : Dumper($perl_data) ; + $dump_string + = $format =~ /ya?ml/i ? Dump($perl_data) + : $format =~ /json/i ? encode_json($perl_data) + : Dumper($perl_data) ; # Perl data structure } print $dump_string ; } @@ -104,7 +105,7 @@ =head1 VERSION -version 1.024 +version 1.026 =head1 SYNOPSIS @@ -130,8 +131,9 @@ C is like C mode, but value identical with application default are omitted. But this should seldom happen. -By default, dump in yaml format. This can be changed in C, -C, C (aka L format) with C<-format> option. +By default, dump in yaml format. This can be changed in C, +C, C (aka L format, C is also +accepted) with C<-format> option. =head1 Common options diff -Nru cme-1.024/lib/App/Cme/Command/edit.pm cme-1.026/lib/App/Cme/Command/edit.pm --- cme-1.024/lib/App/Cme/Command/edit.pm 2017-10-22 11:02:22.000000000 +0000 +++ cme-1.026/lib/App/Cme/Command/edit.pm 2017-12-18 18:16:40.000000000 +0000 @@ -10,7 +10,7 @@ # ABSTRACT: Edit the configuration of an application package App::Cme::Command::edit ; -$App::Cme::Command::edit::VERSION = '1.024'; +$App::Cme::Command::edit::VERSION = '1.026'; use strict; use warnings; use 5.10.1; @@ -125,7 +125,7 @@ =head1 VERSION -version 1.024 +version 1.026 =head1 SYNOPSIS diff -Nru cme-1.024/lib/App/Cme/Command/fix.pm cme-1.026/lib/App/Cme/Command/fix.pm --- cme-1.024/lib/App/Cme/Command/fix.pm 2017-10-22 11:02:22.000000000 +0000 +++ cme-1.026/lib/App/Cme/Command/fix.pm 2017-12-18 18:16:40.000000000 +0000 @@ -10,7 +10,7 @@ # ABSTRACT: Fix the configuration of an application package App::Cme::Command::fix ; -$App::Cme::Command::fix::VERSION = '1.024'; +$App::Cme::Command::fix::VERSION = '1.026'; use strict; use warnings; use 5.10.1; @@ -81,7 +81,7 @@ =head1 VERSION -version 1.024 +version 1.026 =head1 SYNOPSIS diff -Nru cme-1.024/lib/App/Cme/Command/fusefs.pm cme-1.026/lib/App/Cme/Command/fusefs.pm --- cme-1.024/lib/App/Cme/Command/fusefs.pm 2017-10-22 11:02:22.000000000 +0000 +++ cme-1.026/lib/App/Cme/Command/fusefs.pm 2017-12-18 18:16:40.000000000 +0000 @@ -10,7 +10,7 @@ # ABSTRACT: Edit the configuration of an application with fuse package App::Cme::Command::fusefs ; -$App::Cme::Command::fusefs::VERSION = '1.024'; +$App::Cme::Command::fusefs::VERSION = '1.026'; use strict; use warnings; use 5.10.1; @@ -110,7 +110,7 @@ =head1 VERSION -version 1.024 +version 1.026 =head1 SYNOPSIS diff -Nru cme-1.024/lib/App/Cme/Command/gen_class_pod.pm cme-1.026/lib/App/Cme/Command/gen_class_pod.pm --- cme-1.024/lib/App/Cme/Command/gen_class_pod.pm 2017-10-22 11:02:22.000000000 +0000 +++ cme-1.026/lib/App/Cme/Command/gen_class_pod.pm 2017-12-18 18:16:40.000000000 +0000 @@ -10,7 +10,7 @@ # ABSTRACT: Generates pod doc from model files package App::Cme::Command::gen_class_pod ; -$App::Cme::Command::gen_class_pod::VERSION = '1.024'; +$App::Cme::Command::gen_class_pod::VERSION = '1.026'; use strict; use warnings; use 5.10.1; @@ -49,7 +49,7 @@ =head1 VERSION -version 1.024 +version 1.026 =head1 SYNOPSIS diff -Nru cme-1.024/lib/App/Cme/Command/list.pm cme-1.026/lib/App/Cme/Command/list.pm --- cme-1.024/lib/App/Cme/Command/list.pm 2017-10-22 11:02:22.000000000 +0000 +++ cme-1.026/lib/App/Cme/Command/list.pm 2017-12-18 18:16:40.000000000 +0000 @@ -10,7 +10,7 @@ # ABSTRACT: List applications handled by cme package App::Cme::Command::list ; -$App::Cme::Command::list::VERSION = '1.024'; +$App::Cme::Command::list::VERSION = '1.026'; use strict; use warnings; use 5.10.1; @@ -67,7 +67,7 @@ =head1 VERSION -version 1.024 +version 1.026 =head1 SYNOPSIS diff -Nru cme-1.024/lib/App/Cme/Command/migrate.pm cme-1.026/lib/App/Cme/Command/migrate.pm --- cme-1.024/lib/App/Cme/Command/migrate.pm 2017-10-22 11:02:22.000000000 +0000 +++ cme-1.026/lib/App/Cme/Command/migrate.pm 2017-12-18 18:16:40.000000000 +0000 @@ -10,7 +10,7 @@ # ABSTRACT: Migrate the configuration of an application package App::Cme::Command::migrate ; -$App::Cme::Command::migrate::VERSION = '1.024'; +$App::Cme::Command::migrate::VERSION = '1.026'; use strict; use warnings; use 5.10.1; @@ -71,7 +71,7 @@ =head1 VERSION -version 1.024 +version 1.026 =head1 SYNOPSIS diff -Nru cme-1.024/lib/App/Cme/Command/modify.pm cme-1.026/lib/App/Cme/Command/modify.pm --- cme-1.024/lib/App/Cme/Command/modify.pm 2017-10-22 11:02:22.000000000 +0000 +++ cme-1.026/lib/App/Cme/Command/modify.pm 2017-12-18 18:16:40.000000000 +0000 @@ -10,7 +10,7 @@ # ABSTRACT: Modify the configuration of an application package App::Cme::Command::modify ; -$App::Cme::Command::modify::VERSION = '1.024'; +$App::Cme::Command::modify::VERSION = '1.026'; use strict; use warnings; use 5.10.1; @@ -78,16 +78,13 @@ =head1 VERSION -version 1.024 +version 1.026 =head1 SYNOPSIS # modify configuration with command line cme modify dpkg source 'format="(3.0) quilt"' - # likewise with an application that accepts file override - cme modify dpkg-copyright 'Comment="Modified with cme"' - =head1 DESCRIPTION Modify a configuration file with the values passed on the command line. @@ -96,13 +93,13 @@ Example: - cme modify dpkg source format="(3.0) quilt" - cme modify multistrap my_mstrap.conf sections:base source="http://ftp.fr.debian.org" + cme modify dpkg 'source format="(3.0) quilt"' + cme modify multistrap my_mstrap.conf 'sections:base source="http://ftp.fr.debian.org"' Some application like dpkg-copyright allows you to override the configuration file name. You must then use C<-file> option: - cme modify dpkg-copyright -file ubuntu/copyright 'Comment="Silly example" + cme modify dpkg-copyright -file ubuntu/copyright 'Comment="Silly example"' =head1 Common options diff -Nru cme-1.024/lib/App/Cme/Command/run.pm cme-1.026/lib/App/Cme/Command/run.pm --- cme-1.024/lib/App/Cme/Command/run.pm 2017-10-22 11:02:22.000000000 +0000 +++ cme-1.026/lib/App/Cme/Command/run.pm 2017-12-18 18:16:40.000000000 +0000 @@ -10,7 +10,7 @@ # ABSTRACT: Run a cme script package App::Cme::Command::run ; -$App::Cme::Command::run::VERSION = '1.024'; +$App::Cme::Command::run::VERSION = '1.026'; use strict; use warnings; use 5.10.1; @@ -43,6 +43,7 @@ [ "arg=s@" => "script argument. run 'cme run $app -doc' for possible arguments" ], [ "backup:s" => "Create a backup of configuration files before saving." ], [ "commit|c:s" => "commit change with passed message" ], + [ "cat" => "Show the script file" ], [ "no-commit|nc!" => "skip commit to git" ], [ "quiet!" => "Suppress progress messages" ], [ "doc!" => "show documention of script" ], @@ -106,6 +107,11 @@ my $content = $script->slurp_utf8; + if ($opt->{cat}) { + print $content; + return; + } + # parse variables passed on command line my %user_args = map { split '=',$_,2; } @{ $opt->{arg} }; @@ -187,6 +193,7 @@ if ($opt->doc) { say join "\n", @doc; + say "will commit with message: '$commit_msg'" if $commit_msg; return; } @@ -221,7 +228,7 @@ } package App::Cme::Run::Var; -$App::Cme::Run::Var::VERSION = '1.024'; +$App::Cme::Run::Var::VERSION = '1.026'; require Tie::Hash; our @ISA = qw(Tie::ExtraHash); @@ -248,7 +255,7 @@ =head1 VERSION -version 1.024 +version 1.026 =head1 SYNOPSIS @@ -405,6 +412,10 @@ Show the script documentation. (Note that C<--help> options show the documentation of C command) +=head2 cat + +Pop the hood and show the content of the script. + =head2 commit Like the commit instruction in script. Specify that the change must be diff -Nru cme-1.024/lib/App/Cme/Command/search.pm cme-1.026/lib/App/Cme/Command/search.pm --- cme-1.024/lib/App/Cme/Command/search.pm 2017-10-22 11:02:22.000000000 +0000 +++ cme-1.026/lib/App/Cme/Command/search.pm 2017-12-18 18:16:40.000000000 +0000 @@ -10,7 +10,7 @@ # ABSTRACT: Search the configuration of an application package App::Cme::Command::search ; -$App::Cme::Command::search::VERSION = '1.024'; +$App::Cme::Command::search::VERSION = '1.026'; use strict; use warnings; use 5.10.1; @@ -86,7 +86,7 @@ =head1 VERSION -version 1.024 +version 1.026 =head1 SYNOPSIS diff -Nru cme-1.024/lib/App/Cme/Command/shell.pm cme-1.026/lib/App/Cme/Command/shell.pm --- cme-1.024/lib/App/Cme/Command/shell.pm 2017-10-22 11:02:22.000000000 +0000 +++ cme-1.026/lib/App/Cme/Command/shell.pm 2017-12-18 18:16:40.000000000 +0000 @@ -10,7 +10,7 @@ # ABSTRACT: Edit the configuration of an application with a shell package App::Cme::Command::shell ; -$App::Cme::Command::shell::VERSION = '1.024'; +$App::Cme::Command::shell::VERSION = '1.026'; use strict; use warnings; use 5.10.1; @@ -78,7 +78,7 @@ =head1 VERSION -version 1.024 +version 1.026 =head1 SYNOPSIS diff -Nru cme-1.024/lib/App/Cme/Command/update.pm cme-1.026/lib/App/Cme/Command/update.pm --- cme-1.024/lib/App/Cme/Command/update.pm 2017-10-22 11:02:22.000000000 +0000 +++ cme-1.026/lib/App/Cme/Command/update.pm 2017-12-18 18:16:40.000000000 +0000 @@ -10,7 +10,7 @@ # ABSTRACT: Update the configuration of an application package App::Cme::Command::update ; -$App::Cme::Command::update::VERSION = '1.024'; +$App::Cme::Command::update::VERSION = '1.026'; use strict; use warnings; use 5.10.1; @@ -92,7 +92,7 @@ =head1 VERSION -version 1.024 +version 1.026 =head1 SYNOPSIS diff -Nru cme-1.024/lib/App/Cme/Common.pm cme-1.026/lib/App/Cme/Common.pm --- cme-1.024/lib/App/Cme/Common.pm 2017-10-22 11:02:22.000000000 +0000 +++ cme-1.026/lib/App/Cme/Common.pm 2017-12-18 18:16:40.000000000 +0000 @@ -10,12 +10,12 @@ #ABSTRACT: Common methods for App::Cme package App::Cme::Common; -$App::Cme::Common::VERSION = '1.024'; +$App::Cme::Common::VERSION = '1.026'; use strict; use warnings; use 5.10.1; -use Config::Model 2.103; +use Config::Model 2.116; use Config::Model::Lister; use Pod::POM; use Pod::POM::View::Text; @@ -38,9 +38,9 @@ [ "root-dir=s" => "Change root directory. Mostly used for test"], [ "file=s" => "Specify a target file"], # to be deprecated - [ "backend=s" => "Specify a read/write backend"], + [ "canonical!" => "write back config data according to canonical order" ], [ "trace|stack-trace!" => "Provides a full stack trace when exiting on error"], - [ "verbose=s" => "Verbosity level (1, 2, 3 or info, debug, trace)"], + [ "verbose=s" => "Verbosity level (1, 2, 3 or info, debug, trace)"], # no bundling { getopt_conf => [ qw/no_bundling/ ] } ); @@ -162,22 +162,22 @@ sub instance { my ($self, $opt, $args) = @_; - return - $self->{_instance} - ||= $self->model->instance( + my %instance_args = ( root_class_name => $opt->{_root_model}, instance_name => $opt->{_application}, application => $opt->{_application}, - root_dir => $opt->{root_dir}, check => $opt->{force_load} ? 'no' : 'yes', auto_create => $opt->{create}, - backend => $opt->{backend}, backend_arg => $opt->{_backend_arg}, - backup => $opt->{backup}, config_file => $opt->{_config_file}, config_dir => $opt->{_config_dir}, - ); + ); + + foreach my $param (qw/root_dir canonical backup/) { + $instance_args{$param} = $opt->{$param} if defined $opt->{$param}; + } + return $self->{_instance} ||= $self->model->instance(%instance_args); } sub init_cme { @@ -270,7 +270,7 @@ =head1 VERSION -version 1.024 +version 1.026 =head1 SYNOPSIS diff -Nru cme-1.024/lib/App/Cme.pm cme-1.026/lib/App/Cme.pm --- cme-1.024/lib/App/Cme.pm 2017-10-22 11:02:22.000000000 +0000 +++ cme-1.026/lib/App/Cme.pm 2017-12-18 18:16:40.000000000 +0000 @@ -8,7 +8,7 @@ # The GNU Lesser General Public License, Version 2.1, February 1999 # package App::Cme ; -$App::Cme::VERSION = '1.024'; +$App::Cme::VERSION = '1.026'; use strict; use warnings; use 5.10.1; @@ -33,7 +33,7 @@ =head1 VERSION -version 1.024 +version 1.026 =head1 AUTHOR @@ -94,7 +94,7 @@ CPAN Testers -The CPAN Testers is a network of smokers who run automated tests on uploaded CPAN distributions. +The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions. L diff -Nru cme-1.024/META.json cme-1.026/META.json --- cme-1.024/META.json 2017-10-22 11:02:22.000000000 +0000 +++ cme-1.026/META.json 2017-12-18 18:16:40.000000000 +0000 @@ -31,7 +31,7 @@ }, "requires" : { "App::Cmd::Setup" : "0", - "Config::Model" : "2.103", + "Config::Model" : "2.116", "Config::Model::FuseUI" : "0", "Config::Model::Lister" : "0", "Config::Model::ObjTreeScanner" : "0", @@ -75,7 +75,7 @@ "web" : "http://github.com/dod38fr/cme-perl" } }, - "version" : "1.024", + "version" : "1.026", "x_serialization_backend" : "JSON::XS version 3.04" } diff -Nru cme-1.024/META.yml cme-1.026/META.yml --- cme-1.024/META.yml 2017-10-22 11:02:22.000000000 +0000 +++ cme-1.026/META.yml 2017-12-18 18:16:40.000000000 +0000 @@ -23,7 +23,7 @@ Tk: '0' requires: App::Cmd::Setup: '0' - Config::Model: '2.103' + Config::Model: '2.116' Config::Model::FuseUI: '0' Config::Model::Lister: '0' Config::Model::ObjTreeScanner: '0' @@ -46,5 +46,5 @@ bugtracker: https://github.com/dod38fr/cme-perl/issues homepage: https://github.com/dod38fr/config-model/wiki repository: https://github.com/dod38fr/cme-perl.git -version: '1.024' +version: '1.026' x_serialization_backend: 'YAML::Tiny version 1.70' diff -Nru cme-1.024/t/cme-command.t cme-1.026/t/cme-command.t --- cme-1.024/t/cme-command.t 2017-10-22 11:02:22.000000000 +0000 +++ cme-1.026/t/cme-command.t 2017-12-18 18:16:40.000000000 +0000 @@ -80,7 +80,7 @@ subtest "minimal modification" => sub { # test minimal modif (re-order) - my @test_cmd = (qw/modify popcon -save -backup -root-dir/, $wr_dir->stringify); + my @test_cmd = (qw/modify popcon -save -backup -canonical -root-dir/, $wr_dir->stringify); my $ok = test_app( 'App::Cme' => \@test_cmd ); is ($ok->exit_code, 0, 'all went well' ) or diag("Failed command cme @test_cmd"); is($ok->error, undef, 'threw no exceptions');