| 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 | package App::Cme::Command::migrate ; | ||
| 13 | 1 | $App::Cme::Command::migrate::VERSION = '1.049'; | |
| 14 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 15 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | 1 | ▶ | use 5.10.1; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 17 | |||
| 18 | 1 | ▶ | use App::Cme -command ; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 19 | |||
| 20 | 1 | ▶ | use base qw/App::Cme::Common/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 21 | |||
| 22 | 1 | ▶ | use Config::Model::ObjTreeScanner; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 23 | |||
| 24 | 1 | ▶ | sub validate_args { |
|
Subroutine
validate_args: called CC=1 SCAR=0.0
Pod
documented
| |||
| 25 | 1 | my ($self, $opt, $args) = @_; | |
| 26 | 1 | $self->check_unknown_args($args); | |
| 27 | 1 | $self->process_args($opt,$args); | |
| 28 | 1 | return; | |
| 29 | } | ||
| 30 | |||
| 31 | 1 | ▶ | sub opt_spec { |
|
Subroutine
opt_spec: called CC=1 SCAR=0.0
Pod
documented
| |||
| 32 | 1 | my ( $class, $app ) = @_; | |
| 33 | return ( | ||
| 34 | 1 | [ "backup:s" => "Create a backup of configuration files before saving." ], | |
| 35 | $class->cme_global_options, | ||
| 36 | ); | ||
| 37 | } | ||
| 38 | |||
| 39 | 1 | ▶ | sub usage_desc { |
|
Subroutine
usage_desc: called CC=1 SCAR=0.0
Pod
documented
| |||
| 40 | 1 | my ($self) = @_; | |
| 41 | 1 | my $desc = $self->SUPER::usage_desc; # "%c COMMAND %o" | |
| 42 | 1 | return "$desc [application] [file ]"; | |
| 43 | } | ||
| 44 | |||
| 45 | 0 | ▶ | sub description { |
|
Subroutine
description: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 46 | 0 | my ($self) = @_; | |
| 47 | 0 | return $self->get_documentation; | |
| 48 | } | ||
| 49 | |||
| 50 | 1 | ▶ | sub execute { |
|
Subroutine
execute: called CC=1 SCAR=0.0
Pod
documented
| |||
| 51 | 1 | my ($self, $opt, $args) = @_; | |
| 52 | |||
| 53 | 1 | my ($model, $inst, $root) = $self->init_cme($opt,$args); | |
| 54 | |||
| 55 | 1 | $root->migrate; | |
| 56 | |||
| 57 | # force save to reformat or apply minor changes brought by model | ||
| 58 | 1 | $opt->{save} = 1 ; | |
| 59 | |||
| 60 | 1 | $self->save($inst,$opt) ; | |
| 61 | 1 | return; | |
| 62 | } | ||
| 63 | |||
| 64 | 1 | 1; | |
| 65 | |||
| 66 | __END__ | ||