VCS/None.pm

filter: Statementstmt 35.0% 35 / 100 Branchbran 0.0% 0 / 38 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 52.6% 10 / 19 Podpod 100% 8 / 8 totaltotal 32.1% 53 / 165 CC 20 SCAR 30.5
CC
20
Cov
25%
checkout_project
56.0
export
30.0
tagversion
20.0
CRAP 21.1
« VCS/SVN.pm ↑ Summary
1 package LCFG::Build::VCS::None; # -*-perl-*-
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 # $Id: None.pm.in 35424 2019-01-18 10:01:16Z squinney@INF.ED.AC.UK $
6 # $Source: /var/cvs/dice/LCFG-Build-VCS/lib/LCFG/Build/VCS/None.pm.in,v $
7 # $Revision: 35424 $
8 # $HeadURL: https://svn.lcfg.org/svn/source/tags/LCFG-Build-VCS/LCFG_Build_VCS_0_3_9/lib/LCFG/Build/VCS/None.pm.in $
9 # $Date: 2019-01-18 10:01:16 +0000 (Fri, 18 Jan 2019) $
10  
11 1 our $VERSION = '0.3.9';
12  
13 1 ▶use v5.10;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 1 ▶use File::Copy::Recursive v0.36 ();
Subroutine BEGIN: called CC=1 SCAR=0.0
16 1 ▶use File::HomeDir v0.58 ();
Subroutine BEGIN: called CC=1 SCAR=0.0
17 1 ▶use File::Path ();
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use File::Spec ();
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶use IO::Dir ();
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 1 with 'LCFG::Build::VCS';
23  
24 has 'tagdir' => (
25 is => 'rw',
26 isa => 'Str',
27 lazy => 1,
28 0 ▶ default => sub { File::Spec->catdir( File::HomeDir->my_home(),
Subroutine __ANON__: not called CC=1 SCAR=6.9
29 'lcfgbuild', 'tags' ) },
30 1 );
31  
32 1 has '+id' => ( default => 'None' );
33  
34 # This should give a speed-up in loading
35  
36 1 __PACKAGE__->meta->make_immutable;
37  
38 0 ▶sub checkcommitted {
Subroutine checkcommitted: not called CC=1 SCAR=6.9
Pod documented
39 0 return 1;
40 }
41  
42 0 ▶sub genchangelog {
Subroutine genchangelog: not called CC=1 SCAR=6.9
Pod documented
43 0 return;
44 }
45  
46 0 ▶sub run_cmd {
Subroutine run_cmd: not called CC=1 SCAR=6.9
Pod documented
47 0 return;
48 }
49  
50 0 ▶sub tagversion {
Subroutine tagversion: not called CC=4 SCAR=30.0
Pod documented
51 0 my ( $self, $version ) = @_;
52  
53 0 my $module = $self->module;
54  
55 0 $self->update_changelog($version);
56  
57 0 my $tag = $self->gen_tag($version);
58 0 my $tagdir = File::Spec->catdir( $self->tagdir, $module, $tag );
59  
60 0 ▶ if ( !$self->dryrun ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->dryrun) 0 0 0
61 0 ▶ if ( -d $tagdir ) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $tagdir) 0 0 0
62 0 File::Path::rmtree($tagdir);
63 }
64 0 ▶ File::Copy::Recursive::dircopy( $self->workdir, $tagdir )
Branch: 1 branch
BranchTrueFalseTotal
File::Copy::Recursive::dircopy($self->workdir, $tagdir) or die "Could not tag $module at $version\n" 0 0 0
65 or die "Could not tag $module at $version\n";
66 }
67  
68 0 return;
69 }
70  
71 0 ▶sub export {
Subroutine export: not called CC=5 SCAR=34.0
Pod documented
72 0 my ( $self, $version, $builddir ) = @_;
73  
74 0 my $module = $self->module;
75  
76 0 my $tag = $self->gen_tag($version);
77 0 my $storedir = File::Spec->catdir( $self->tagdir, $module, $tag );
78  
79 0 ▶ if ( !-d $storedir ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-d $storedir) 0 0 0
80 0 die "Could not find stored tag for $version of $module in $storedir\n";
81 }
82  
83 0 my $target = join q{-}, $module, $version;
84 0 my $exportdir = File::Spec->catdir( $builddir, $target );
85  
86 0 ▶ if ( !$self->dryrun ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->dryrun) 0 0 0
87 0 ▶ if ( -d $exportdir ) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $exportdir) 0 0 0
88 0 File::Path::rmtree($exportdir);
89 }
90 0 ▶ File::Copy::Recursive::dircopy( $storedir, $exportdir )
Branch: 1 branch
BranchTrueFalseTotal
File::Copy::Recursive::dircopy($storedir, $exportdir) or die "Could not copy $storedir to $exportdir\n" 0 0 0
91 or die "Could not copy $storedir to $exportdir\n";
92 }
93  
94 0 return $exportdir;
95 }
96  
97 0 ▶sub export_devel {
Subroutine export_devel: not called CC=4 SCAR=30.0
Pod documented
98 0 my ( $self, $version, $builddir ) = @_;
99  
100 0 my $module = $self->module;
101  
102 0 my $target = join q{-}, $module, $version;
103 0 my $exportdir = File::Spec->catdir( $builddir, $target );
104  
105 0 ▶ if ( !$self->dryrun ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->dryrun) 0 0 0
106 0 ▶ if ( -d $exportdir ) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $exportdir) 0 0 0
107 0 File::Path::rmtree($exportdir);
108 }
109 0 my $workdir = $self->workdir;
110 0 ▶ File::Copy::Recursive::dircopy( $workdir, $exportdir )
Branch: 1 branch
BranchTrueFalseTotal
File::Copy::Recursive::dircopy($workdir, $exportdir) or die "Could not copy $workdir to $exportdir\n" 0 0 0
111 or die "Could not copy $workdir to $exportdir\n";
112 }
113  
114 0 return $exportdir;
115  
116 }
117  
118 0 ▶sub checkout_project {
Subroutine checkout_project: not called CC=7 SCAR=40.3
Pod documented
119 0 my ( $self, $version, $outdir ) = @_;
120  
121 0 my $module = $self->module;
122 0 my $basedir = File::Spec->catdir( $self->tagdir, $module );
123  
124 0 ▶ if ( !-d $basedir ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-d $basedir) 0 0 0
125 0 die "Could not find the tag directory for $module\n";
126 }
127  
128 0 my $tag;
129 0 ▶ if ( defined $version ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $version) { } 0 0 0
130 0 $tag = $self->gen_tag($version);
131 }
132 else {
133 0 tie my %dir, 'IO::Dir', $basedir;
134 0 $tag = (sort grep { !m/^\./} keys %dir)[-1];
135 }
136  
137 0 my $tagdir = File::Spec->catdir( $basedir, $tag );
138  
139 0 ▶ if ( !-d $tagdir ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-d $tagdir) 0 0 0
140 0 die "Could not find the tag $tag for $module\n";
141 }
142  
143 0 ▶ if ( !defined $outdir ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $outdir) 0 0 0
144 0 $outdir = $module;
145 }
146  
147 0 ▶ if ( !$self->dryrun ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->dryrun) 0 0 0
148 0 ▶ File::Copy::Recursive::dircopy( $tagdir, $outdir )
Branch: 1 branch
BranchTrueFalseTotal
File::Copy::Recursive::dircopy($tagdir, $outdir) or die "Could not checkout $module tag $tag\n" 0 0 0
149 or die "Could not checkout $module tag $tag\n";
150 }
151  
152 0 return;
153 }
154  
155 0 ▶sub import_project {
Subroutine import_project: not called CC=4 SCAR=30.0
Pod documented
156 0 my ( $self, $dir, $version, $message ) = @_;
157  
158 0 my $module = $self->module;
159  
160 0 my $tag = $self->gen_tag($version);
161  
162 0 my $tagdir = File::Spec->catdir( $self->tagdir, $module, $tag );
163  
164 0 ▶ if ( !$self->dryrun ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->dryrun) 0 0 0
165 0 ▶ if ( -d $tagdir ) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $tagdir) 0 0 0
166 0 File::Path::rmtree($tagdir);
167 }
168 0 ▶ File::Copy::Recursive::dircopy( $dir, $tagdir )
Branch: 1 branch
BranchTrueFalseTotal
File::Copy::Recursive::dircopy($dir, $tagdir) or die "Could not import $dir\n" 0 0 0
169 or die "Could not import $dir\n";
170 }
171  
172 0 return;
173 }
174  
175 1 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
176 1 1;
177 __END__
« VCS/SVN.pm ↑ Summary