Permalink
Browse files

Allow specifying enable/disable multiple times in dist.ini

  • Loading branch information...
1 parent 21612c6 commit 62b4ad511f18b6fc1a40b62a750989a3e9c6bb8f @doherty committed Jun 16, 2012
Showing with 24 additions and 10 deletions.
  1. +1 −0 Changes
  2. +23 −10 lib/Dist/Zilla/PluginBundle/TestingMania.pm
View
@@ -2,6 +2,7 @@ Changelog for Dist::Zilla::PluginBundle::TestingMania
{{$NEXT}}
* Require JSON::PP 2.27103
+ * Allow specifying enable/disable multiple times in dist.ini instead of a comma-separated list
0.15 2011-12-15
* List prereqs as prereqs instead of use-ing them [Caleb Cushing]
@@ -146,26 +146,43 @@ Set C<changelog> in F<dist.ini> if you don't use F<Changes>:
=head2 Disabling Tests
-To exclude a testing plugin, give a comma-separated list in F<dist.ini>:
+To exclude a testing plugin, specify them with C<disable> in F<dist.ini>
[@TestingMania]
- disable = Test::DistManifest,Test::Kwalitee
+ disable = Test::DistManifest
+ disable = Test::Kwalitee
=head2 Enabling Tests
This pluginbundle may have some testing plugins that aren't
enabled by default. This option allows you to turn them on. Attempting to add
plugins which are not listed above will have I<no effect>.
-To enable a testing plugin, give a comma-separated list in F<dist.ini>:
+To enable a testing plugin, specify them in F<dist.ini>:
[@TestingMania]
enable = Test::Compile
-=for Pod::Coverage configure
+=for Pod::Coverage configure mvp_multivalue_args
=cut
+has enable => (
+ is => 'ro',
+ isa => 'ArrayRef[Str]',
+ lazy => 1,
+ default => sub { $_[0]->payload->{enable} || [] },
+);
+
+has disable => (
+ is => 'ro',
+ isa => 'ArrayRef[Str]',
+ lazy => 1,
+ default => sub { $_[0]->payload->{disable} || [] },
+);
+
+sub mvp_multivalue_args { qw(enable disable) }
+
sub configure {
my $self = shift;
@@ -191,9 +208,7 @@ sub configure {
);
my @include = ();
- my @disable = $self->payload->{disable}
- ? split(/, ?/, $self->payload->{disable})
- : ();
+ my @disable = map { (split /,\s?/, $_) } @{ $self->disable };
foreach my $plugin (keys %plugins) {
next if ( # Skip...
$plugin ~~ @disable or # plugins they asked to skip
@@ -205,9 +220,7 @@ sub configure {
: $plugin);
}
- my @enable = $self->payload->{enable}
- ? split(/, ?/, $self->payload->{enable})
- : ();
+ my @enable = map { (split /,\s?/, $_) } @{ $self->enable };
foreach my $plugin (@enable) {
next unless $plugin ~~ %plugins; # Skip the plugin unless it is in the list of actual testing plugins
push(@include, $plugin) unless ($plugin ~~ @include or $plugin ~~ @disable);

0 comments on commit 62b4ad5

Please sign in to comment.