summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2010-06-15 10:35:41 -0500
committerJesse Luehrs <doy@tozt.net>2010-06-15 10:35:41 -0500
commit6fad5906e1d1f27d2eca0bd9fe77931282616ea8 (patch)
tree0719bd8d010ba26e85137e04e9bd6dca26ecb29a /lib
parenta98afe009962ed30555d1e7180e809ffdb0bacea (diff)
downloaddist-zilla-pluginbundle-doy-6fad5906e1d1f27d2eca0bd9fe77931282616ea8.tar.gz
dist-zilla-pluginbundle-doy-6fad5906e1d1f27d2eca0bd9fe77931282616ea8.zip
allow passing in sub-options
Diffstat (limited to 'lib')
-rw-r--r--lib/Dist/Zilla/PluginBundle/DOY.pm77
1 files changed, 61 insertions, 16 deletions
diff --git a/lib/Dist/Zilla/PluginBundle/DOY.pm b/lib/Dist/Zilla/PluginBundle/DOY.pm
index 779bcf7..005d3be 100644
--- a/lib/Dist/Zilla/PluginBundle/DOY.pm
+++ b/lib/Dist/Zilla/PluginBundle/DOY.pm
@@ -81,6 +81,65 @@ has github_url => (
},
);
+has extra_plugins => (
+ is => 'ro',
+ isa => 'ArrayRef[Str]',
+ init_arg => undef,
+ lazy => 1,
+ default => sub {
+ my $self = shift;
+ [
+ 'MetaConfig',
+ 'MetaJSON',
+ 'NextRelease',
+ 'CheckChangesHasContent',
+ 'PkgVersion',
+ 'PodCoverageTests',
+ 'PodSyntaxTests',
+ 'NoTabsTests',
+ 'EOLTests',
+ 'CompileTests',
+ 'Repository',
+ 'Git::Check',
+ 'Git::Tag',
+ 'BumpVersionFromGit',
+ $self->is_task ? 'TaskWeaver' : 'PodWeaver',
+ ]
+ },
+);
+
+has plugin_options => (
+ is => 'ro',
+ isa => 'HashRef[HashRef[Str]]',
+ init_arg => undef,
+ lazy => 1,
+ default => sub {
+ my $self = shift;
+ my %opts = (
+ 'NextRelease' => { format => '%-5v %{yyyy-MM-dd}d' },
+ 'Repository' => {
+ git_remote => $self->github_url,
+ github_http => 0
+ },
+ 'Git::Check' => { allow_dirty => '' },
+ 'Git::Tag' => { tag_format => '%v', tag_message => '' },
+ 'BumpVersionFromGit' => {
+ version_regexp => '^(\d+\.\d+)$',
+ first_version => '0.01'
+ },
+ );
+
+ for my $option (keys %{ $self->payload }) {
+ next unless $option =~ /^([A-Z][^_]*)_(.+)$/;
+ my ($plugin, $plugin_option) = ($1, $2);
+ $opts{$plugin} ||= {};
+ $opts{$plugin}->{$plugin_option} = $self->payload->{$option};
+ }
+
+ return \%opts;
+ },
+);
+
around BUILDARGS => sub {
my $orig = shift;
my $class = shift;
@@ -102,23 +161,9 @@ sub configure {
}
$self->add_plugins(
- 'MetaConfig',
- 'MetaJSON',
- ['NextRelease' => { format => '%-5v %{yyyy-MM-dd}d' }],
- 'CheckChangesHasContent',
- 'PkgVersion',
- 'PodCoverageTests',
- 'PodSyntaxTests',
- 'NoTabsTests',
- 'EOLTests',
- 'CompileTests',
- ['Repository' => { git_remote => $self->github_url, github_http => 0 }],
- ['Git::Check' => { allow_dirty => '' }],
- ['Git::Tag' => { tag_format => '%v', tag_message => '' }],
- ['BumpVersionFromGit' => { version_regexp => '^(\d+\.\d+)$', first_version => '0.01'}],
+ map { [ $_ => ($self->plugin_options->{$_} || {}) ] }
+ @{ $self->extra_plugins },
);
-
- $self->add_plugins($self->is_task ? 'TaskWeaver' : 'PodWeaver');
}
=head1 SEE ALSO