| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | # | 
| 2 |  |  |  |  |  |  | # This file is part of App-Cme | 
| 3 |  |  |  |  |  |  | # | 
| 4 |  |  |  |  |  |  | # This software is Copyright (c) 2014-2022 by Dominique Dumont <ddumont@cpan.org>. | 
| 5 |  |  |  |  |  |  | # | 
| 6 |  |  |  |  |  |  | # This is free software, licensed under: | 
| 7 |  |  |  |  |  |  | # | 
| 8 |  |  |  |  |  |  | #   The GNU Lesser General Public License, Version 2.1, February 1999 | 
| 9 |  |  |  |  |  |  | # | 
| 10 |  |  |  |  |  |  | # ABSTRACT: Migrate the configuration of an application | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  | $App::Cme::Command::migrate::VERSION = '1.038'; | 
| 13 |  |  |  |  |  |  | use strict; | 
| 14 | 1 |  |  | 1 |  | 647 | use warnings; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 25 |  | 
| 15 | 1 |  |  | 1 |  | 4 | use 5.10.1; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 19 |  | 
| 16 | 1 |  |  | 1 |  | 8 |  | 
|  | 1 |  |  |  |  | 5 |  | 
| 17 |  |  |  |  |  |  | use App::Cme -command ; | 
| 18 | 1 |  |  | 1 |  | 5 |  | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 7 |  | 
| 19 |  |  |  |  |  |  | use base qw/App::Cme::Common/; | 
| 20 | 1 |  |  | 1 |  | 264 |  | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 72 |  | 
| 21 |  |  |  |  |  |  | use Config::Model::ObjTreeScanner; | 
| 22 | 1 |  |  | 1 |  | 6 |  | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 229 |  | 
| 23 |  |  |  |  |  |  | my ($self, $opt, $args) = @_; | 
| 24 |  |  |  |  |  |  | $self->check_unknown_args($args); | 
| 25 | 0 |  |  | 0 | 1 |  | $self->process_args($opt,$args); | 
| 26 | 0 |  |  |  |  |  | return; | 
| 27 | 0 |  |  |  |  |  | } | 
| 28 | 0 |  |  |  |  |  |  | 
| 29 |  |  |  |  |  |  | my ( $class, $app ) = @_; | 
| 30 |  |  |  |  |  |  | return ( | 
| 31 |  |  |  |  |  |  | [ "backup:s"  => "Create a backup of configuration files before saving." ], | 
| 32 | 0 |  |  | 0 | 1 |  | $class->cme_global_options, | 
| 33 |  |  |  |  |  |  | ); | 
| 34 | 0 |  |  |  |  |  | } | 
| 35 |  |  |  |  |  |  |  | 
| 36 |  |  |  |  |  |  | my ($self) = @_; | 
| 37 |  |  |  |  |  |  | my $desc = $self->SUPER::usage_desc; # "%c COMMAND %o" | 
| 38 |  |  |  |  |  |  | return "$desc [application] [file ]"; | 
| 39 |  |  |  |  |  |  | } | 
| 40 | 0 |  |  | 0 | 1 |  |  | 
| 41 | 0 |  |  |  |  |  | my ($self) = @_; | 
| 42 | 0 |  |  |  |  |  | return $self->get_documentation; | 
| 43 |  |  |  |  |  |  | } | 
| 44 |  |  |  |  |  |  |  | 
| 45 |  |  |  |  |  |  | my ($self, $opt, $args) = @_; | 
| 46 | 0 |  |  | 0 | 1 |  |  | 
| 47 | 0 |  |  |  |  |  | my ($model, $inst, $root) = $self->init_cme($opt,$args); | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  | $root->migrate; | 
| 50 |  |  |  |  |  |  |  | 
| 51 | 0 |  |  | 0 | 1 |  | $self->save($inst,$opt) ; | 
| 52 |  |  |  |  |  |  | return; | 
| 53 | 0 |  |  |  |  |  | } | 
| 54 |  |  |  |  |  |  |  | 
| 55 | 0 |  |  |  |  |  | 1; | 
| 56 |  |  |  |  |  |  |  | 
| 57 | 0 |  |  |  |  |  |  | 
| 58 | 0 |  |  |  |  |  | =pod | 
| 59 |  |  |  |  |  |  |  | 
| 60 |  |  |  |  |  |  | =encoding UTF-8 | 
| 61 |  |  |  |  |  |  |  | 
| 62 |  |  |  |  |  |  | =head1 NAME | 
| 63 |  |  |  |  |  |  |  | 
| 64 |  |  |  |  |  |  | App::Cme::Command::migrate - Migrate the configuration of an application | 
| 65 |  |  |  |  |  |  |  | 
| 66 |  |  |  |  |  |  | =head1 VERSION | 
| 67 |  |  |  |  |  |  |  | 
| 68 |  |  |  |  |  |  | version 1.038 | 
| 69 |  |  |  |  |  |  |  | 
| 70 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 71 |  |  |  |  |  |  |  | 
| 72 |  |  |  |  |  |  | # check dpkg files, update deprecated parameters and save | 
| 73 |  |  |  |  |  |  | cme migrate dpkg | 
| 74 |  |  |  |  |  |  |  | 
| 75 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 76 |  |  |  |  |  |  |  | 
| 77 |  |  |  |  |  |  | Checks the content of the configuration file of an application (and show | 
| 78 |  |  |  |  |  |  | warnings if needed), update deprecated parameters (old value are saved | 
| 79 |  |  |  |  |  |  | to new parameters) and save the new configuration. See L<App::Cme::Command::migrate>. | 
| 80 |  |  |  |  |  |  |  | 
| 81 |  |  |  |  |  |  | For more details, see L<Config::Model::Value/Upgrade> | 
| 82 |  |  |  |  |  |  |  | 
| 83 |  |  |  |  |  |  | =head1 Common options | 
| 84 |  |  |  |  |  |  |  | 
| 85 |  |  |  |  |  |  | See L<cme/"Global Options">. | 
| 86 |  |  |  |  |  |  |  | 
| 87 |  |  |  |  |  |  | =head1 SEE ALSO | 
| 88 |  |  |  |  |  |  |  | 
| 89 |  |  |  |  |  |  | L<cme> | 
| 90 |  |  |  |  |  |  |  | 
| 91 |  |  |  |  |  |  | =head1 AUTHOR | 
| 92 |  |  |  |  |  |  |  | 
| 93 |  |  |  |  |  |  | Dominique Dumont | 
| 94 |  |  |  |  |  |  |  | 
| 95 |  |  |  |  |  |  | =head1 COPYRIGHT AND LICENSE | 
| 96 |  |  |  |  |  |  |  | 
| 97 |  |  |  |  |  |  | This software is Copyright (c) 2014-2022 by Dominique Dumont <ddumont@cpan.org>. | 
| 98 |  |  |  |  |  |  |  | 
| 99 |  |  |  |  |  |  | This is free software, licensed under: | 
| 100 |  |  |  |  |  |  |  | 
| 101 |  |  |  |  |  |  | The GNU Lesser General Public License, Version 2.1, February 1999 | 
| 102 |  |  |  |  |  |  |  | 
| 103 |  |  |  |  |  |  | =cut |