File Coverage

blib/lib/Dist/Zilla/Plugin/Author/Plicease/TravisInstall.pm
Criterion Covered Total %
statement 5 35 14.2
branch n/a
condition n/a
subroutine 2 4 50.0
pod 0 2 0.0
total 7 41 17.0


line stmt bran cond sub pod time code
1             package Dist::Zilla::Plugin::Author::Plicease::TravisInstall 2.41 {
2              
3 1     1   879 use 5.014;
  1         3  
4 1     1   5 use Moose;
  1         1  
  1         7  
5              
6             # ABSTRACT: Generate travis install script
7              
8             with 'Dist::Zilla::Role::BeforeBuild';
9            
10 0     0 0   sub mvp_multivalue_args { qw( repo ) }
11            
12             has repo => (
13             is => 'ro',
14             default => sub { ['Perl5-Alien/Alien-Build'] },
15             );
16            
17             sub before_build
18             {
19 0     0 0   my($self) = @_;
20 0           my $file = $self->zilla->root->child('maint/travis-install-mods');
21 0           $file->parent->mkpath;
22 0           my $fh = $file->openw;
23            
24 0           print $fh "#!/bin/bash -x\n";
25 0           print $fh "\n";
26 0           print $fh "set -euo pipefail\n";
27 0           print $fh "IFS=\$'\\n\\t'\n";
28 0           print $fh "\n";
29            
30 0           print $fh "rm -rf";
31 0           foreach my $repo (@{ $self->repo })
  0            
32             {
33 0           my(undef, $name) = split /\//, $repo;
34 0           print $fh " /tmp/$name";
35             }
36 0           print $fh "\n";
37            
38 0           print $fh "\n";
39 0           print $fh "cpanm -n Dist::Zilla\n";
40 0           print $fh "\n";
41            
42 0           foreach my $repo (@{ $self->repo })
  0            
43             {
44 0           my(undef, $name) = split /\//, $repo;
45 0           print $fh "\n";
46 0           print $fh "git clone --depth 2 https://github.com/$repo.git /tmp/$name\n";
47 0           print $fh "cd /tmp/$name\n";
48 0           print $fh "dzil authordeps --missing | cpanm -n\n";
49 0           print $fh "dzil listdeps --missing | cpanm -n\n";
50 0           print $fh "dzil install --install-command 'cpanm -n .'\n";
51             }
52 0           close $fh;
53            
54 0           $file->chmod('0755');
55             }
56            
57             __PACKAGE__->meta->make_immutable;
58             }
59              
60             1;
61              
62             __END__
63              
64             =pod
65              
66             =encoding UTF-8
67              
68             =head1 NAME
69              
70             Dist::Zilla::Plugin::Author::Plicease::TravisInstall - Generate travis install script
71              
72             =head1 VERSION
73              
74             version 2.41
75              
76             =head1 AUTHOR
77              
78             Graham Ollis <plicease@cpan.org>
79              
80             =head1 COPYRIGHT AND LICENSE
81              
82             This software is copyright (c) 2017 by Graham Ollis.
83              
84             This is free software; you can redistribute it and/or modify it under
85             the same terms as the Perl 5 programming language system itself.
86              
87             =cut