« blib/lib/Dist/Zilla/Role/Git/StringFormatter.pm
↑ Summary
blib/lib/Dist/Zilla/Plugin/Git/CommitBuild.pm »
| 1 | # | ||
| 2 | # This file is part of Dist-Zilla-Plugin-Git | ||
| 3 | # | ||
| 4 | # This software is copyright (c) 2009 by Jerome Quelin. | ||
| 5 | # | ||
| 6 | # This is free software; you can redistribute it and/or modify it under | ||
| 7 | # the same terms as the Perl 5 programming language system itself. | ||
| 8 | # | ||
| 9 | use 5.008; | ||
| 10 | use strict; | ||
| 11 | use warnings; | ||
| 12 | |||
| 13 | package Dist::Zilla::PluginBundle::Git; | ||
| 14 | # ABSTRACT: All git plugins in one bundle | ||
| 15 | |||
| 16 | our $VERSION = '2.052'; | ||
| 17 | |||
| 18 | use Moose; | ||
| 19 | use Module::Runtime 'use_module'; | ||
| 20 | use namespace::autoclean; | ||
| 21 | |||
| 22 | with 'Dist::Zilla::Role::PluginBundle'; | ||
| 23 | |||
| 24 | # bundle all git plugins | ||
| 25 | my @names = qw{ Check Commit Tag Push }; | ||
| 26 | |||
| 27 | my %multi; | ||
| 28 | for my $name (@names) { | ||
| 29 | my $class = "Dist::Zilla::Plugin::Git::$name"; | ||
| 30 | use_module $class; | ||
| 31 | @multi{$class->mvp_multivalue_args} = (); | ||
| 32 | } | ||
| 33 | |||
| 34 | sub mvp_multivalue_args { keys %multi; } | ||
| 35 | |||
| 36 | sub bundle_config { | ||
| 37 | my ($self, $section) = @_; | ||
| 38 | #my $class = ( ref $self ) || $self; | ||
| 39 | my $arg = $section->{payload}; | ||
| 40 | |||
| 41 | my @config; | ||
| 42 | |||
| 43 | for my $name (@names) { | ||
| 44 | my $class = "Dist::Zilla::Plugin::Git::$name"; | ||
| 45 | my %payload; | ||
| 46 | foreach my $k (keys %$arg) { | ||
| 47 | $payload{$k} = $arg->{$k} if $class->can($k); | ||
| 48 | } | ||
| 49 | push @config, [ "$section->{name}/$name" => $class => \%payload ]; | ||
| 50 | } | ||
| 51 | |||
| 52 | return @config; | ||
| 53 | } | ||
| 54 | |||
| 55 | |||
| 56 | __PACKAGE__->meta->make_immutable; | ||
| 57 | no Moose; | ||
| 58 | 1; | ||
| 59 | |||
| 60 | __END__ |