Dist-Zilla-PluginBundle-ATOOMIC

 view release on metacpan or  search on metacpan

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

package Pod::Weaver::PluginBundle::ATOOMIC;

use strict;
use warnings;

our $VERSION = '1.00';

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

use Dist::Zilla::Plugin::PodWeaver;
use List::Util qw( first );
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 $license_plugin = $self->_plugin_matching( $zilla, 'License' );
    my $license_filename
        = $license_plugin ? $license_plugin->filename : 'LICENSE';

    my @weaver_config = (
        '@CorePrep',
        [ '-SingleEncoding' => { encoding => 'UTF-8' } ],
        [ '-Transformer'    => List => { transformer => 'List' } ],
        [ '-Transformer'    => Verbatim => { transformer => 'Verbatim' } ],
        [ 'Region'          => 'header' ],
        'Name',
        'Version',
        [ 'Region'  => 'prelude' ],
        [ 'Generic' => 'SYNOPSIS' ],
        [ 'Generic' => 'DESCRIPTION' ],
        [ 'Generic' => 'OVERVIEW' ],
        [ 'Collect' => 'ATTRIBUTES' => { command => 'attr' } ],
        [ 'Collect' => 'METHODS' => { command => 'method' } ],
        [ 'Collect' => 'FUNCTIONS' => { command => 'func' } ],
        [ 'Collect' => 'TYPES' => { command => 'type' } ],
        'Leftovers',



( run in 2.418 seconds using v1.01-cache-2.11-cpan-75ffa21a3d4 )