[libdist-zilla-role-bootstrap-perl] 06/09: Cease use of MX::AttributeShortcuts to remove autobox indirect dependency
Axel Beckert
abe at deuxchevaux.org
Sat Aug 8 11:59:51 UTC 2015
This is an automated email from the git hooks/post-receive script.
abe pushed a commit to annotated tag 1.001000-source
in repository libdist-zilla-role-bootstrap-perl.
commit 4577d5fce394d079e3cf4155211d0f425724c120
Author: Kent Fredric <kentfredric at gmail.com>
Date: Wed Jan 21 09:14:49 2015 +1300
Cease use of MX::AttributeShortcuts to remove autobox indirect dependency
---
Changes | 5 ++-
lib/Dist/Zilla/Role/Bootstrap.pm | 96 ++++++++++++++++++----------------------
misc/Changes.deps | 3 ++
misc/Changes.deps.all | 3 ++
t/01-basic.t | 5 ++-
t/02-try-built-mtime.t | 4 ++
t/03-try-built-parseversion.t | 4 ++
7 files changed, 64 insertions(+), 56 deletions(-)
diff --git a/Changes b/Changes
index df6eeda..1ab0398 100644
--- a/Changes
+++ b/Changes
@@ -5,9 +5,12 @@ Release history for Dist-Zilla-Role-Bootstrap
- Dependencies changed since 1.000003, see misc/*.deps* for details
- configure: +1 (recommends: ↑1)
- develop: +9 ↑3 -2 (recommends: +1, suggests: ↑2)
- - runtime: (recommends: +1)
+ - runtime: -1 (recommends: +1)
- test: +1 (recommends: +1 ↑1 ↓1)
+ [Internals]
+ - Cease use of MX::AttributeShortcuts to remove autobox indirect dependency.
+
[Meta]
- Assign author=cpanid
diff --git a/lib/Dist/Zilla/Role/Bootstrap.pm b/lib/Dist/Zilla/Role/Bootstrap.pm
index a67d3b1..152ef34 100644
--- a/lib/Dist/Zilla/Role/Bootstrap.pm
+++ b/lib/Dist/Zilla/Role/Bootstrap.pm
@@ -13,7 +13,6 @@ our $VERSION = '1.000004';
use Moose::Role qw( with has around requires );
use List::UtilsBy qw( max_by nmax_by );
-use MooseX::AttributeShortcuts 0.015; #Min version for builder => sub {}
use version qw();
=begin MetaPOD::JSON v1.1.0
@@ -62,20 +61,24 @@ In such a case, that plugin cannot be bootstrapped, because that plugin B<MUST>
=cut
-has distname => ( isa => 'Str', is => ro =>, lazy => 1, builder => sub { $_[0]->zilla->name; }, );
+has distname => ( isa => 'Str', is => ro =>, lazy_build => 1 );
+
+sub _build_distname {
+ my ($self) = @_;
+ return $self->zilla->name;
+}
=p_attr C<_cwd>
=cut
-has _cwd => (
- is => ro =>,
- lazy => 1,
- builder => sub {
- require Path::Tiny;
- return Path::Tiny::path( $_[0]->zilla->root );
- },
-);
+has _cwd => ( is => ro =>, lazy_build => 1, );
+
+sub _build__cwd {
+ my ($self) = @_;
+ require Path::Tiny;
+ return Path::Tiny::path( $self->zilla->root );
+}
=attr C<try_built>
@@ -91,12 +94,8 @@ This attribute controls how the consuming C<plugin> behaves.
=cut
-has try_built => (
- isa => 'Bool',
- is => ro =>,
- lazy => 1,
- builder => sub { return },
-);
+has try_built => ( isa => 'Bool', is => ro =>, lazy_build => 1, );
+sub _build_try_built { return }
=attr C<fallback>
@@ -112,12 +111,8 @@ This attribute is for use in conjunction with C<try_built>
=cut
-has fallback => (
- isa => 'Bool',
- is => ro =>,
- lazy => 1,
- builder => sub { return 1 },
-);
+has fallback => ( isa => 'Bool', is => ro =>, lazy_build => 1 );
+sub _build_fallback { return 1 }
=attr C<try_built_method>
@@ -137,12 +132,8 @@ Prior to C<0.2.0> this property did not exist, and default behavior was to assum
=cut
-has try_built_method => (
- isa => 'Str',
- is => ro =>,
- lazy => 1,
- builder => sub { return 'mtime' },
-);
+has try_built_method => ( isa => 'Str', is => ro =>, lazy_build => 1, );
+sub _build_try_built_method { return 'mtime' }
=p_method C<_pick_latest_mtime>
@@ -225,37 +216,34 @@ It can also return C<undef> if discovery concludes that no bootstrap can or shou
=cut
-has _bootstrap_root => (
- is => ro =>,
- lazy => 1,
- builder => sub {
- my ($self) = @_;
- if ( not $self->try_built ) {
- return $self->_cwd;
- }
- my $distname = $self->distname;
+has _bootstrap_root => ( is => ro =>, lazy_build => 1 );
- my (@candidates) = grep { $_->basename =~ /\A\Q$distname\E-/msx } grep { $_->is_dir } $self->_cwd->children;
+sub _build__bootstrap_root {
+ my ($self) = @_;
+ if ( not $self->try_built ) {
+ return $self->_cwd;
+ }
+ my $distname = $self->distname;
+
+ my (@candidates) = grep { $_->basename =~ /\A\Q$distname\E-/msx } grep { $_->is_dir } $self->_cwd->children;
- if ( 1 == scalar @candidates ) {
- return $candidates[0];
+ if ( 1 == scalar @candidates ) {
+ return $candidates[0];
+ }
+ if ( scalar @candidates < 1 ) {
+ if ( not $self->fallback ) {
+ $self->log( [ 'candidates for bootstrap (%s) == 0, and fallback disabled. not bootstrapping', 0 + @candidates ] );
+ return;
}
- if ( scalar @candidates < 1 ) {
- if ( not $self->fallback ) {
- $self->log( [ 'candidates for bootstrap (%s) == 0, and fallback disabled. not bootstrapping', 0 + @candidates ] );
- return;
- }
- else {
- $self->log( [ 'candidates for bootstrap (%s) == 0, fallback to boostrapping <distname>/', 0 + @candidates ] );
- return $self->_cwd;
- }
+ else {
+ $self->log( [ 'candidates for bootstrap (%s) == 0, fallback to boostrapping <distname>/', 0 + @candidates ] );
+ return $self->_cwd;
}
+ }
- $self->log_debug( [ '>1 candidates, picking one by method %s', $self->try_built_method ] );
- return $self->_pick_candidate(@candidates);
-
- },
-);
+ $self->log_debug( [ '>1 candidates, picking one by method %s', $self->try_built_method ] );
+ return $self->_pick_candidate(@candidates);
+}
=p_method C<_add_inc>
diff --git a/misc/Changes.deps b/misc/Changes.deps
index 0eefe5a..99e13ba 100644
--- a/misc/Changes.deps
+++ b/misc/Changes.deps
@@ -7,6 +7,9 @@ This file contains changes in REQUIRED dependencies for standard CPAN phases (co
[Added / test requires]
- perl 5.008
+ [Removed / runtime requires]
+ - MooseX::AttributeShortcuts 0.015
+
1.000003 2014-08-15T21:30:54Z
[Added / test requires]
- File::Spec
diff --git a/misc/Changes.deps.all b/misc/Changes.deps.all
index b5d239a..ac7b803 100644
--- a/misc/Changes.deps.all
+++ b/misc/Changes.deps.all
@@ -47,6 +47,9 @@ This file contains ALL changes in dependencies in both REQUIRED / OPTIONAL depen
- Dist::Zilla::Plugin::EOLTests
- Dist::Zilla::Plugin::ReadmeFromPod
+ [Removed / runtime requires]
+ - MooseX::AttributeShortcuts 0.015
+
1.000003 2014-08-15T21:30:54Z
[Added / develop requires]
- Dist::Zilla::Plugin::Git::Contributors 0.006
diff --git a/t/01-basic.t b/t/01-basic.t
index da7b8ed..effbff0 100644
--- a/t/01-basic.t
+++ b/t/01-basic.t
@@ -46,7 +46,10 @@ $section->current_section->payload->{name} = 'Example';
$section->finalize;
my $instance = Example->plugin_from_config( 'testing', {}, $section );
-
+$instance->distname;
+$instance->fallback;
+$instance->try_built;
+$instance->try_built_method;
is_deeply(
$instance->dump_config,
{
diff --git a/t/02-try-built-mtime.t b/t/02-try-built-mtime.t
index 6dbc4ef..376a295 100644
--- a/t/02-try-built-mtime.t
+++ b/t/02-try-built-mtime.t
@@ -63,6 +63,10 @@ my $instance = Example->plugin_from_config(
},
$section
);
+$instance->distname;
+$instance->fallback;
+$instance->try_built;
+$instance->try_built_method;
is_deeply(
$instance->dump_config,
diff --git a/t/03-try-built-parseversion.t b/t/03-try-built-parseversion.t
index d999de6..97f9740 100644
--- a/t/03-try-built-parseversion.t
+++ b/t/03-try-built-parseversion.t
@@ -62,6 +62,10 @@ my $instance = Example->plugin_from_config(
},
$section
);
+$instance->distname;
+$instance->fallback;
+$instance->try_built;
+$instance->try_built_method;
is_deeply(
$instance->dump_config,
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libdist-zilla-role-bootstrap-perl.git
More information about the Pkg-perl-cvs-commits
mailing list