line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tapper::CLI::DbDeploy::Command::init; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TAPPER'; |
3
|
|
|
|
|
|
|
$Tapper::CLI::DbDeploy::Command::init::VERSION = '5.0.6'; |
4
|
1
|
|
|
1
|
|
890
|
use 5.010; |
|
1
|
|
|
|
|
4
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
7
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
6
|
use parent 'App::Cmd::Command'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
69
|
use Tapper::CLI::DbDeploy; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
11
|
|
12
|
1
|
|
|
1
|
|
796
|
use Tapper::Cmd::DbDeploy; |
|
1
|
|
|
|
|
133156
|
|
|
1
|
|
|
|
|
43
|
|
13
|
1
|
|
|
1
|
|
10
|
use Data::Dumper; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
53
|
|
14
|
1
|
|
|
1
|
|
7
|
use Tapper::Schema::TestrunDB; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
331
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub opt_spec { |
18
|
|
|
|
|
|
|
return ( |
19
|
0
|
|
|
0
|
1
|
|
[ "verbose", "some more informational output" ], |
20
|
|
|
|
|
|
|
[ "db=s", "STRING, one of: ReportsDB, TestrunDB" ], |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub abstract { |
25
|
0
|
|
|
0
|
1
|
|
'Initialize a database from scratch. DANGEROUS! Think twice.' |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub usage_desc |
29
|
|
|
|
|
|
|
{ |
30
|
0
|
|
|
0
|
1
|
|
my ($self, $opt, $args) = @_; |
31
|
0
|
|
|
|
|
|
my $allowed_opts = join ' ', map { '--'.$_ } $self->_allowed_opts(); |
|
0
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
"tapper-db-deploy init --db=DBNAME [ --verbose ]"; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub _allowed_opts { |
36
|
0
|
|
|
0
|
|
|
my ($self, $opt, $args) = @_; |
37
|
0
|
|
|
|
|
|
my @allowed_opts = map { $_->[0] } $self->opt_spec(); |
|
0
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub validate_args { |
41
|
0
|
|
|
0
|
1
|
|
my ($self, $opt, $args) = @_; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# print "opt = ", Dumper($opt); |
44
|
|
|
|
|
|
|
# print "args = ", Dumper($args); |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
my $ok = 1; |
47
|
0
|
0
|
|
|
|
|
if (not $opt->{db}) |
|
|
0
|
|
|
|
|
|
48
|
|
|
|
|
|
|
{ |
49
|
0
|
|
|
|
|
|
say "Missing argument --db\n"; |
50
|
0
|
|
|
|
|
|
$ok = 0; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
elsif (not $opt->{db} = 'TestrunDB' ) |
53
|
|
|
|
|
|
|
{ |
54
|
0
|
|
|
|
|
|
say "Wrong DB name '".$opt->{db}."' (must be TestrunDB)"; |
55
|
0
|
|
|
|
|
|
$ok = 0; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
0
|
0
|
|
|
|
|
return $ok if $ok; |
59
|
0
|
|
|
|
|
|
die $self->usage->text; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub run |
63
|
|
|
|
|
|
|
{ |
64
|
0
|
|
|
0
|
0
|
|
my ($self, $opt, $args) = @_; |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
my $cmd = Tapper::Cmd::DbDeploy->new; |
67
|
0
|
|
|
|
|
|
$cmd->dbdeploy($opt->{db}); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# perl -Ilib bin/tapper-db-deploy init --db=TestrunDB |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
1; |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
__END__ |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=pod |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=encoding UTF-8 |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 NAME |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Tapper::CLI::DbDeploy::Command::init |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 AUTHOR |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
AMD OSRC Tapper Team <tapper@amd64.org> |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
This software is Copyright (c) 2020 by Advanced Micro Devices, Inc.. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
This is free software, licensed under: |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
The (two-clause) FreeBSD License |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=cut |