diff --git a/Changes b/Changes index e5f175319..4acaa01fb 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,7 @@ Revision history for {{$dist->name}} {{$NEXT}} + - more plugins add their config to metadata when [MetaConfig] is used 5.044 2016-04-06 20:32:14-04:00 America/New_York - require a newer List::Util to avoid a dumb bug caused by relying on diff --git a/corpus/dist/AuthorDeps/dist.ini b/corpus/dist/AuthorDeps/dist.ini index 322ea0e71..7bbcee652 100644 --- a/corpus/dist/AuthorDeps/dist.ini +++ b/corpus/dist/AuthorDeps/dist.ini @@ -23,3 +23,5 @@ version = 2 :version = 5.0 encoding = bytes filename = t/data.bin + +[MetaConfig] diff --git a/corpus/dist/AutoPrereqs/dist.ini b/corpus/dist/AutoPrereqs/dist.ini index 4feebdc1b..b20834f06 100644 --- a/corpus/dist/AutoPrereqs/dist.ini +++ b/corpus/dist/AutoPrereqs/dist.ini @@ -20,3 +20,5 @@ filename = t/data.bin [Prereqs / DevelopRequires] String::Formatter = 0 + +[MetaConfig] diff --git a/corpus/dist/DZ-NonAscii/dist.ini b/corpus/dist/DZ-NonAscii/dist.ini index 46e0c934a..e7c4ce5c7 100644 --- a/corpus/dist/DZ-NonAscii/dist.ini +++ b/corpus/dist/DZ-NonAscii/dist.ini @@ -8,3 +8,4 @@ copyright_holder = ภูมิพลอดุลยเดช [@Classic] [MetaJSON] [NextRelease] +[MetaConfig] diff --git a/corpus/dist/DZ1/dist.ini b/corpus/dist/DZ1/dist.ini index 1215b7e23..1ed1b5fe5 100644 --- a/corpus/dist/DZ1/dist.ini +++ b/corpus/dist/DZ1/dist.ini @@ -5,3 +5,4 @@ license = Perl_5 copyright_holder = E. Xavier Ample [@Classic] +[MetaConfig] diff --git a/lib/Dist/Zilla/Plugin/AutoPrereqs.pm b/lib/Dist/Zilla/Plugin/AutoPrereqs.pm index e2b3988f9..056c9137f 100644 --- a/lib/Dist/Zilla/Plugin/AutoPrereqs.pm +++ b/lib/Dist/Zilla/Plugin/AutoPrereqs.pm @@ -126,8 +126,23 @@ has scanners => ( has skips => ( is => 'ro', isa => 'ArrayRef[Str]', + default => sub { [] }, ); +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { + (map { $_ => [ sort @{ $self->$_ } ] } qw(finder test_finder configure_finder extra_scanners skips)), + ($self->has_scanners ? (scanners => $self->scanners) : ()), + }; + + return $config; +}; + sub register_prereqs { my $self = shift; diff --git a/lib/Dist/Zilla/Plugin/AutoVersion.pm b/lib/Dist/Zilla/Plugin/AutoVersion.pm index 67066f3f4..8a3c25c52 100644 --- a/lib/Dist/Zilla/Plugin/AutoVersion.pm +++ b/lib/Dist/Zilla/Plugin/AutoVersion.pm @@ -64,6 +64,19 @@ has format => ( . q<{{$ENV{DEV} ? (sprintf '_%03u', $ENV{DEV}) : ''}}> ); +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { + map { $_ => $self->$_ } qw(major format time_zone), + }; + + return $config; +}; + sub provide_version { my ($self) = @_; diff --git a/lib/Dist/Zilla/Plugin/CPANFile.pm b/lib/Dist/Zilla/Plugin/CPANFile.pm index aa1a5c170..aaf0b02e0 100644 --- a/lib/Dist/Zilla/Plugin/CPANFile.pm +++ b/lib/Dist/Zilla/Plugin/CPANFile.pm @@ -37,6 +37,17 @@ sub _hunkify_hunky_hunk_hunks { return $str; } +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { filename => $self->filename }; + + return $config; +}; + sub gather_files { my ($self, $arg) = @_; diff --git a/lib/Dist/Zilla/Plugin/Encoding.pm b/lib/Dist/Zilla/Plugin/Encoding.pm index f2ec4db9f..d1dd11440 100644 --- a/lib/Dist/Zilla/Plugin/Encoding.pm +++ b/lib/Dist/Zilla/Plugin/Encoding.pm @@ -78,6 +78,20 @@ has ignore => ( default => sub { [] }, ); +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { + encoding => $self->encoding, + map { $_ => [ sort @{ $self->$_ } ] } qw(filenames matches), + }; + + return $config; +}; + sub set_file_encodings { my ($self) = @_; diff --git a/lib/Dist/Zilla/Plugin/ExecDir.pm b/lib/Dist/Zilla/Plugin/ExecDir.pm index fb4257dec..e51433287 100644 --- a/lib/Dist/Zilla/Plugin/ExecDir.pm +++ b/lib/Dist/Zilla/Plugin/ExecDir.pm @@ -32,5 +32,17 @@ sub find_files { } with 'Dist::Zilla::Role::ExecFiles'; + +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { dir => $self->dir }; + + return $config; +}; + __PACKAGE__->meta->make_immutable; 1; diff --git a/lib/Dist/Zilla/Plugin/FakeRelease.pm b/lib/Dist/Zilla/Plugin/FakeRelease.pm index 6d730aea4..52b820bfc 100644 --- a/lib/Dist/Zilla/Plugin/FakeRelease.pm +++ b/lib/Dist/Zilla/Plugin/FakeRelease.pm @@ -13,6 +13,17 @@ has user => ( default => 'AUTHORID', ); +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { user => $self->user }; + + return $config; +}; + sub release { my $self = shift; diff --git a/lib/Dist/Zilla/Plugin/FileFinder/ByName.pm b/lib/Dist/Zilla/Plugin/FileFinder/ByName.pm index c50933e89..661d84c24 100644 --- a/lib/Dist/Zilla/Plugin/FileFinder/ByName.pm +++ b/lib/Dist/Zilla/Plugin/FileFinder/ByName.pm @@ -107,6 +107,19 @@ sub _join_re { $re; } +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { + map { $_ => [ sort @{ $self->$_ } ] } qw(dirs files matches skips), + }; + + return $config; +}; + sub find_files { my $self = shift; diff --git a/lib/Dist/Zilla/Plugin/FileFinder/Filter.pm b/lib/Dist/Zilla/Plugin/FileFinder/Filter.pm index 89f01667f..7d257d075 100644 --- a/lib/Dist/Zilla/Plugin/FileFinder/Filter.pm +++ b/lib/Dist/Zilla/Plugin/FileFinder/Filter.pm @@ -59,6 +59,19 @@ sub mvp_aliases { +{ qw( sub mvp_multivalue_args { qw(skips) } +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { + map { $_ => [ sort @{ $self->$_ } ] } qw(finder skips), + }; + + return $config; +}; + sub find_files { my $self = shift; diff --git a/lib/Dist/Zilla/Plugin/FinderCode.pm b/lib/Dist/Zilla/Plugin/FinderCode.pm index fb14f0869..03d35ed5a 100644 --- a/lib/Dist/Zilla/Plugin/FinderCode.pm +++ b/lib/Dist/Zilla/Plugin/FinderCode.pm @@ -20,6 +20,17 @@ has style => ( required => 1, ); +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { style => $self->style }; + + return $config; +}; + sub find_files { my ($self) = @_; diff --git a/lib/Dist/Zilla/Plugin/GenerateFile.pm b/lib/Dist/Zilla/Plugin/GenerateFile.pm index 20b02ff78..a7ddc3ee4 100644 --- a/lib/Dist/Zilla/Plugin/GenerateFile.pm +++ b/lib/Dist/Zilla/Plugin/GenerateFile.pm @@ -103,6 +103,20 @@ has name_is_template => ( default => 0, ); +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { + filename => $self->filename, + map { $_ => $self->$_ ? 1 : 0 } qw(content_is_template name_is_template), + }; + + return $config; +}; + sub gather_files { my ($self, $arg) = @_; diff --git a/lib/Dist/Zilla/Plugin/License.pm b/lib/Dist/Zilla/Plugin/License.pm index ac2f8cd73..eb565305f 100644 --- a/lib/Dist/Zilla/Plugin/License.pm +++ b/lib/Dist/Zilla/Plugin/License.pm @@ -26,6 +26,19 @@ has filename => ( default => 'LICENSE', ); +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { + filename => $self->filename, + }; + + return $config; +}; + sub gather_files { my ($self, $arg) = @_; diff --git a/lib/Dist/Zilla/Plugin/MakeMaker.pm b/lib/Dist/Zilla/Plugin/MakeMaker.pm index 0615e1e99..54b568c10 100644 --- a/lib/Dist/Zilla/Plugin/MakeMaker.pm +++ b/lib/Dist/Zilla/Plugin/MakeMaker.pm @@ -91,6 +91,20 @@ with qw( Dist::Zilla::Role::TextTemplate ); +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { + make_path => $self->make_path, + # default_jobs is dumped by TestRunner + }; + + return $config; +}; + my $template = q!# This file was automatically generated by {{ $generated_by }}. use strict; use warnings; diff --git a/lib/Dist/Zilla/Plugin/ManifestSkip.pm b/lib/Dist/Zilla/Plugin/ManifestSkip.pm index c295a7409..f0e28d60c 100644 --- a/lib/Dist/Zilla/Plugin/ManifestSkip.pm +++ b/lib/Dist/Zilla/Plugin/ManifestSkip.pm @@ -33,6 +33,17 @@ Other modules: L. has skipfile => (is => 'ro', required => 1, default => 'MANIFEST.SKIP'); +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { skipfile => $self->skipfile }; + + return $config; +}; + sub prune_files { my ($self) = @_; my $files = $self->zilla->files; diff --git a/lib/Dist/Zilla/Plugin/MetaJSON.pm b/lib/Dist/Zilla/Plugin/MetaJSON.pm index 2146477bf..d85bcc185 100644 --- a/lib/Dist/Zilla/Plugin/MetaJSON.pm +++ b/lib/Dist/Zilla/Plugin/MetaJSON.pm @@ -42,6 +42,19 @@ has version => ( default => '2', ); +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { + map { $_ => $self->$_ } qw(filename version), + }; + + return $config; +}; + sub gather_files { my ($self, $arg) = @_; diff --git a/lib/Dist/Zilla/Plugin/MetaNoIndex.pm b/lib/Dist/Zilla/Plugin/MetaNoIndex.pm index 49bf721b1..0ec6c2b36 100644 --- a/lib/Dist/Zilla/Plugin/MetaNoIndex.pm +++ b/lib/Dist/Zilla/Plugin/MetaNoIndex.pm @@ -92,6 +92,19 @@ for my $attr (keys %ATTR_ALIAS) { ); } +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { + map { $_ => [ sort @{ $self->$_ } ] } qw(directories files packages namespaces), + }; + + return $config; +}; + =method metadata Returns a reference to a hash containing the distribution's no_index metadata. diff --git a/lib/Dist/Zilla/Plugin/MetaResources.pm b/lib/Dist/Zilla/Plugin/MetaResources.pm index 16f5c9f5d..3816d89f7 100644 --- a/lib/Dist/Zilla/Plugin/MetaResources.pm +++ b/lib/Dist/Zilla/Plugin/MetaResources.pm @@ -64,6 +64,18 @@ around BUILDARGS => sub { }; }; +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { resources => $self->resources }; + + return $config; +}; + + sub metadata { my ($self) = @_; diff --git a/lib/Dist/Zilla/Plugin/MetaYAML.pm b/lib/Dist/Zilla/Plugin/MetaYAML.pm index 068c0cfc7..a429b9285 100644 --- a/lib/Dist/Zilla/Plugin/MetaYAML.pm +++ b/lib/Dist/Zilla/Plugin/MetaYAML.pm @@ -45,6 +45,17 @@ has version => ( default => '1.4', ); +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { version => $self->version }; + + return $config; +}; + sub gather_files { my ($self, $arg) = @_; diff --git a/lib/Dist/Zilla/Plugin/ModuleBuild.pm b/lib/Dist/Zilla/Plugin/ModuleBuild.pm index a789e5ad4..313bacdaf 100644 --- a/lib/Dist/Zilla/Plugin/ModuleBuild.pm +++ b/lib/Dist/Zilla/Plugin/ModuleBuild.pm @@ -127,6 +127,19 @@ sub _add_build_elements { return '$build->add_build_element($_) for qw(' . join(' ', @elems) . ');'; } +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { + map { $_ => $self->$_ } qw(mb_version mb_class mb_lib), + }; + + return $config; +}; + sub register_prereqs { my ($self) = @_; diff --git a/lib/Dist/Zilla/Plugin/ModuleShareDirs.pm b/lib/Dist/Zilla/Plugin/ModuleShareDirs.pm index 29684f07c..a3fc9ff29 100644 --- a/lib/Dist/Zilla/Plugin/ModuleShareDirs.pm +++ b/lib/Dist/Zilla/Plugin/ModuleShareDirs.pm @@ -62,5 +62,17 @@ around BUILDARGS => sub { }; with 'Dist::Zilla::Role::ShareDir'; + +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { module_map => $self->_module_map }; + + return $config; +}; + __PACKAGE__->meta->make_immutable; 1; diff --git a/lib/Dist/Zilla/Plugin/NextRelease.pm b/lib/Dist/Zilla/Plugin/NextRelease.pm index 37797cb5e..1679c3cba 100644 --- a/lib/Dist/Zilla/Plugin/NextRelease.pm +++ b/lib/Dist/Zilla/Plugin/NextRelease.pm @@ -103,6 +103,19 @@ sub section_header { return _format_version($self->format, $self); } +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { + map { $_ => $self->$_ } qw(time_zone format filename update_filename user_stash), + }; + + return $config; +}; + has _original_changes_content => ( is => 'rw', isa => 'Str', diff --git a/lib/Dist/Zilla/Plugin/PkgVersion.pm b/lib/Dist/Zilla/Plugin/PkgVersion.pm index 0641c05cb..65bae322f 100644 --- a/lib/Dist/Zilla/Plugin/PkgVersion.pm +++ b/lib/Dist/Zilla/Plugin/PkgVersion.pm @@ -97,6 +97,19 @@ sub BUILD { if $self->use_our; } +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { + map { $_ => $self->$_ ? 1 : 0 } qw(die_on_existing_version die_on_line_insertion), + }; + + return $config; +}; + sub munge_files { my ($self) = @_; diff --git a/lib/Dist/Zilla/Plugin/PodVersion.pm b/lib/Dist/Zilla/Plugin/PodVersion.pm index 8168251f0..150b25c5d 100644 --- a/lib/Dist/Zilla/Plugin/PodVersion.pm +++ b/lib/Dist/Zilla/Plugin/PodVersion.pm @@ -20,6 +20,20 @@ will not be added. =cut +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { + finder => [ sort @{ $self->finder } ], + }; + + return $config; +}; + + sub munge_files { my ($self) = @_; diff --git a/lib/Dist/Zilla/Plugin/PruneCruft.pm b/lib/Dist/Zilla/Plugin/PruneCruft.pm index b0ddf7e1f..2e8336617 100644 --- a/lib/Dist/Zilla/Plugin/PruneCruft.pm +++ b/lib/Dist/Zilla/Plugin/PruneCruft.pm @@ -84,6 +84,19 @@ sub exclude_file { return; } +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { + except => [ sort @{ $self->except } ], + }; + + return $config; +}; + sub prune_files { my ($self) = @_; diff --git a/lib/Dist/Zilla/Plugin/PruneFiles.pm b/lib/Dist/Zilla/Plugin/PruneFiles.pm index 7d15752a9..6dad26015 100644 --- a/lib/Dist/Zilla/Plugin/PruneFiles.pm +++ b/lib/Dist/Zilla/Plugin/PruneFiles.pm @@ -55,6 +55,19 @@ has matches => ( default => sub { [] }, ); +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { + map { $_ => [ sort @{ $self->$_ } ] } qw(filenames matches), + }; + + return $config; +}; + sub prune_files { my ($self) = @_; diff --git a/lib/Dist/Zilla/Plugin/ShareDir.pm b/lib/Dist/Zilla/Plugin/ShareDir.pm index c12d5abcd..0c64b57c1 100644 --- a/lib/Dist/Zilla/Plugin/ShareDir.pm +++ b/lib/Dist/Zilla/Plugin/ShareDir.pm @@ -41,5 +41,17 @@ sub share_dir_map { } with 'Dist::Zilla::Role::ShareDir'; + +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { dir => $self->dir }; + + return $config; +}; + __PACKAGE__->meta->make_immutable; 1; diff --git a/t/commands/authordeps.t b/t/commands/authordeps.t index 7571e8cb8..6751b20d5 100644 --- a/t/commands/authordeps.t +++ b/t/commands/authordeps.t @@ -19,7 +19,7 @@ cmp_deeply( +{ perl => '5.005' }, +{ 'List::MoreUtils'=> '!= 0.407' }, ( map { +{"Dist::Zilla::Plugin::$_" => '5.0'} } qw ), - ( map { +{"Dist::Zilla::Plugin::$_" => 0} } qw ), + ( map { +{"Dist::Zilla::Plugin::$_" => 0} } qw ), +{ 'Software::License::Perl_5' => '0' }, ], "authordeps in corpus/dist/AuthorDeps"