Skip to content

Commit

Permalink
allow version ranges in authordep specifications
Browse files Browse the repository at this point in the history
  • Loading branch information
karenetheridge authored and rjbs committed Aug 8, 2015
1 parent 0a5cae0 commit 37b00ff
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Revision history for {{$dist->name}}
- better errors when a global config package isn't available (thanks,
Karen Etheridge)
- added the "ignore" option to [Encoding] (thanks, Yanick Champoux)
- allow ; authordep specifications to contain version ranges

5.037 2015-06-04 21:46:38-04:00 America/New_York
- issue a warning when version ranges are passed through to
Expand Down
1 change: 1 addition & 0 deletions corpus/dist/AuthorDeps/dist.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ copyright_holder = foobar
copyright_year = 2009

; authordep perl = 5.005
; authordep List::MoreUtils = != 0.407

[GatherDir]
[ExecDir/BadlyPaddedName]
Expand Down
4 changes: 2 additions & 2 deletions lib/Dist/Zilla/Util/AuthorDeps.pm
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ sub extract_author_deps {
my @packages;
while (<$fh>) {
chomp;
next unless /\A\s*;\s*authordep\s*(\S+)\s*(?:=\s*(\S+))?\s*\z/;
next unless /\A\s*;\s*authordep\s*(\S+)\s*(?:=\s*(.+))?\s*\z/;
my $ver = defined $2 ? $2 : "0";
# Any "; authordep " is inserted at the beginning of the list
# in the file order so the user can control the order of at least a part of
# the plugin list
push @packages, $1;
# And added to the requirements so we can use it later
$reqs->add_minimum($1 => $ver);
$reqs->add_string_requirement($1 => $ver);
}

my $vermap = $reqs->as_string_hash;
Expand Down
4 changes: 3 additions & 1 deletion t/commands/authordeps.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use strict;
use warnings;
use Test::More 0.88 tests => 1;
use Test::Deep;

use autodie;

Expand All @@ -12,10 +13,11 @@ my $authordeps =
0
);

is_deeply(
cmp_deeply(
$authordeps,
[
+{ perl => '5.005' },
+{ 'List::MoreUtils'=> '!= 0.407' },
( map { +{"Dist::Zilla::Plugin::$_" => '5.0'} } qw<AutoPrereqs Encoding ExecDir> ),
( map { +{"Dist::Zilla::Plugin::$_" => 0} } qw<GatherDir MetaYAML> ),
+{ 'Software::License::Perl_5' => '0' },
Expand Down

0 comments on commit 37b00ff

Please sign in to comment.