File Coverage

_build/lib/Module/Build/Deploy.pm
Criterion Covered Total %
statement 6 20 30.0
branch 0 4 0.0
condition n/a
subroutine 2 3 66.6
pod 0 1 0.0
total 8 28 28.5


line stmt bran cond sub pod time code
1             package Module::Build::Deploy;
2 1     1   503 use Module::Build;
  1         85640  
  1         68  
3             our @ISA = qw(Module::Build);
4             sub ACTION_deploy {
5              
6 0     0 0   require CPAN::Uploader;
7 0           require MetaCPAN::Client;
8 1     1   6 use version;
  1         2  
  1         7  
9              
10 0           my $self = shift;
11 0           $self->depends_on("dist");
12              
13             # check that this is a newer version
14 0           my $name = $self->dist_name;
15 0           my $mpan = MetaCPAN::Client->new();
16 0           my $existing = $mpan->release($name)->version;
17 0 0         if (version->parse($existing) >= version->parse($self->dist_version)) {
18 0           warn "This version is <= the version on CPAN, aborting nicely\n";
19 0           return 1;
20             }
21              
22 0           my $tarball = $self->dist_dir() . '.tar.gz';
23 0 0         die "tarball not found"
24             if (! -e $tarball);
25 0           print "Uploading $tarball\n";
26             CPAN::Uploader->upload_file( $tarball, {
27             user => $ENV{PAUSE_USER},
28             password => $ENV{PAUSE_PASS},
29 0           } );
30             }
31              
32             1;