File Coverage

blib/lib/Dist/Zilla/Plugin/Test/PAUSE/Permissions.pm
Criterion Covered Total %
statement 21 21 100.0
branch n/a
condition n/a
subroutine 8 8 100.0
pod 0 3 0.0
total 29 32 90.6


line stmt bran cond sub pod time code
1 1     1   977890 use strict;
  1         3  
  1         32  
2 1     1   6 use warnings;
  1         3  
  1         66  
3             package Dist::Zilla::Plugin::Test::PAUSE::Permissions;
4             # git description: v0.001-15-gd37f5d8
5             $Dist::Zilla::Plugin::Test::PAUSE::Permissions::VERSION = '0.002';
6             # ABSTRACT: Generate a test to verify PAUSE permissions
7             # KEYWORDS: plugin test author PAUSE permissions
8             # vim: set ts=8 sw=4 tw=78 et :
9              
10 1     1   6 use Moose;
  1         2  
  1         9  
11             with (
12             'Dist::Zilla::Role::FileGatherer',
13             'Dist::Zilla::Role::TextTemplate',
14             'Dist::Zilla::Role::PrereqSource',
15             );
16              
17 1     1   6594 use Path::Tiny;
  1         2  
  1         57  
18 1     1   6 use namespace::autoclean;
  1         2  
  1         10  
19              
20 2     2 0 14 sub filename { path(qw(xt release pause-permissions.t))->stringify }
21              
22             has username => (
23             is => 'ro', isa => 'Str|Undef',
24             lazy => 1,
25             default => sub {
26             my $self = shift;
27             my $stash = $self->zilla->stash_named('%PAUSE');
28             return if not $stash;
29              
30             my $username = $stash->username;
31             $self->log_debug([ 'using PAUSE id "%s" from Dist::Zilla config', $username ]) if $username;
32             $username;
33             },
34             );
35              
36             sub register_prereqs
37             {
38 2     2 0 9982 my $self = shift;
39              
40 2         81 $self->zilla->register_prereqs(
41             {
42             type => 'requires',
43             phase => 'develop',
44             },
45             'Test::PAUSE::Permissions' => '0',
46             );
47             }
48              
49             sub gather_files
50             {
51 2     2 0 130146 my $self = shift;
52              
53 2         1029 require Dist::Zilla::File::InMemory;
54 2         88160 $self->add_file(Dist::Zilla::File::InMemory->new(
55             name => $self->filename,
56             content => $self->fill_in_string(
57             <<'TEST',
58             use strict;
59             use warnings;
60              
61             # this test was generated with {{ ref($plugin) . ' ' . ($plugin->VERSION || '<self>') }}
62              
63             use Test::More;
64             BEGIN {
65             plan skip_all => 'Test::PAUSE::Permissions required for testing pause permissions'
66             if $] < 5.010;
67             }
68             use Test::PAUSE::Permissions;
69              
70             all_permissions_ok({{ $username ? qq{'$username'} : '' }});
71             TEST
72             {
73             dist => \($self->zilla),
74             plugin => \$self,
75             username => \($self->username),
76             },
77             ),
78             ));
79             }
80              
81             __PACKAGE__->meta->make_immutable;
82              
83             __END__
84              
85             =pod
86              
87             =encoding UTF-8
88              
89             =head1 NAME
90              
91             Dist::Zilla::Plugin::Test::PAUSE::Permissions - Generate a test to verify PAUSE permissions
92              
93             =head1 VERSION
94              
95             version 0.002
96              
97             =head1 SYNOPSIS
98              
99             In your F<dist.ini>:
100              
101             [Test::PAUSE::Permissions]
102              
103             =head1 DESCRIPTION
104              
105             This is a L<Dist::Zilla> plugin that runs at the
106             L<gather files|Dist::Zilla::Role::FileGatherer> stage, providing a
107             L<Test::PAUSE::Permisisons> test, named F<xt/release/pause-permissions.t>).
108              
109             =for Pod::Coverage filename gather_files register_prereqs
110              
111             =head1 SUPPORT
112              
113             =for stopwords irc
114              
115             Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Dist-Zilla-Plugin-Test-PAUSE-Permissions>
116             (or L<bug-Dist-Zilla-Plugin-Test-PAUSE-Permissions@rt.cpan.org|mailto:bug-Dist-Zilla-Plugin-Test-PAUSE-Permissions@rt.cpan.org>).
117             I am also usually active on irc, as 'ether' at C<irc.perl.org>.
118              
119             =head1 SEE ALSO
120              
121             =over 4
122              
123             =item *
124              
125             L<Test::PAUSE::Permisisons>
126              
127             =back
128              
129             =head1 AUTHOR
130              
131             Karen Etheridge <ether@cpan.org>
132              
133             =head1 COPYRIGHT AND LICENSE
134              
135             This software is copyright (c) 2014 by Karen Etheridge.
136              
137             This is free software; you can redistribute it and/or modify it under
138             the same terms as the Perl 5 programming language system itself.
139              
140             =head1 CONTRIBUTOR
141              
142             =for stopwords Harley Pig
143              
144             Harley Pig <harleypig@gmail.com>
145              
146             =cut