blib/lib/Dist/Inkt/Role/Hg.pm

filter: Statementstmt 58.1% 25 / 43 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 63.6% 7 / 11 Podpod n/a totaltotal 51.6% 32 / 62 CC 6 SCAR 20.7
CC
6
Cov
49%
__ANON__
20.0
__ANON__
12.0
_build_source_control_is_hg
2.0
CRAP 7.9
↑ Summary
1 1 ▶use 5.010001;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package Dist::Inkt::Role::Hg;
6  
7 1 our $AUTHORITY = 'cpan:TOBYINK';
8 1 our $VERSION = '0.004';
9  
10 1 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use File::chdir;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use Types::Standard 'Bool';
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 1 has source_control_is_hg => (
16 is => "ro",
17 isa => Bool,
18 lazy => 1,
19 builder => "_build_source_control_is_hg",
20 );
21  
22 sub _build_source_control_is_hg
23 0 ▶{
Subroutine _build_source_control_is_hg: not called CC=1 SCAR=6.9
24 0 my $self = shift;
25 0 !! $self->rootdir->child(".hg")->is_dir;
26 }
27  
28 after BUILD => sub
29 0 ▶{
Subroutine __ANON__: not called CC=4 SCAR=30.0
30 0 my $self = shift;
31 0 ▶ return unless $self->source_control_is_hg;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->source_control_is_hg 0 0 0
32
33 0 ▶ $self->setup_prerelease_action(sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
34 0 local $CWD = $self->rootdir;
35 0 my @stat =
36 grep !/^\?(.+)\.tar.gz/, # allow the recently built tarball!
37 grep /\w/,
38 split /\r?\n/,
39 `hg status`;
40 0 ▶ if (@stat) {
Branch: 1 branch
BranchTrueFalseTotal
if (@stat) 0 0 0
41 0 $self->log("Mercurial has uncommitted changes - please commit them");
42 0 $self->log($_) for @stat;
43 0 system("/bin/sh");
44 }
45 0 ▶ }) if $self->can("setup_prerelease_action");
Branch: 1 branch
BranchTrueFalseTotal
if $self->can("setup_prerelease_action") 0 0 0
46
47 0 ▶ $self->setup_postrelease_action(sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
48 0 my $self = shift;
49 0 local $CWD = $self->rootdir;
50 0 $self->log("hg tag " . $self->version);
51 0 system("hg", "tag", $self->version);
52 0 $self->log("hg push");
53 0 system("hg", "push");
54 0 ▶ }) if $self->can("setup_postrelease_action");
Branch: 1 branch
BranchTrueFalseTotal
if $self->can("setup_postrelease_action") 0 0 0
55 1 };
56  
57 1 1;
58  
59 __END__
↑ Summary