File Coverage

blib/lib/App/bif/drop/issue.pm
Criterion Covered Total %
statement 12 23 52.1
branch 0 2 0.0
condition n/a
subroutine 4 5 80.0
pod 1 1 100.0
total 17 31 54.8


line stmt bran cond sub pod time code
1             package App::bif::drop::issue;
2 1     1   3226 use strict;
  1         1  
  1         34  
3 1     1   3 use warnings;
  1         2  
  1         27  
4 1     1   3 use Bif::Mo;
  1         2  
  1         5  
5              
6             our $VERSION = '0.1.5_5';
7             extends 'App::bif';
8              
9             sub run {
10 1     1 1 1 my $self = shift;
11 1         3 my $opts = $self->opts;
12 1         5 my $dbw = $self->dbw;
13 0           my $info = $self->get_node( $opts->{id}, 'issue' );
14              
15 0 0         if ( !$opts->{force} ) {
16 0           print "Nothing dropped (missing --force, -f)\n";
17 0           return $self->ok('DropNoForce');
18             }
19              
20 0           my $uuid = substr( $info->{uuid}, 0, 8 );
21              
22             $dbw->txn(
23             sub {
24 0     0     $self->start_work(
25             start => time,
26             start_comment => "drop issue $info->{id} <$uuid>",
27             billable => 0,
28             save => 1,
29             );
30              
31             $dbw->xdo(
32             delete_from => 'issues',
33             where => { id => $info->{id} },
34 0           );
35              
36 0           print "Issue dropped: $info->{id} <$uuid>\n";
37              
38 0           $self->stop_work(
39             stop => time,
40             restore => 1,
41             );
42             }
43 0           );
44              
45 0           return $self->ok('DropIssue');
46             }
47              
48             1;
49             __END__