| 1 | # vim: set ts=8 sts=4 sw=4 tw=115 et : | ||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | package Dist::Zilla::Plugin::Test::PAUSE::Permissions; # git description: v0.002-23-g6f46e24 | ||||||||||
| 5 | # ABSTRACT: Generate a test to verify PAUSE permissions | ||||||||||
| 6 | # KEYWORDS: plugin test author PAUSE permissions | ||||||||||
| 7 | |||||||||||
| 8 | 1 | our $VERSION = '0.003'; | |||||||||
| 9 | |||||||||||
| 10 | 1 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 1 | with ( | |||||||||
| 12 | 'Dist::Zilla::Role::FileGatherer', | ||||||||||
| 13 | 'Dist::Zilla::Role::TextTemplate', | ||||||||||
| 14 | 'Dist::Zilla::Role::PrereqSource', | ||||||||||
| 15 | ); | ||||||||||
| 16 | |||||||||||
| 17 | 1 | ▶ | use Path::Tiny; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 18 | 1 | ▶ | use namespace::autoclean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | |||||||||||
| 20 | 2 | ▶ | sub filename { path(qw(xt release pause-permissions.t))->stringify } | ||||||||
|
Subroutine
filename: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 21 | |||||||||||
| 22 | has username => ( | ||||||||||
| 23 | is => 'ro', isa => 'Str|Undef', | ||||||||||
| 24 | lazy => 1, | ||||||||||
| 25 | 2 | ▶ | default => sub { | ||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||
| 26 | 2 | my $self = shift; | |||||||||
| 27 | 2 | my $stash = $self->zilla->stash_named('%PAUSE'); | |||||||||
| 28 | 2 | ▶ | return if not $stash; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 29 | |||||||||||
| 30 | 1 | my $username = $stash->username; | |||||||||
| 31 | 1 | ▶ | $self->log_debug([ 'using PAUSE id "%s" from Dist::Zilla config', $username ]) if $username; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | 1 | $username; | |||||||||
| 33 | }, | ||||||||||
| 34 | 1 | ); | |||||||||
| 35 | |||||||||||
| 36 | around dump_config => sub | ||||||||||
| 37 | 0 | ▶ | { | ||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||
| 38 | 0 | my ($orig, $self) = @_; | |||||||||
| 39 | 0 | my $config = $self->$orig; | |||||||||
| 40 | |||||||||||
| 41 | 0 | ▶ | my $data = { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 42 | blessed($self) ne __PACKAGE__ ? ( version => $VERSION ) : (), | ||||||||||
| 43 | }; | ||||||||||
| 44 | 0 | ▶ | $config->{+__PACKAGE__} = $data if keys %$data; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 45 | |||||||||||
| 46 | 0 | return $config; | |||||||||
| 47 | 1 | }; | |||||||||
| 48 | |||||||||||
| 49 | sub register_prereqs | ||||||||||
| 50 | 2 | ▶ | { | ||||||||
|
Subroutine
register_prereqs: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 51 | 2 | my $self = shift; | |||||||||
| 52 | |||||||||||
| 53 | 2 | $self->zilla->register_prereqs( | |||||||||
| 54 | { | ||||||||||
| 55 | phase => 'develop', | ||||||||||
| 56 | type => 'requires', | ||||||||||
| 57 | }, | ||||||||||
| 58 | 'Test::PAUSE::Permissions' => '0', | ||||||||||
| 59 | ); | ||||||||||
| 60 | } | ||||||||||
| 61 | |||||||||||
| 62 | sub gather_files | ||||||||||
| 63 | 2 | ▶ | { | ||||||||
|
Subroutine
gather_files: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 64 | 2 | my $self = shift; | |||||||||
| 65 | |||||||||||
| 66 | 2 | require Dist::Zilla::File::InMemory; | |||||||||
| 67 | 2 | $self->add_file(Dist::Zilla::File::InMemory->new( | |||||||||
| 68 | name => $self->filename, | ||||||||||
| 69 | content => $self->fill_in_string( | ||||||||||
| 70 | <<'TEST', | ||||||||||
| 71 | use strict; | ||||||||||
| 72 | use warnings; | ||||||||||
| 73 | |||||||||||
| 74 | # this test was generated with {{ ref $plugin }} {{ $plugin->VERSION }} | ||||||||||
| 75 | |||||||||||
| 76 | use Test::More; | ||||||||||
| 77 | BEGIN { | ||||||||||
| 78 | plan skip_all => 'Test::PAUSE::Permissions required for testing pause permissions' | ||||||||||
| 79 | if $] < 5.010; | ||||||||||
| 80 | } | ||||||||||
| 81 | use Test::PAUSE::Permissions; | ||||||||||
| 82 | |||||||||||
| 83 | all_permissions_ok({{ $username ? qq{'$username'} : '' }}); | ||||||||||
| 84 | TEST | ||||||||||
| 85 | { | ||||||||||
| 86 | dist => \($self->zilla), | ||||||||||
| 87 | plugin => \$self, | ||||||||||
| 88 | username => \($self->username), | ||||||||||
| 89 | }, | ||||||||||
| 90 | ), | ||||||||||
| 91 | )); | ||||||||||
| 92 | } | ||||||||||
| 93 | |||||||||||
| 94 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||
| 95 | |||||||||||
| 96 | __END__ | ||||||||||