Subject: | PreviousVersionProvider not being loaded |
I have just installed the Dist-Zilla-Plugin-NextVersion-Semantic plugin with a view to using Semantic Versioning for a new project.
# dist.ini
[NextVersion::Semantic]
# Changes
Revision history for A-New-Project
{{$NEXT}}
- MINOR: initial release
0.1.0 2013-04-02
- non-existent release with version number for incrementing purposes
$ dzil build
[DZ] beginning to build A-New-Project
[NextVersion::Semantic] no previous version found
[NextVersion::Semantic] no previous version found at ...
I have determined that this distribution comes with a previous version provider, but it is not outputting any error messages. I note this line in the default sub for the previous_version attribute in Semantic.pm:
my $plugins
= $self->zilla->plugins_with('-YANICK::PreviousVersionProvider');
I added a YAML Dump call underneath that to inspect what's returned, then ran "dzil build" again:
$ dzil build
[DZ] beginning to build A-New-Project
--- []
[NextVersion::Semantic] no previous version found
[NextVersion::Semantic] no previous version found at ...
It appears that plugins_with() is returning an empty list reference.
Semantic.pm would abort if a non-reference were returned, and it seems that it should also fail when an empty reference is returned. However, the following line:
$self->log_fatal(
"at least one plugin with the role PreviousVersionProvider is required"
) unless ref $plugins;
does not take empty references into account. So it seems that there are two problems:
1. default sub for previous_version attribute not correctly detecting
zero PreviousVersionProvider plugins being found;
2. bundled PreviousVersionProvider not being found.
I am working around this at the moment for testing purposes by manually providing a version number:
$ V=1.0.0 dzil build