Skip to content

Commit 75c7e79

Browse files
dump configs in all plugins that have one
1 parent 212b94b commit 75c7e79

31 files changed

+325
-1
lines changed

Changes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Revision history for {{$dist->name}}
22

33
{{$NEXT}}
4+
- more plugins add their config to metadata when [MetaConfig] is used
45

56
5.043 2016-01-04 22:54:56-05:00 America/New_York
67
- dzil test now supports --extended to set EXTENDED_TESTING (thanks,

corpus/dist/AuthorDeps/dist.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@ version = 2
2323
:version = 5.0
2424
encoding = bytes
2525
filename = t/data.bin
26+
27+
[MetaConfig]

corpus/dist/AutoPrereqs/dist.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,5 @@ filename = t/data.bin
2020

2121
[Prereqs / DevelopRequires]
2222
String::Formatter = 0
23+
24+
[MetaConfig]

corpus/dist/DZ-NonAscii/dist.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ copyright_holder = ภูมิพลอดุลยเดช
88
[@Classic]
99
[MetaJSON]
1010
[NextRelease]
11+
[MetaConfig]

corpus/dist/DZ1/dist.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ license = Perl_5
55
copyright_holder = E. Xavier Ample
66

77
[@Classic]
8+
[MetaConfig]

lib/Dist/Zilla/Plugin/AutoPrereqs.pm

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,23 @@ has scanners => (
126126
has skips => (
127127
is => 'ro',
128128
isa => 'ArrayRef[Str]',
129+
default => sub { [] },
129130
);
130131

132+
around dump_config => sub {
133+
my $orig = shift;
134+
my $self = shift;
135+
136+
my $config = $self->$orig;
137+
138+
$config->{+__PACKAGE__} = {
139+
(map { $_ => [ sort @{ $self->$_ } ] } qw(finder test_finder configure_finder extra_scanners skips)),
140+
($self->has_scanners ? (scanners => $self->scanners) : ()),
141+
};
142+
143+
return $config;
144+
};
145+
131146
sub register_prereqs {
132147
my $self = shift;
133148

lib/Dist/Zilla/Plugin/AutoVersion.pm

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,19 @@ has format => (
6464
. q<{{$ENV{DEV} ? (sprintf '_%03u', $ENV{DEV}) : ''}}>
6565
);
6666

67+
around dump_config => sub {
68+
my $orig = shift;
69+
my $self = shift;
70+
71+
my $config = $self->$orig;
72+
73+
$config->{+__PACKAGE__} = {
74+
map { $_ => $self->$_ } qw(major format time_zone),
75+
};
76+
77+
return $config;
78+
};
79+
6780
sub provide_version {
6881
my ($self) = @_;
6982

lib/Dist/Zilla/Plugin/CPANFile.pm

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,17 @@ sub _hunkify_hunky_hunk_hunks {
3737
return $str;
3838
}
3939

40+
around dump_config => sub {
41+
my $orig = shift;
42+
my $self = shift;
43+
44+
my $config = $self->$orig;
45+
46+
$config->{+__PACKAGE__} = { filename => $self->filename };
47+
48+
return $config;
49+
};
50+
4051
sub gather_files {
4152
my ($self, $arg) = @_;
4253

lib/Dist/Zilla/Plugin/Encoding.pm

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,20 @@ has ignore => (
7878
default => sub { [] },
7979
);
8080

81+
around dump_config => sub {
82+
my $orig = shift;
83+
my $self = shift;
84+
85+
my $config = $self->$orig;
86+
87+
$config->{+__PACKAGE__} = {
88+
encoding => $self->encoding,
89+
map { $_ => [ sort @{ $self->$_ } ] } qw(filenames matches),
90+
};
91+
92+
return $config;
93+
};
94+
8195
sub set_file_encodings {
8296
my ($self) = @_;
8397

lib/Dist/Zilla/Plugin/ExecDir.pm

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,17 @@ sub find_files {
3232
}
3333

3434
with 'Dist::Zilla::Role::ExecFiles';
35+
36+
around dump_config => sub {
37+
my $orig = shift;
38+
my $self = shift;
39+
40+
my $config = $self->$orig;
41+
42+
$config->{+__PACKAGE__} = { dir => $self->dir };
43+
44+
return $config;
45+
};
46+
3547
__PACKAGE__->meta->make_immutable;
3648
1;

0 commit comments

Comments
 (0)