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: Update the configuration of an application |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
$App::Cme::Command::update::VERSION = '1.038'; |
13
|
|
|
|
|
|
|
use strict; |
14
|
1
|
|
|
1
|
|
592
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
15
|
1
|
|
|
1
|
|
4
|
use 5.10.1; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
16
|
1
|
|
|
1
|
|
8
|
|
|
1
|
|
|
|
|
2
|
|
17
|
|
|
|
|
|
|
use App::Cme -command ; |
18
|
1
|
|
|
1
|
|
5
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
19
|
|
|
|
|
|
|
use base qw/App::Cme::Common/; |
20
|
1
|
|
|
1
|
|
265
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
82
|
|
21
|
|
|
|
|
|
|
use Config::Model::ObjTreeScanner; |
22
|
1
|
|
|
1
|
|
6
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
19
|
|
23
|
|
|
|
|
|
|
use Config::Model; |
24
|
1
|
|
|
1
|
|
3
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
391
|
|
25
|
|
|
|
|
|
|
my ($self, $opt, $args) = @_; |
26
|
|
|
|
|
|
|
$self->check_unknown_args($args); |
27
|
0
|
|
|
0
|
1
|
|
$self->process_args($opt,$args); |
28
|
0
|
|
|
|
|
|
return; |
29
|
0
|
|
|
|
|
|
} |
30
|
0
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
my ( $class, $app ) = @_; |
32
|
|
|
|
|
|
|
return ( |
33
|
|
|
|
|
|
|
[ "edit!" => "Run editor after update is done" ], |
34
|
0
|
|
|
0
|
1
|
|
[ "backup:s" => "Create a backup of configuration files before saving." ], |
35
|
|
|
|
|
|
|
$class->cme_global_options, |
36
|
0
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
my ($self) = @_; |
40
|
|
|
|
|
|
|
my $desc = $self->SUPER::usage_desc; # "%c COMMAND %o" |
41
|
|
|
|
|
|
|
return "$desc [application] [file ]"; |
42
|
|
|
|
|
|
|
} |
43
|
0
|
|
|
0
|
1
|
|
|
44
|
0
|
|
|
|
|
|
my ($self) = @_; |
45
|
0
|
|
|
|
|
|
return $self->get_documentation; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
my ($self, $opt, $args) = @_; |
49
|
0
|
|
|
0
|
1
|
|
|
50
|
0
|
|
|
|
|
|
my ( $inst) = $self->instance($opt,$args); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
say "Updating data..." unless $opt->{quiet}; |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
0
|
1
|
|
my @msgs = $inst->update(quiet => $opt->{quiet}); |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
if (@msgs and not $opt->{quiet}) { |
57
|
|
|
|
|
|
|
say "Update done"; |
58
|
0
|
0
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
elsif (not $opt->{quiet}) { |
60
|
0
|
|
|
|
|
|
say "Command done, but ".$opt->{_application} |
61
|
|
|
|
|
|
|
. " model has no provision for update"; |
62
|
0
|
0
|
0
|
|
|
|
} |
|
|
0
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
if ($opt->{edit}) { |
65
|
|
|
|
|
|
|
say join("\n", grep {defined $_} @msgs ); |
66
|
|
|
|
|
|
|
$self->run_tk_ui ( $inst, $opt); |
67
|
0
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
else { |
69
|
|
|
|
|
|
|
$self->save($inst,$opt) ; |
70
|
0
|
0
|
|
|
|
|
say join("\n", grep {defined $_} @msgs ); |
71
|
0
|
|
|
|
|
|
} |
|
0
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
return; |
74
|
|
|
|
|
|
|
} |
75
|
0
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
|
1; |
|
0
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
|
=pod |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=encoding UTF-8 |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 NAME |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
App::Cme::Command::update - Update the configuration of an application |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 VERSION |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
version 1.038 |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 SYNOPSIS |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
cme update <application> |
94
|
|
|
|
|
|
|
# example: cme update dpkg-copyright |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 DESCRIPTION |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Update a configuration file. The update is done scanning external |
99
|
|
|
|
|
|
|
resource. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
For instance, C<cme update dpkg-copyright> command can be used to |
102
|
|
|
|
|
|
|
update a specific Debian package file (C<debian/copyright>). This is |
103
|
|
|
|
|
|
|
done by scanning the headers of source files. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Currently, only dpkg-copyright application currently supports updates. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
The configuration data (i.e. the content of C<debian/copyright> in |
108
|
|
|
|
|
|
|
this example) is mapped to a tree structure inside L<cme>. You can: |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=over 4 |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=item * |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
view this structure in YAML format by running C<cme dump dpkg-copyright> |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=item * |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
view this structure in Config::Model's format (aka C<cml>) by running |
119
|
|
|
|
|
|
|
C<cme dump -format cml dpkg-copyright>. This format is documented in |
120
|
|
|
|
|
|
|
L<Config::Model::Loader>. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=item * |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
get a graphical view with C<cme edit dpkg-copyright>. |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=back |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 Common options |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
See L<cme/"Global Options">. |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head1 options |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=over |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=item -open-item |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Open a specific item of the configuration when opening the editor |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=back |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head1 SEE ALSO |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
L<cme> |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head1 AUTHOR |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
Dominique Dumont |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
This software is Copyright (c) 2014-2022 by Dominique Dumont <ddumont@cpan.org>. |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
This is free software, licensed under: |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
The GNU Lesser General Public License, Version 2.1, February 1999 |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=cut |