| 1 | 7 | ▶ | use 5.006; # our | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | 7 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 7 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | ## no critic ( NamingConventions::Capitalization ) | ||||||||||
| 6 | package Dist::Zilla::Plugin::Bootstrap::lib; | ||||||||||
| 7 | ## use critic; | ||||||||||
| 8 | |||||||||||
| 9 | 7 | our $VERSION = '1.001002'; | |||||||||
| 10 | |||||||||||
| 11 | # ABSTRACT: A minimal boot-strapping for Dist::Zilla Plug-ins. | ||||||||||
| 12 | |||||||||||
| 13 | 7 | our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY | |||||||||
| 14 | |||||||||||
| 15 | |||||||||||
| 16 | |||||||||||
| 17 | |||||||||||
| 18 | |||||||||||
| 19 | |||||||||||
| 20 | |||||||||||
| 21 | |||||||||||
| 22 | |||||||||||
| 23 | |||||||||||
| 24 | |||||||||||
| 25 | |||||||||||
| 26 | |||||||||||
| 27 | 7 | ▶ | use Moose qw( with around ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 28 | 7 | with 'Dist::Zilla::Role::Bootstrap'; | |||||||||
| 29 | |||||||||||
| 30 | 0 | ▶ | around dump_config => sub { | ||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||
| 31 | 0 | my ( $orig, $self, @args ) = @_; | |||||||||
| 32 | 0 | my $config = $self->$orig(@args); | |||||||||
| 33 | 0 | my $localconf = {}; | |||||||||
| 34 | |||||||||||
| 35 | 0 | ▶ | $localconf->{ q[$] . __PACKAGE__ . '::VERSION' } = $VERSION unless __PACKAGE__ eq ref $self; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | 0 | ▶ | $config->{ +__PACKAGE__ } = $localconf if keys %{$localconf}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 37 | 0 | return $config; | |||||||||
| 38 | 7 | }; | |||||||||
| 39 | |||||||||||
| 40 | 7 | __PACKAGE__->meta->make_immutable; | |||||||||
| 41 | 7 | ▶ | no Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 42 | |||||||||||
| 43 | 6 | ▶ | sub bootstrap { | ||||||||
|
Subroutine
bootstrap: called CC=5 SCAR=16.2
| |||||||||||
| 44 | 6 | my ($self) = @_; | |||||||||
| 45 | |||||||||||
| 46 | 6 | my $bootstrap_root = $self->_bootstrap_root; | |||||||||
| 47 | |||||||||||
| 48 | 6 | ▶ | if ( not $bootstrap_root ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 49 | 1 | return; | |||||||||
| 50 | } | ||||||||||
| 51 | |||||||||||
| 52 | 5 | my $bootstrap_path = $bootstrap_root->child('lib'); | |||||||||
| 53 | 5 | $self->_add_inc("$bootstrap_path"); | |||||||||
| 54 | 5 | $self->log( [ 'Bootstrapping %s', "$bootstrap_path" ] ); | |||||||||
| 55 | 5 | my $it = $bootstrap_path->iterator( { recurse => 1 } ); | |||||||||
| 56 | |||||||||||
| 57 | 5 | ▶ | while ( my $file = $it->() ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 58 | 5 | ▶ | next unless $file->basename =~ /[.]pm$/msx; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 59 | 5 | my $rpath = $file->relative($bootstrap_path)->stringify; | |||||||||
| 60 | 5 | ▶ | if ( exists $INC{$rpath} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 61 | 0 | $self->log( [ '%s was not bootstrapped. You need to move Bootstrap::lib higher', $rpath ] ); | |||||||||
| 62 | } | ||||||||||
| 63 | } | ||||||||||
| 64 | |||||||||||
| 65 | 5 | return 1; | |||||||||
| 66 | |||||||||||
| 67 | } | ||||||||||
| 68 | |||||||||||
| 69 | 7 | 1; | |||||||||
| 70 | |||||||||||
| 71 | __END__ | ||||||||||