Skip to content

Commit

Permalink
dump configs in all plugins that have one
Browse files Browse the repository at this point in the history
  • Loading branch information
karenetheridge committed Apr 7, 2016
1 parent d26b1a1 commit 3229636
Show file tree
Hide file tree
Showing 31 changed files with 325 additions and 1 deletion.
1 change: 1 addition & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions corpus/dist/AuthorDeps/dist.ini
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ version = 2
:version = 5.0
encoding = bytes
filename = t/data.bin

[MetaConfig]
2 changes: 2 additions & 0 deletions corpus/dist/AutoPrereqs/dist.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ filename = t/data.bin

[Prereqs / DevelopRequires]
String::Formatter = 0

[MetaConfig]
1 change: 1 addition & 0 deletions corpus/dist/DZ-NonAscii/dist.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ copyright_holder = ภูมิพลอดุลยเดช
[@Classic]
[MetaJSON]
[NextRelease]
[MetaConfig]
1 change: 1 addition & 0 deletions corpus/dist/DZ1/dist.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ license = Perl_5
copyright_holder = E. Xavier Ample

[@Classic]
[MetaConfig]
15 changes: 15 additions & 0 deletions lib/Dist/Zilla/Plugin/AutoPrereqs.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
13 changes: 13 additions & 0 deletions lib/Dist/Zilla/Plugin/AutoVersion.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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) = @_;

Expand Down
11 changes: 11 additions & 0 deletions lib/Dist/Zilla/Plugin/CPANFile.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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) = @_;

Expand Down
14 changes: 14 additions & 0 deletions lib/Dist/Zilla/Plugin/Encoding.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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) = @_;

Expand Down
12 changes: 12 additions & 0 deletions lib/Dist/Zilla/Plugin/ExecDir.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
11 changes: 11 additions & 0 deletions lib/Dist/Zilla/Plugin/FakeRelease.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
13 changes: 13 additions & 0 deletions lib/Dist/Zilla/Plugin/FileFinder/ByName.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
13 changes: 13 additions & 0 deletions lib/Dist/Zilla/Plugin/FileFinder/Filter.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
11 changes: 11 additions & 0 deletions lib/Dist/Zilla/Plugin/FinderCode.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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) = @_;

Expand Down
14 changes: 14 additions & 0 deletions lib/Dist/Zilla/Plugin/GenerateFile.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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) = @_;

Expand Down
13 changes: 13 additions & 0 deletions lib/Dist/Zilla/Plugin/License.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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) = @_;

Expand Down
14 changes: 14 additions & 0 deletions lib/Dist/Zilla/Plugin/MakeMaker.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
11 changes: 11 additions & 0 deletions lib/Dist/Zilla/Plugin/ManifestSkip.pm
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@ Other modules: L<ExtUtils::Manifest>.

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;
Expand Down
13 changes: 13 additions & 0 deletions lib/Dist/Zilla/Plugin/MetaJSON.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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) = @_;

Expand Down
13 changes: 13 additions & 0 deletions lib/Dist/Zilla/Plugin/MetaNoIndex.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
12 changes: 12 additions & 0 deletions lib/Dist/Zilla/Plugin/MetaResources.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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) = @_;

Expand Down
11 changes: 11 additions & 0 deletions lib/Dist/Zilla/Plugin/MetaYAML.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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) = @_;

Expand Down
13 changes: 13 additions & 0 deletions lib/Dist/Zilla/Plugin/ModuleBuild.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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) = @_;

Expand Down
Loading

0 comments on commit 3229636

Please sign in to comment.