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 Jun 28, 2015
1 parent b3452f1 commit 144d932
Show file tree
Hide file tree
Showing 29 changed files with 311 additions and 1 deletion.
2 changes: 2 additions & 0 deletions corpus/dist/AuthorDeps/dist.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,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 @@ -17,3 +17,5 @@ version = 2
[Encoding]
encoding = bytes
filename = t/data.bin

[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 @@ -116,8 +116,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 @@ -64,6 +64,20 @@ has matches => (
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
14 changes: 14 additions & 0 deletions lib/Dist/Zilla/Plugin/MakeMaker.pm
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,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 @@ -44,6 +44,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 @@ -61,6 +61,18 @@ sub BUILDARGS {
};
}

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 @@ -108,6 +108,19 @@ sub _dump_as {
return $dumper->Dump;
}

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
12 changes: 12 additions & 0 deletions lib/Dist/Zilla/Plugin/ModuleShareDirs.pm
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,17 @@ sub BUILDARGS {
}

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;
13 changes: 13 additions & 0 deletions lib/Dist/Zilla/Plugin/NextRelease.pm
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,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',
Expand Down
Loading

0 comments on commit 144d932

Please sign in to comment.