Skip to content

Commit

Permalink
Merge pull request #58 from kentfredric/pull-deps-fixes
Browse files Browse the repository at this point in the history
Avoid YAML::XS 0.61 in Makefile.PL
  • Loading branch information
preaction committed Feb 23, 2016
2 parents 0ca6f9f + 40068c9 commit e4acb27
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 1 deletion.
1 change: 1 addition & 0 deletions .mailmap
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Doug Bell <preaction@cpan.org> <madcityzen@gmail.com>
Doug Bell <preaction@cpan.org> <doug.bell@baml.com>
Kent Fredric <kentnl@cpan.org> <kentfredric@gmail.com>
41 changes: 40 additions & 1 deletion Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ my %WriteMakefileArgs = (
"ABSTRACT" => "Lightweight Dependency Injection Container",
"AUTHOR" => "Doug Bell <preaction\@cpan.org>, Al Newkirk <anewkirk\@ana.io>",
"CONFIGURE_REQUIRES" => {
"ExtUtils::MakeMaker" => 0
"CPAN::Meta::Requirements" => "2.120620",
"ExtUtils::MakeMaker" => 0,
"Module::Metadata" => 0
},
"DISTNAME" => "Beam-Wire",
"EXE_FILES" => [],
Expand Down Expand Up @@ -66,6 +68,10 @@ my %FallbackPrereqs = (
"YAML" => 0
);

# inserted by Dist::Zilla::Plugin::DynamicPrereqs 0.019
# Breaks LoadFile(path(...))
has_module('YAML::XS','== 0.61') and requires('YAML::XS','0.62');


unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
delete $WriteMakefileArgs{TEST_REQUIRES};
Expand All @@ -77,3 +83,36 @@ delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
unless eval { ExtUtils::MakeMaker->VERSION(6.52) };

WriteMakefile(%WriteMakefileArgs);

# inserted by Dist::Zilla::Plugin::DynamicPrereqs 0.019
sub _add_prereq {
my ($mm_key, $module, $version_or_range) = @_;
warn "$module already exists in $mm_key -- need to do a sane metamerge!"
if exists $WriteMakefileArgs{$mm_key}{$module}
and $WriteMakefileArgs{$mm_key}{$module} ne ($version_or_range || 0);
warn "$module already exists in FallbackPrereqs -- need to do a sane metamerge!"
if exists $FallbackPrereqs{$module} and $FallbackPrereqs{$module} ne ($version_or_range || 0);
$WriteMakefileArgs{$mm_key}{$module} = $FallbackPrereqs{$module} = $version_or_range || 0;
return;
}

sub has_module {
my ($module, $version_or_range) = @_;
require Module::Metadata;
my $mmd = Module::Metadata->new_from_module($module);
return undef if not $mmd;
return $mmd->version($module) if not defined $version_or_range;

require CPAN::Meta::Requirements;
my $req = CPAN::Meta::Requirements->new;
$req->add_string_requirement($module => $version_or_range);
return 1 if $req->accepts_module($module => $mmd->version($module));
return 0;
}

sub requires { goto &runtime_requires }

sub runtime_requires {
my ($module, $version_or_range) = @_;
_add_prereq(PREREQ_PM => $module, $version_or_range);
}
1 change: 1 addition & 0 deletions README.mkdn
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,7 @@ The configuration is invalid:

- Bruce Armstrong <bruce@armstronganchor.net>
- Bruce Armstrong <bruce@fortressofgeekdom.org>
- Kent Fredric &lt;kentnl@cpan.org>

# COPYRIGHT AND LICENSE

Expand Down
2 changes: 2 additions & 0 deletions cpanfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,7 @@ on 'test' => sub {
};

on 'configure' => sub {
requires "CPAN::Meta::Requirements" => "2.120620";
requires "ExtUtils::MakeMaker" => "0";
requires "Module::Metadata" => "0";
};
7 changes: 7 additions & 0 deletions dist.ini
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ repository.url = https://github.com/preaction/Beam-Wire.git
bugtracker.web = https://github.com/preaction/Beam-Wire/issues
repository.type = git

[MetaJSON]

; --- Module management
[@Filter]
-bundle = @Basic
Expand Down Expand Up @@ -113,3 +115,8 @@ Test::Deep = 0
Test::Differences = 0.64 ; Fix buggy Text::Diff version
Test::Exception = 0
Test::Lib = 0

[DynamicPrereqs]
-delimiter = |
-raw = |# Breaks LoadFile(path(...))
-raw = |has_module('YAML::XS','== 0.61') and requires('YAML::XS','0.62');

0 comments on commit e4acb27

Please sign in to comment.