Dist-Zilla-PluginBundle-MAXMIND

 view release on metacpan or  search on metacpan

lib/Pod/Weaver/PluginBundle/MAXMIND.pm  view on Meta::CPAN

package Pod::Weaver::PluginBundle::MAXMIND;

use strict;
use warnings;

our $VERSION = '0.84';

use namespace::autoclean -also => ['_exp'];

use Dist::Zilla::Plugin::PodWeaver;
use Module::Runtime qw( use_module );
use PadWalker qw( peek_sub );
use Pod::Elemental::Transformer::List;
use Pod::Elemental::Transformer::Verbatim;
use Pod::Weaver::Config::Assembler;
use Pod::Weaver::Plugin::SingleEncoding;
use Pod::Weaver::Plugin::Transformer;
use Pod::Weaver::Section::AllowOverride;
use Pod::Weaver::Section::Authors;
use Pod::Weaver::Section::Collect;
use Pod::Weaver::Section::Contributors;
use Pod::Weaver::Section::GenerateSection;
use Pod::Weaver::Section::Generic;
use Pod::Weaver::Section::Leftovers;
use Pod::Weaver::Section::Legal;
use Pod::Weaver::Section::Name;
use Pod::Weaver::Section::Region;
use Pod::Weaver::Section::Version;

sub _exp {
    return Pod::Weaver::Config::Assembler->expand_package( $_[0] );
}

sub configure {
    my $self = shift;

    # this sub behaves somewhat like a Dist::Zilla pluginbundle's configure()
    # -- it returns a list of strings or 1, 2 or 3-element arrayrefs
    # containing plugin specifications. The goal is to make this look as close
    # to what weaver.ini looks like as possible.

    # I wouldn't have to do this ugliness if I could have some configuration
    # values passed in from weaver.ini or the [PodWeaver] plugin's use of
    # config_plugin (where I could define a 'licence' option)

    ## no critic (Subroutines::ProhibitCallsToUnexportedSubs)
    my $podweaver_plugin
        = ${ peek_sub( \&Dist::Zilla::Plugin::PodWeaver::weaver )->{'$self'}
        };

    my $zilla = $podweaver_plugin->zilla;
    my $bundle_prefix;
    for my $name ( map { $_->plugin_name } @{ $zilla->plugins } ) {

        # We want a plugin that was added by our bundle.
        next unless ($bundle_prefix) = $name =~ m{^(.+)/};
        last;
    }

    my $license_plugin = $zilla->plugin_named( $bundle_prefix . '/License' );
    my $license_filename
        = $license_plugin ? $license_plugin->filename : 'LICENSE';

    my $config
        = $zilla->plugin_named( $bundle_prefix . '/MAXMIND::WeaverConfig' );

    my @config = (
        '@CorePrep',
        [ '-SingleEncoding' => { encoding => 'UTF-8' } ],
        [ '-Transformer'    => List     => { transformer => 'List' } ],
        [ '-Transformer'    => Verbatim => { transformer => 'Verbatim' } ],
        [ 'Region'          => 'header' ],



( run in 2.600 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )