-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
a role for core plugins to assert version parity
- Loading branch information
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package Dist::Zilla::Role::CorePlugin; | ||
# ABSTRACT: a plugin that ships with Dist-Zilla | ||
use Moose::Role; | ||
with 'Dist::Zilla::Role::Plugin'; | ||
|
||
before register_component => sub { | ||
my ($self) = @_; | ||
my $p_version = $self->VERSION; | ||
my $z_version = $self->zilla->VERSION; | ||
|
||
return if ! (defined $p_version or defined $z_version); | ||
|
||
if ( | ||
(defined $p_version xor defined $z_version) | ||
or $p_version ne $z_version | ||
) { | ||
my $p_str = defined $p_version ? $p_version : '(undef)'; # XXX 5.10.0 | ||
my $z_str = defined $z_version ? $z_version : '(undef)'; | ||
$self->log_fatal("CorePlugin version $p_str does not match Dist::Zilla version $z_str"); | ||
} | ||
}; | ||
|
||
1; |