File Coverage

lib/Dist/Zilla/Plugin/Author/KENTNL/TravisCI.pm
Criterion Covered Total %
statement 18 47 38.3
branch 0 6 0.0
condition n/a
subroutine 6 7 85.7
pod 0 1 0.0
total 24 61 39.3


line stmt bran cond sub pod time code
1 1     1   667 use 5.006; # our
  1         4  
  1         56  
2 1     1   6 use strict;
  1         1  
  1         39  
3 1     1   6 use warnings;
  1         12  
  1         73  
4              
5             package Dist::Zilla::Plugin::Author::KENTNL::TravisCI;
6              
7             our $VERSION = '0.001002';
8              
9             # ABSTRACT: A specific subclass of TravisCI that does horrible things
10              
11             our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY
12              
13 1     1   509 use Moose qw( extends has around );
  1         391695  
  1         9  
14             extends 'Dist::Zilla::Plugin::TravisCI';
15              
16 1     1   5719 use Path::Tiny qw(path);
  1         9190  
  1         348  
17              
18             has skip_perls => ( isa => 'ArrayRef[Str]', is => 'ro', default => sub { [] } );
19             has fail_perls => ( isa => 'ArrayRef[Str]', is => 'ro', default => sub { ['5.8'] } );
20              
21             around mvp_multivalue_args => sub {
22             my ( $orig, $self, @args ) = @_;
23             return ( $self->$orig(@args), qw( skip_perls fail_perls ) );
24             };
25              
26              
27              
28              
29              
30             sub modify_travis_yml {
31 0     0 0   my ( $self, %yaml ) = @_;
32 0           my $allow_failures = [
33 0           ( map { +{ perl => $_ } } @{ $self->fail_perls } ),
  0            
34             { env => 'STERILIZE_ENV=0 RELEASE_TESTING=1 AUTHOR_TESTING=1' },
35             { env => 'STERILIZE_ENV=0 DEVELOPER_DEPS=1' },
36             ];
37              
38 0           my (%skip_perls) = map { $_ => 1 } @{ $self->skip_perls };
  0            
  0            
39 0           my (@sterile_perls) = grep { not exists $skip_perls{$_} } '5.8', '5.10', '5.20';
  0            
40 0           my (@normal_perls) = grep { not exists $skip_perls{$_} } '5.8', '5.10', '5.12', '5.14', '5.16', '5.20', '5.21';
  0            
41              
42 0           my $include = [
43             { perl => '5.21', env => 'STERILIZE_ENV=0 COVERAGE_TESTING=1' },
44             { perl => '5.21', env => 'STERILIZE_ENV=1' },
45 0           ( map { +{ perl => $_, env => 'STERILIZE_ENV=0' } } @normal_perls ),
46 0           ( map { +{ perl => $_, env => 'STERILIZE_ENV=1' } } @sterile_perls ),
47             { perl => '5.21', env => 'STERILIZE_ENV=0 DEVELOPER_DEPS=1' },
48             { perl => '5.21', env => 'STERILIZE_ENV=0 RELEASE_TESTING=1 AUTHOR_TESTING=1' },
49             ];
50 0           $yaml{matrix} = {
51             allow_failures => $allow_failures,
52             include => $include,
53             };
54 0           $yaml{before_install} = [
55             'perlbrew list',
56             ## no critic (ValuesAndExpressions::RestrictLongStrings)
57             'time git clone --depth 10 https://github.com/kentfredric/travis-scripts.git maint-travis-ci',
58             'time git -C ./maint-travis-ci reset --hard master',
59             'time perl ./maint-travis-ci/branch_reset.pl',
60             'time perl ./maint-travis-ci/sterilize_env.pl',
61             ];
62 0           $yaml{install} = [ 'time perl ./maint-travis-ci/install_deps_early.pl', 'time perl ./maint-travis-ci/install_deps.pl', ];
63 0           $yaml{before_script} = [ 'time perl ./maint-travis-ci/before_script.pl', ];
64 0           $yaml{script} = [ 'time perl ./maint-travis-ci/script.pl', ];
65 0           $yaml{after_failure} = [ 'perl ./maint-travis-ci/report_fail_ctx.pl', ];
66 0           $yaml{branches} = { only => [ 'master', 'builds', 'releases', ] };
67 0           $yaml{sudo} = 'false';
68 0           delete $yaml{perl};
69              
70 0           my $script = path( $self->zilla->root, 'maint', 'travisci.pl' );
71 0 0         if ( $script->exists ) {
72 0 0         last unless my $callback = do $script->stringify;
73 0 0         last unless ref $callback;
74 0           $callback->( \%yaml );
75             }
76 0           return %yaml;
77             }
78              
79             __PACKAGE__->meta->make_immutable;
80 1     1   5 no Moose;
  1         1  
  1         8  
81              
82             1;
83              
84             __END__
85              
86             =pod
87              
88             =encoding UTF-8
89              
90             =head1 NAME
91              
92             Dist::Zilla::Plugin::Author::KENTNL::TravisCI - A specific subclass of TravisCI that does horrible things
93              
94             =head1 VERSION
95              
96             version 0.001002
97              
98             =head1 DESCRIPTION
99              
100             B<NO USER SERVICEABLE PARTS INSIDE>
101              
102             B<CHOKING HAZARD>
103              
104             =for Pod::Coverage modify_travis_yml
105              
106             =head1 AUTHOR
107              
108             Kent Fredric <kentnl@cpan.org>
109              
110             =head1 COPYRIGHT AND LICENSE
111              
112             This software is copyright (c) 2015 by Kent Fredric <kentfredric@gmail.com>.
113              
114             This is free software; you can redistribute it and/or modify it under
115             the same terms as the Perl 5 programming language system itself.
116              
117             =cut