ShipIt/ProjectType.pm

filter: Statementstmt 38.2% 13 / 34 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 44.4% 4 / 9 Podpod 80.0% 4 / 5 totaltotal 37.5% 21 / 56 CC 6 SCAR 29.4
CC
6
Cov
31%
new
42.0
find_version
2.0
update_version
2.0
CRAP 18.9
« ShipIt/Step/FindVersion.pm ↑ Summary ShipIt/ProjectType/Perl/MakeMaker.pm »
1 package ShipIt::ProjectType;
2 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use ShipIt::ProjectType::Perl;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use ShipIt::ProjectType::AutoConf;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use ShipIt::Util qw(find_subclasses);
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 =head1 NAME
8  
9 ShipIt::ProjectType - abstract base class for different types of projects
10  
11 =head1 OVERVIEW
12  
13 Different types of projects (Perl, C, ...) have different conventions
14 and quirks which this abstract base class aims to hide.
15  
16 =head1 SYNOPSIS
17  
18 $pt = $state->pt; # get a ShipIt::ProjectType instance
19  
20 $ver = $pt->find_version;
21 $pt->update_version("1.53");
22 $pt->disttest;
23  
24 =head1 METHODS
25  
26 =cut
27  
28 0 ▶sub new {
Subroutine new: not called CC=6 SCAR=37.4
Pod undocumented
29 0 my ($class) = @_;
30 0 my $pt;
31  
32 # when called as a factory, return the appropriate subtype
33 0 ▶ if ($class eq "ShipIt::ProjectType") {
Branch: 1 branch
BranchTrueFalseTotal
if ($class eq "ShipIt::ProjectType") 0 0 0
34 # returns undef if not a perl project,
35 0 $pt = ShipIt::ProjectType::Perl->new;
36 0 ▶ return $pt if $pt;
Branch: 1 branch
BranchTrueFalseTotal
if $pt 0 0 0
37  
38 0 $pt = ShipIt::ProjectType::AutoConf->new;
39 0 ▶ return $pt if $pt;
Branch: 1 branch
BranchTrueFalseTotal
if $pt 0 0 0
40  
41 0 for my $class (grep {!/::(Perl|AutoConf)$/} find_subclasses($class)) {
42 0 eval "CORE::require $class";
43 0 $pt = $class->new;
44 0 ▶ return $pt if $pt;
Branch: 1 branch
BranchTrueFalseTotal
if $pt 0 0 0
45 }
46  
47 0 die "Unknown project type. Can't find Makefile.PL, Build.PL, configure.ac, etc..";
48 }
49  
50 # if we're being called via ->SUPER::new from child class,
51 # give them their blessed object
52 0 return bless {}, $class;
53 }
54  
55 =head2 find_version
56  
57 Returns current version of project.
58  
59 =cut
60  
61 0 ▶sub find_version {
Subroutine find_version: not called CC=1 SCAR=6.9
Pod documented
62 0 die "ABSTRACT find_version in $_[0]\n";
63 }
64  
65 =head2 update_version($new_ver)
66  
67 Updates version number on disk with provided new version.
68  
69 =cut
70  
71 0 ▶sub update_version {
Subroutine update_version: not called CC=1 SCAR=6.9
Pod documented
72 0 my ($self, $newver) = @_;
73 0 die "ABSTRACT update_version in $self\n";
74 }
75  
76 =head2 disttest
77  
78 Make a dist, then untars that in a temp directory, and does a full
79 build & test on the extracted archive. Returns true if everything
80 succeeds, or dies on failure.
81  
82 =cut
83  
84 0 ▶sub disttest {
Subroutine disttest: not called CC=1 SCAR=6.9
Pod documented
85 0 my ($self) = @_;
86 0 die "ABSTRACT distest in $self\n";
87 }
88  
89 =head2 makedist
90  
91 Runs "make dist" or equivalent, to build the resultant archive to give
92 to users. Dies on failure, or returns the path (relative or absolute)
93 to the dist file.
94  
95 =cut
96  
97 0 ▶sub makedist {
Subroutine makedist: not called CC=1 SCAR=6.9
Pod documented
98 0 my ($self) = @_;
99 0 die "ABSTRACT makedist in $self\n";
100 }
101  
102  
103 2 1;
« ShipIt/Step/FindVersion.pm ↑ Summary ShipIt/ProjectType/Perl/MakeMaker.pm »