Skip to content

Commit

Permalink
Implement a system for passing config the pod weaver bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
autarch committed Aug 13, 2016
1 parent 38a765e commit acce77b
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 9 deletions.
5 changes: 5 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{{$NEXT}}

- Implemented a rather convoluted way of passing config into my Pod::Weaver
bundle in order to allow for disabling the DONATIONS pod section on a
per-distro basis.


0.65 2016-07-04

- Avoid warnings when t/ directory contains non-UTF8 data.
Expand Down
30 changes: 30 additions & 0 deletions lib/Dist/Zilla/Plugin/DROLSKY/WeaverConfig.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package Dist::Zilla::Plugin::DROLSKY::WeaverConfig;

use v5.10;

use strict;
use warnings;
use autodie;
use namespace::autoclean;

our $VERSION = '0.66';

use Moose;

with 'Dist::Zilla::Role::Plugin';

has include_donations_pod => (
is => 'ro',
isa => 'Bool',
default => 1,
);

__PACKAGE__->meta->make_immutable;

1;

# ABSTRACT: A plugin that exists solely to hold Pod::Weaver config

__END__
=for Pod::Coverage .*
14 changes: 9 additions & 5 deletions lib/Dist/Zilla/PluginBundle/DROLSKY.pm
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use Dist::Zilla::Plugin::DROLSKY::Contributors;
use Dist::Zilla::Plugin::DROLSKY::License;
use Dist::Zilla::Plugin::DROLSKY::TidyAll;
use Dist::Zilla::Plugin::DROLSKY::VersionProvider;
use Dist::Zilla::Plugin::DROLSKY::WeaverConfig;
use Dist::Zilla::Plugin::GenerateFile::FromShareDir;
use Dist::Zilla::Plugin::Git::Check;
use Dist::Zilla::Plugin::Git::CheckFor::MergeConflicts;
Expand Down Expand Up @@ -648,11 +649,14 @@ sub _extra_test_plugins {
}

sub _pod_weaver_plugin {
[
SurgicalPodWeaver => {
config_plugin => '@DROLSKY',
},
];
return (
[
SurgicalPodWeaver => {
config_plugin => '@DROLSKY',
},
],
'DROLSKY::WeaverConfig',
);
}

sub _readme_md_plugin {
Expand Down
9 changes: 5 additions & 4 deletions lib/Pod/Weaver/PluginBundle/DROLSKY.pm
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,14 @@ sub configure {
= ${ peek_sub( \&Dist::Zilla::Plugin::PodWeaver::weaver )->{'$self'}
};

my $license_plugin = $podweaver_plugin
&& $podweaver_plugin->zilla->plugin_named('@Author::DROLSKY/License');
my $zilla = $podweaver_plugin->zilla;
my $license_plugin = $zilla->plugin_named('@Author::DROLSKY/License');
my $license_filename
= $license_plugin ? $license_plugin->filename : 'LICENSE';

my $include_donations
= $podweaver_plugin->zilla->copyright_holder =~ /Rolsky/;
my $config = $zilla->plugin_named('@DROLSKY/DROLSKY::WeaverConfig');
my $include_donations = $zilla->copyright_holder =~ /Rolsky/
&& $config->include_donations_pod;

return (
'@CorePrep',
Expand Down

0 comments on commit acce77b

Please sign in to comment.