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

filter: Statementstmt 100% 33 / 33 Branchbran 62.5% 5 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 100% 1 / 1 totaltotal 93.7% 45 / 48 CC 5 SCAR 11.1
CC
5
Cov
93%
sync
5.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.0
« blib/lib/Test/Smoke/Poster/LWP_UserAgent.pm ↑ Summary blib/lib/Test/Smoke/App/ConfigSmoke/Smokedir.pm »
1 package Test::Smoke::Syncer::FTP;
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  
5 12 our $VERSION = '0.029';
6  
7 12 ▶use base 'Test::Smoke::Syncer::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
8 12 ▶use Cwd;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 =head1 Test::Smoke::Syncer::FTP
11  
12 This handles syncing by getting the source-tree from a FTP server.
13 It uses the C<Test::Smoke::FTPClient> that implements a mirror function.
14  
15 =cut
16  
17 12 ▶use File::Spec::Functions;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 =head2 Test::Smoke::Syncer::FTP->new( %args )
20  
21 Known args for this class:
22  
23 * ftphost (ftp.example.com)
24 * ftpusr (anonymous)
25 * ftppwd (?)
26 * ftpsdir (/)
27 * ftype (undef|binary|ascii)
28  
29 * ddir
30 * v
31  
32 =cut
33  
34 =head2 $syncer->sync()
35  
36 This does the actual syncing:
37  
38 * Mirror
39  
40 =cut
41  
42 3 ▶sub sync {
Subroutine sync: called CC=5 SCAR=16.2
Pod documented
43 3 my $self = shift;
44  
45 3 $self->pre_sync;
46 3 require Test::Smoke::FTPClient;
47  
48 my $fc = Test::Smoke::FTPClient->new( $self->{ftphost}, $self->{ftpport}, {
49 v => $self->{v},
50 passive => $self->{ftppassive},
51 fuser => $self->{ftpusr},
52 fpwd => $self->{ftppwd},
53 ftype => $self->{ftype},
54 3 } );
55  
56 3 $fc->connect;
57  
58 3 ▶ $fc->mirror( @{ $self }{qw( ftpsdir ddir )}, 1 ) or return;
Branch: 1 branch
BranchTrueFalseTotal
$fc->mirror(@{$self;}{"ftpsdir", "ddir"}, 1) or return 2 1 3
59  
60 2 $self->{client} = $fc;
61 2 $self->{v} = $fc->{v};
62  
63 2 my $cwd = cwd();
64 2 ▶ chdir $self->{ddir} or croak("Cannot chdir($self->{ddir}): $!");
Branch: 1 branch
BranchTrueFalseTotal
chdir $self->{"ddir"} or croak(qq[Cannot chdir($self->{"ddir"}): $!]) 2 0 2
65  
66 2 ▶ $self->make_dot_patch() if (! -e ".patch");
Branch: 1 branch
BranchTrueFalseTotal
unless -e ".patch" 0 2 2
67  
68 2 my $plevel = $self->check_dot_patch;
69  
70 2 ▶ chdir $cwd or croak("Cannot chdir($cwd): $!");
Branch: 1 branch
BranchTrueFalseTotal
chdir $cwd or croak("Cannot chdir($cwd): $!") 2 0 2
71  
72 2 $self->post_sync;
73 2 return $plevel;
74 }
75  
76 12 1;
77  
78 =head1 COPYRIGHT
79  
80 (c) 2002-2013, All rights reserved.
81  
82 * Abe Timmerman <abeltje@cpan.org>
83  
84 This library is free software; you can redistribute it and/or modify
85 it under the same terms as Perl itself.
86  
87 See:
88  
89 * <http://www.perl.com/perl/misc/Artistic.html>,
90 * <http://www.gnu.org/copyleft/gpl.html>
91  
92 This program is distributed in the hope that it will be useful,
93 but WITHOUT ANY WARRANTY; without even the implied warranty of
94 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
95  
96 =cut
« blib/lib/Test/Smoke/Poster/LWP_UserAgent.pm ↑ Summary blib/lib/Test/Smoke/App/ConfigSmoke/Smokedir.pm »