blib/lib/DBIx/Changeset/App/Command/compare.pm

filter: Statementstmt 64.8% 24 / 37 Branchbran 12.5% 1 / 8 Conditioncond 42.4% 14 / 33 MC/DCmcdc 0.0% 0 / 14 Subroutinesub 90.0% 9 / 10 Podpod 100% 3 / 3 totaltotal 48.5% 51 / 105 CC 18 SCAR 31.5
CC
18
Cov
50%
options
43.1
run
12.0
validate
6.6
CRAP 23.3
« blib/lib/DBIx/Changeset/App/Command/applied.pm ↑ Summary blib/lib/DBIx/Changeset/HistoryRecord.pm »
1 package DBIx::Changeset::App::Command::compare;
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::Collection;
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::compare - display a list of outstanding changesets
18  
19 =head1 SYNOPSIS
20  
21 =head1 METHODS
22  
23 =head2 run
24  
25 =cut
26 0 ▶sub run {
Subroutine run: not called CC=3 SCAR=24.8
Pod documented
27 0 my ($self, $opt, $args) = @_;
28  
29 my $coll = DBIx::Changeset::Collection->new($opt->{'type'}, {
30 0 changeset_location => $opt->{'location'},
31 });
32
33 0 eval { $coll->retrieve_all(); };
34 0 my $e;
35 0 ▶ if ( $e = Exception::Class->caught() ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($e = "Exception::Class"->caught) 0 0 0
36 0 warn $e->error, "\n";
37 0 ▶ warn $e->trace->as_string, "\n" if defined $opt->{'debug'};
Branch: 1 branch
BranchTrueFalseTotal
if defined $opt->{"debug"} 0 0 0
38 0 exit;
39 }
40  
41 0 $self->determine_outstanding($opt,$coll);
42  
43  
44  
45 0 return;
46 }
47  
48 =head2 options
49  
50 define the options for the create command
51  
52 =cut
53  
54 3 ▶sub options {
Subroutine options: called CC=13 SCAR=37.6
Pod documented
55 3 my ($self, $app) = @_;
56 return (
57 [ 'location=s' => 'Path to changeset files', { default => $app->{'config'}->{'location'} || $app->{'config'}->{'update'}->{'location'} || undef, required => 1 } ],
58 [ 'type=s' => 'Which factory to use (default disk)', { default => $app->{'config'}->{'type'} || $app->{'config'}->{'update'}->{'type'} || 'disk' } ],
59 [ 'like=s' => 'only types matching regex', { default => $app->{'config'}->{'like'} || $app->{'config'}->{'update'}->{'like'} || undef } ],
60 [ '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 } ],
61 [ 'history_db_user=s' => 'db user for history db', { default => $app->{'config'}->{'history_db_user'} || $app->{'config'}->{'bootstrap'}->{'history_db_user'} || undef } ],
62 3 ▶ [ 'history_db_password=s' => 'db password for the history db user', { default => $app->{'config'}->{'history_db_password'} || $app->{'config'}->{'update'}->{'history_db_password'} || undef } ],
Condition40%12/30
$app->{'config'}{'location'} || $app->{'config'}{'update'}{'location'} || undef
l!l
03
$app->{"config"}{"location"} or $app->{"config"}{"update"}{"location"}
l!l&&r!l&&!r
003
$app->{'config'}{'type'} || $app->{'config'}{'update'}{'type'} || 'disk'
l!l
03
$app->{"config"}{"type"} or $app->{"config"}{"update"}{"type"}
l!l&&r!l&&!r
003
$app->{'config'}{'like'} || $app->{'config'}{'update'}{'like'} || undef
l!l
03
$app->{"config"}{"like"} or $app->{"config"}{"update"}{"like"}
l!l&&r!l&&!r
003
$app->{'config'}{'history_db_dsn'} || $app->{'config'}{'bootstrap'}{'history_db_dsn'} || undef
l!l
03
$app->{"config"}{"history_db_dsn"} or $app->{"config"}{"bootstrap"}{"history_db_dsn"}
l!l&&r!l&&!r
003
$app->{'config'}{'history_db_user'} || $app->{'config'}{'bootstrap'}{'history_db_user'} || undef
l!l
03
$app->{"config"}{"history_db_user"} or $app->{"config"}{"bootstrap"}{"history_db_user"}
l!l&&r!l&&!r
003
$app->{'config'}{'history_db_password'} || $app->{'config'}{'update'}{'history_db_password'} || undef
l!l
03
$app->{"config"}{"history_db_password"} or $app->{"config"}{"update"}{"history_db_password"}
l!l&&r!l&&!r
003
MC/DC0%0/2
$app->{'config'}{'location'} || $app->{'config'}{'update'}{'location'} || undef
$app->{"config"}{"location"} $app->{"config"}{"update"}{"location"}
MC/DC0%0/2
$app->{'config'}{'type'} || $app->{'config'}{'update'}{'type'} || 'disk'
$app->{"config"}{"type"} $app->{"config"}{"update"}{"type"}
MC/DC0%0/2
$app->{'config'}{'like'} || $app->{'config'}{'update'}{'like'} || undef
$app->{"config"}{"like"} $app->{"config"}{"update"}{"like"}
MC/DC0%0/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 table33%1/3
A or B
A= $app->{"config"}{"location"}B= $app->{"config"}{"update"}{"location"}
ABresult
1X1
011
000
Truth table33%1/3
A or B
A= $app->{"config"}{"type"}B= $app->{"config"}{"update"}{"type"}
ABresult
1X1
011
000
Truth table33%1/3
A or B
A= $app->{"config"}{"like"}B= $app->{"config"}{"update"}{"like"}
ABresult
1X1
011
000
Truth table33%1/3
A or B
A= $app->{"config"}{"history_db_dsn"}B= $app->{"config"}{"bootstrap"}{"history_db_dsn"}
ABresult
1X1
011
000
Truth table33%1/3
A or B
A= $app->{"config"}{"history_db_user"}B= $app->{"config"}{"bootstrap"}{"history_db_user"}
ABresult
1X1
011
000
Truth table33%1/3
A or B
A= $app->{"config"}{"history_db_password"}B= $app->{"config"}{"update"}{"history_db_password"}
ABresult
1X1
011
000
63  
64 );
65 }
66  
67 =head2 validate
68  
69 define the options validation for the compare command
70  
71 =cut
72  
73 2 ▶sub validate {
Subroutine validate: called CC=4 SCAR=18.9
Pod documented
74 2 my ($self,$opt,$args) = @_;
75 2 ▶ $self->usage_error('This command requires a valid changeset location') unless ( ( defined $opt->{'location'} ) && ( -d $opt->{'location'} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $opt->{"location"} and -d $opt->{"location"} 2 0 2
Condition66%2/3
defined $opt->{"location"} and -d $opt->{"location"}
!ll&&!rl&&r
110
MC/DC0%0/2
defined $opt->{"location"} and -d $opt->{"location"}
defined $opt->{"location"} -d $opt->{"location"}
Truth table66%2/3
A and B
A= defined $opt->{"location"}B= -d $opt->{"location"}
ABresult
0X0
100
111
76 0 ▶ $self->usage_error('This command requires a history_db_dsn') unless ( defined $opt->{'history_db_dsn'} );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $opt->{"history_db_dsn"} 0 0 0
77 0 return;
78 }
79  
80 =head1 COPYRIGHT & LICENSE
81  
82 Copyright 2004-2008 Grox Pty Ltd.
83  
84 This program is free software; you can redistribute it and/or modify it
85 under the same terms as Perl itself.
86  
87 The full text of the license can be found in the LICENSE file included with this module.
88  
89 =cut
90  
91 3 1; # End of DBIx::Changeset
« blib/lib/DBIx/Changeset/App/Command/applied.pm ↑ Summary blib/lib/DBIx/Changeset/HistoryRecord.pm »