Skip to content

Commit

Permalink
Add to_relationship = none support
Browse files Browse the repository at this point in the history
  • Loading branch information
kentfredric committed Feb 28, 2015
1 parent a7dc575 commit ac9c807
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ Release history for Dist-Zilla-Plugin-Prereqs-Soften
- runtime: ↓1 (recommends: +1 -1)
- test: +1 (recommends: ↑1 ↓1)

[Features]
- Can now specify to_relationship = none. This is useful in conjunction with copy_to to move phases. Its admittedly
awkward syntax, but I need to re-write half the internals now because YAGNI made them too simple earlier, and now
IGNI.

0.005001 2014-09-29T14:03:18Z
[Bugfix]
- Dont fail with newer OptionalFaetures due to test subsequently needing a Makefile.PL to work
Expand Down
3 changes: 2 additions & 1 deletion lib/Dist/Zilla/Plugin/Prereqs/Soften.pm
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ use Moose::Util::TypeConstraints qw(enum);

has 'to_relationship' => (
is => ro =>,
isa => enum( [qw(requires recommends suggests conflicts)] ),
isa => enum( [qw(none requires recommends suggests conflicts)] ),
lazy => 1,
default => sub { 'recommends' },
);
Expand Down Expand Up @@ -193,6 +193,7 @@ sub _soften_prereqs {
my @target_reqs;

for my $target ( @{ $conf->{to} } ) {
next if $target->{relation} eq 'none';
push @target_reqs, $prereqs->requirements_for( $target->{phase}, $target->{relation} );
}

Expand Down
44 changes: 44 additions & 0 deletions t/05-to_relationship-none.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

use strict;
use warnings;

use Test::More;

# FILENAME: 01-basic.t
# CREATED: 03/23/14 19:41:51 by Kent Fredric (kentnl) <kentfredric@gmail.com>
# ABSTRACT: Basic interface test

use Test::DZil qw(simple_ini);
use Dist::Zilla::Util::Test::KENTNL 1.003002 qw( dztest );

my $test = dztest();
my @ini;

push @ini, [ 'Prereqs', { 'Foo' => 1 } ];
push @ini, [ 'Prereqs::Soften', { 'module' => 'Foo', 'to_relationship' => 'none', copy_to => 'develop.requires' } ];
push @ini, ['GatherDir'];

$test->add_file( 'dist.ini', simple_ini(@ini) );
$test->add_file( 'lib/E.pm', <<'EO_EPM');
use strict;
use warnings;
package E;
# ABSTRACT: Fake dist stub
use Moose;
with 'Dist::Zilla::Role::Plugin';
1;
EO_EPM

$test->build_ok;
$test->prereqs_deeply(
{
develop => { requires => { 'Foo' => '1' } },
}
);

done_testing;

0 comments on commit ac9c807

Please sign in to comment.