blib/lib/Test/Smoke/Syncer/Copy.pm

filter: Statementstmt 82.8% 29 / 35 Branchbran 50.0% 4 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 100% 1 / 1 totaltotal 79.5% 39 / 49 CC 5 SCAR 13.3
CC
5
Cov
77%
sync
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.8
« blib/lib/Test/Smoke/Poster.pm ↑ Summary blib/lib/Test/Smoke/Poster/HTTP_Tiny.pm »
1 package Test::Smoke::Syncer::Copy;
2 12 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 12 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 12 ▶use Cwd;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 12 our $VERSION = '0.029';
7  
8 12 ▶use base 'Test::Smoke::Syncer::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 =head1 Test::Smoke::Syncer::Copy
11  
12 This handles syncing with the B<File::Copy> module from a local
13 directory. It uses the B<MANIFEST> file is the source directory
14 to determine which fiels to copy. The current source-tree removed
15 before the actual copying.
16  
17 =cut
18  
19 =head2 Test::Smoke::Syncer::Copy->new( %args )
20  
21 This crates the new object. Keys for C<%args>:
22  
23 * ddir: destination directory ( ./perl-current )
24 * cdir: directory to copy from ( undef )
25 * v: verbose
26  
27 =cut
28  
29 =head2 $syncer->sync( )
30  
31 This uses B<Test::Smoke::SourceTree> to do the actual copying. After
32 that it will clean up the source-tree (from F<MANIFEST>, but ignoring
33 F<MANIFEST.SKIP>!).
34  
35 =cut
36  
37 3 ▶sub sync {
Subroutine sync: called CC=5 SCAR=18.0
Pod documented
38 3 my $self = shift;
39  
40 3 ▶ $self->{cdir} eq $self->{ddir} and do {
Branch: 1 branch
BranchTrueFalseTotal
$self->{"cdir"} eq $self->{"ddir"} and do { require Carp; Carp::croak("Sourcetree cannot be copied onto it self!") } 0 3 3
41 0 require Carp;
42 0 Carp::croak( "Sourcetree cannot be copied onto it self!" );
43 };
44  
45 3 $self->pre_sync;
46 3 require Test::Smoke::SourceTree;
47 3 my $cwd = getcwd;
48 3 ▶ if (! chdir $self->{cdir}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (chdir $self->{"cdir"}) 0 3 3
49 0 require Carp;
50 0 Carp::croak( "[copy] Cannot chdir($self->{cdir}): $!" );
51 };
52 3 ▶ $self->make_dot_patch if (! -e ".patch");
Branch: 1 branch
BranchTrueFalseTotal
unless -e ".patch" 0 3 3
53  
54 3 ▶ if (! chdir $cwd) {
Branch: 1 branch
BranchTrueFalseTotal
unless (chdir $cwd) 0 3 3
55 0 require Carp;
56 0 Carp::croak( "[copy] Cannot chdir($cwd): $!" );
57 };
58  
59 3 my $tree = Test::Smoke::SourceTree->new($self->{cdir}, $self->verbose);
60 3 $tree->copy_from_MANIFEST($self->{ddir});
61  
62 3 $tree = Test::Smoke::SourceTree->new( $self->{ddir} );
63 3 $tree->clean_from_MANIFEST( 'MANIFEST.SKIP' );
64  
65 3 my $plevel = $self->check_dot_patch;
66  
67 3 $self->post_sync;
68 3 return $plevel;
69 }
70  
71 12 1;
72  
73 =head1 COPYRIGHT
74  
75 (c) 2002-2013, All rights reserved.
76  
77 * Abe Timmerman <abeltje@cpan.org>
78  
79 This library is free software; you can redistribute it and/or modify
80 it under the same terms as Perl itself.
81  
82 See:
83  
84 * <http://www.perl.com/perl/misc/Artistic.html>,
85 * <http://www.gnu.org/copyleft/gpl.html>
86  
87 This program is distributed in the hope that it will be useful,
88 but WITHOUT ANY WARRANTY; without even the implied warranty of
89 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
90  
91 =cut
« blib/lib/Test/Smoke/Poster.pm ↑ Summary blib/lib/Test/Smoke/Poster/HTTP_Tiny.pm »