| 1 | package DBIx::Changeset::App::Command::bootstrap; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 3 | ▶ | use base qw/DBIx::Changeset::App::BaseCommand/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 3 | ▶ | use DBIx::Changeset::History; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 3 | ▶ | use DBIx::Changeset::Exception; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 3 | ▶ | use vars qw{$VERSION}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 3 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 3 | $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 | 2 | ▶ | sub execute { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
execute: called CC=3 SCAR=21.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 2 | my ($self, $opt, $args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | my $hrec = DBIx::Changeset::History->new({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | history_db_dsn => $opt->{'history_db_dsn'}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | history_db_user => $opt->{'history_db_user'}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 2 | history_db_password => $opt->{'history_db_password'}, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | eval { $hrec->init_history_table(); }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | my $e; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | ▶ | if ( $e = Exception::Class->caught() ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | warn $e->error, "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | ▶ | warn $e->trace->as_string, "\n" if defined $opt->{'debug'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | exit; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | print "Bootstrap complete.\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | =head2 options | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | define the options for the create command | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 4 | ▶ | sub options { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
options: called CC=7 SCAR=23.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 4 | my ($self, $app) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | return ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | [ '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 } ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | [ 'history_db_user=s' => 'db user for history db', { default => $app->{'config'}->{'history_db_user'} || $app->{'config'}->{'bootstrap'}->{'history_db_user'} || undef } ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 4 | ▶ | [ 'history_db_password=s' => 'db password for the history db user', { default => $app->{'config'}->{'history_db_password'} || $app->{'config'}->{'update'}->{'history_db_password'} || undef } ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition53%8/15
$app->{'config'}{'history_db_dsn'} || $app->{'config'}{'bootstrap'}{'history_db_dsn'} || undef
$app->{"config"}{"history_db_dsn"} or $app->{"config"}{"bootstrap"}{"history_db_dsn"}
$app->{'config'}{'history_db_user'} || $app->{'config'}{'bootstrap'}{'history_db_user'} || undef
$app->{"config"}{"history_db_user"} or $app->{"config"}{"bootstrap"}{"history_db_user"}
$app->{'config'}{'history_db_password'} || $app->{'config'}{'update'}{'history_db_password'} || undef
$app->{"config"}{"history_db_password"} or $app->{"config"}{"update"}{"history_db_password"}
MC/DC50%1/2
$app->{'config'}{'history_db_dsn'} || $app->{'config'}{'bootstrap'}{'history_db_dsn'} || undef
$app->{"config"}{"history_db_dsn"}
$app->{"config"}{"bootstrap"}{"history_db_dsn"}
MC/DC0%0/2
$app->{'config'}{'history_db_user'} || $app->{'config'}{'bootstrap'}{'history_db_user'} || undef
$app->{"config"}{"history_db_user"}
$app->{"config"}{"bootstrap"}{"history_db_user"}
MC/DC0%0/2
$app->{'config'}{'history_db_password'} || $app->{'config'}{'update'}{'history_db_password'} || undef
$app->{"config"}{"history_db_password"}
$app->{"config"}{"update"}{"history_db_password"}
Truth table66%2/3
A or B
A= $app->{"config"}{"history_db_dsn"}B= $app->{"config"}{"bootstrap"}{"history_db_dsn"}
Truth table33%1/3
A or B
A= $app->{"config"}{"history_db_user"}B= $app->{"config"}{"bootstrap"}{"history_db_user"}
Truth table33%1/3
A or B
A= $app->{"config"}{"history_db_password"}B= $app->{"config"}{"update"}{"history_db_password"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | =head2 validate | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | define the options validation for the compare command | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 3 | ▶ | sub validate { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
validate: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 3 | my ($self,$opt,$args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 3 | ▶ | $self->usage_error('This command requires a history_db_dsn') unless (defined $opt->{'history_db_dsn'}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 2 | 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 | 3 | 1; # End of DBIx::Changeset | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||