Skip to content

Commit

Permalink
a role for core plugins to assert version parity
Browse files Browse the repository at this point in the history
  • Loading branch information
rjbs committed Jun 9, 2024
1 parent dcb0b2a commit e150843
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions lib/Dist/Zilla/Role/CorePlugin.pm
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;

0 comments on commit e150843

Please sign in to comment.