line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DBIx::Changeset::App::Command::bootstrap; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
4546
|
use warnings; |
|
2
|
|
|
|
|
62
|
|
|
2
|
|
|
|
|
75
|
|
4
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
76
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
12
|
use base qw/DBIx::Changeset::App::BaseCommand/; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
188
|
|
7
|
2
|
|
|
2
|
|
12
|
use DBIx::Changeset::History; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
20
|
|
8
|
2
|
|
|
2
|
|
73
|
use DBIx::Changeset::Exception; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
47
|
|
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
10
|
use vars qw{$VERSION}; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
104
|
|
11
|
|
|
|
|
|
|
BEGIN { |
12
|
2
|
|
|
2
|
|
788
|
$VERSION = '1.11'; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 NAME |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
DBIx::Changeset::App::Command::bootstrap - set up the changeset history record db |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 SYNOPSIS |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 METHODS |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head2 execute |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=cut |
26
|
|
|
|
|
|
|
sub execute { |
27
|
1
|
|
|
1
|
1
|
7
|
my ($self, $opt, $args) = @_; |
28
|
1
|
|
|
|
|
17
|
my $hrec = DBIx::Changeset::History->new({ |
29
|
|
|
|
|
|
|
history_db_dsn => $opt->{'history_db_dsn'}, |
30
|
|
|
|
|
|
|
history_db_user => $opt->{'history_db_user'}, |
31
|
|
|
|
|
|
|
history_db_password => $opt->{'history_db_password'}, |
32
|
|
|
|
|
|
|
}); |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
0
|
eval { $hrec->init_history_table(); }; |
|
0
|
|
|
|
|
0
|
|
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
0
|
my $e; |
37
|
0
|
0
|
|
|
|
0
|
if ( $e = Exception::Class->caught() ) { |
38
|
0
|
|
|
|
|
0
|
warn $e->error, "\n"; |
39
|
0
|
0
|
|
|
|
0
|
warn $e->trace->as_string, "\n" if defined $opt->{'debug'}; |
40
|
0
|
|
|
|
|
0
|
exit; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
0
|
print "Bootstrap complete.\n"; |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
0
|
return; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head2 options |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
define the options for the create command |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub options { |
55
|
3
|
|
|
3
|
1
|
8
|
my ($self, $app) = @_; |
56
|
|
|
|
|
|
|
return ( |
57
|
3
|
|
50
|
|
|
102
|
[ 'history_db_dsn=s' => 'DBI DSN for the history db', { default => $app->{'config'}->{'history_db_dsn'} || $app->{'config'}->{'bootstrap'}->{'history_db_dsn'} || undef, required => 1 } ], |
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
58
|
|
|
|
|
|
|
[ 'history_db_user=s' => 'db user for history db', { default => $app->{'config'}->{'history_db_user'} || $app->{'config'}->{'bootstrap'}->{'history_db_user'} || undef } ], |
59
|
|
|
|
|
|
|
[ 'history_db_password=s' => 'db password for the history db user', { default => $app->{'config'}->{'history_db_password'} || $app->{'config'}->{'update'}->{'history_db_password'} || undef } ], |
60
|
|
|
|
|
|
|
); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head2 validate |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
define the options validation for the compare command |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=cut |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub validate { |
70
|
2
|
|
|
2
|
1
|
6
|
my ($self,$opt,$args) = @_; |
71
|
2
|
100
|
|
|
|
20
|
$self->usage_error('This command requires a history_db_dsn') unless (defined $opt->{'history_db_dsn'}); |
72
|
1
|
|
|
|
|
3
|
return; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Copyright 2004-2008 Grox Pty Ltd. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
80
|
|
|
|
|
|
|
under the same terms as Perl itself. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
The full text of the license can be found in the LICENSE file included with this module. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
1; # End of DBIx::Changeset |