Dist::Zilla::Role::Bootstrap - Shared logic for bootstrap things.
version 1.000001
For consuming plugins:
use Moose; with 'Dist::Zilla::Role::Bootstrap'; sub bootstrap { my $bootstrap_root = $_[0]->_bootstrap_root; # Do the actual bootstrap work here $_[0]->_add_inc('./some/path/here'); }
For users of plugins:
[Some::Plugin::Name] try_built = 0 ; # use / as the root to bootstrap try_built = 1 ; # try to use /Dist-Name-.*/ instead of / fallback = 0 ; # don't bootstrap at all if /Dist-Name-.*/ matches != 1 things fallback = 1 ; # fallback to / if /Dist-Name-.*/ matches != 1 things
bootstrap
Any user specified bootstrap method will be invoked during plugin_from_config.
plugin_from_config
This is AFTER ->new, AFTER ->BUILD, and AFTER dzil's internal plugin_from_config steps.
->new
->BUILD
dzil
This occurs within the register_component phase of the plug-in loading and configuration.
register_component
This also occurs BEFORE Dist::Zilla attaches the plug-in into the plug-in stash.
Dist::Zilla
distname
The name of the distribution.
This value is vivified by asking zilla->name.
zilla->name
Usually this value is populated by dist.ini in the property name
dist.ini
name
However, occasionally, this value is discovered by a plugin.
plugin
In such a case, that plugin cannot be bootstrapped, because that plugin MUST be loaded prior to bootstrap.
try_built
This attribute controls how the consuming plugin behaves.
false (default) : bootstrapping is only done to PROJECTROOT/lib
PROJECTROOT/lib
true : bootstrap attempts to try PROJECTROOT/<distname>-<version>/lib
PROJECTROOT/<distname>-<version>/lib
fallback
This attribute is for use in conjunction with try_built
false : When PROJECTROOT/<distname>-<version> does not exist, don't perform any bootstrapping
false
PROJECTROOT/<distname>-<version>
true (default) : When PROJECTROOT/<distname>-<version> does not exist, bootstrap to PROJECTROOT/lib
true
try_built_method
This attribute controls how try_built behaves when multiple directories exist that match PROJECTROOT/<distname>-.*
PROJECTROOT/<distname>-.*
Two valid options at this time:
mtime (default) : Pick the directory with the most recent mtime
mtime
parseversion : Attempt to parse versions on all candidate directories and use the one with the largest version.
parseversion
Prior to 0.2.0 this property did not exist, and default behavior was to assume 0 Candidates and 2 or more Candidates were the same problem.
0.2.0
0 Candidates
2 or more Candidates
_cwd
_bootstrap_root
Internal: This is the real legwork, and resolves the base directory using the bootstrap resolution protocol.
It should always return a project root of some kind, whether it be a source tree, or built source tree.
It can also return undef if discovery concludes that no bootstrap can or should be performed.
undef
_pick_latest_mtime
"Latest" mtime candidate selector
my $directory = $self->_pick_latest_mtime(@directory_objects)
_get_candidate_version
Attempt to resolve a version from a directory name
my $version = $self->_get_candidate_version($directory_object)
NOTE: At this time, the presence of -TRIAL is simply stripped and ignored
-TRIAL
_pick_latest_parseversion
"Latest" version candidate selector
version
my $directory = $self->_pick_latest_parseversion(@directory_objects)
_pick_candidate
Pick a directory from a list of candidates using the method described by try_built_method
my $directory = $self->_pick_candidate( @directory_objects );
_add_inc
Internal: Used to perform the final step of injecting library paths into @INC
@INC
$self->_add_inc("$libraryPath");
Kent Fredric <kentfredric@gmail.com>
This software is copyright (c) 2014 by Kent Fredric <kentfredric@gmail.com>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Dist::Zilla::Role::Bootstrap, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Dist::Zilla::Role::Bootstrap
CPAN shell
perl -MCPAN -e shell install Dist::Zilla::Role::Bootstrap
For more information on module installation, please visit the detailed CPAN module installation guide.