@@ -1,5 +1,17 @@
Revision history for Path-Iterator-Rule
+1.008 2014-02-04 17:40:45-05:00 America/New_York
+
+ [ADDED]
+
+ - Added VCS rules for DARCS (Gian Piero Carrubba)
+
+1.007 2014-01-25 14:39:09-05:00 America/New_York
+
+ [DOCS]
+
+ - Document the behavior of ->all in scalar context
+
1.006 2013-10-09 11:14:28 America/New_York
[PREREQS]
@@ -1,3 +1,4 @@
+# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.012.
CONTRIBUTING
Changes
LICENSE
@@ -12,7 +13,6 @@ examples/modules-in-inc.pl
lib/PIR.pm
lib/Path/Iterator/Rule.pm
perlcritic.rc
-t/00-compile.t
t/00-report-prereqs.t
t/basic.t
t/breadth-depth-files.t
@@ -38,6 +38,7 @@ t/vcs.t
t/visitor.t
t/x_tests.t
tidyall.ini
+xt/author/00-compile.t
xt/author/critic.t
xt/author/pod-spell.t
xt/release/distmeta.t
@@ -4,7 +4,7 @@
"David Golden <dagolden@cpan.org>"
],
"dynamic_config" : 0,
- "generated_by" : "Dist::Zilla version 4.300039, CPAN::Meta::Converter version 2.132810",
+ "generated_by" : "Dist::Zilla version 5.012, CPAN::Meta::Converter version 2.133380",
"license" : [
"apache_2_0"
],
@@ -32,7 +32,15 @@
},
"develop" : {
"requires" : {
+ "Dist::Zilla" : "5.012",
+ "Dist::Zilla::Plugin::AppendExternalData" : "0",
+ "Dist::Zilla::PluginBundle::DAGOLDEN" : "0.053",
+ "File::Spec" : "0",
+ "File::Temp" : "0",
+ "IO::Handle" : "0",
+ "IPC::Open3" : "0",
"Test::CPAN::Meta" : "0",
+ "Test::More" : "0",
"Test::Pod" : "1.41"
}
},
@@ -54,31 +62,33 @@
}
},
"test" : {
+ "recommends" : {
+ "CPAN::Meta" : "0",
+ "CPAN::Meta::Requirements" : "2.120900"
+ },
"requires" : {
"Exporter" : "0",
"ExtUtils::MakeMaker" : "0",
- "File::Spec" : "0",
"File::Spec::Functions" : "0",
"File::Temp" : "0",
"File::pushd" : "0",
- "IO::Handle" : "0",
- "IPC::Open3" : "0",
"Path::Tiny" : "0",
"Test::Deep" : "0",
"Test::Filename" : "0.03",
"Test::More" : "0.92",
- "lib" : "0"
+ "lib" : "0",
+ "version" : "0"
}
}
},
"provides" : {
"PIR" : {
"file" : "lib/PIR.pm",
- "version" : "1.006"
+ "version" : "1.008"
},
"Path::Iterator::Rule" : {
"file" : "lib/Path/Iterator/Rule.pm",
- "version" : "1.006"
+ "version" : "1.008"
}
},
"release_status" : "stable",
@@ -93,11 +103,13 @@
"web" : "https://github.com/dagolden/Path-Iterator-Rule"
}
},
- "version" : "1.006",
+ "version" : "1.008",
"x_authority" : "cpan:DAGOLDEN",
"x_contributors" : [
"David Steinbrunner <dsteinbrunner@pobox.com>",
+ "Gian Piero Carrubba <gpiero@butterfly.fdc.rm-rf.it>",
"Graham Knop <haarg@cpan.org>",
+ "Ricardo Signes <rjbs@cpan.org>",
"Toby Inkster <tobyink@cpan.org>"
]
}
@@ -5,21 +5,19 @@ author:
build_requires:
Exporter: 0
ExtUtils::MakeMaker: 0
- File::Spec: 0
File::Spec::Functions: 0
File::Temp: 0
File::pushd: 0
- IO::Handle: 0
- IPC::Open3: 0
Path::Tiny: 0
Test::Deep: 0
Test::Filename: 0.03
Test::More: 0.92
lib: 0
+ version: 0
configure_requires:
ExtUtils::MakeMaker: 6.17
dynamic_config: 0
-generated_by: 'Dist::Zilla version 4.300039, CPAN::Meta::Converter version 2.132810'
+generated_by: 'Dist::Zilla version 5.012, CPAN::Meta::Converter version 2.133380'
license: apache
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -36,10 +34,10 @@ no_index:
provides:
PIR:
file: lib/PIR.pm
- version: 1.006
+ version: 1.008
Path::Iterator::Rule:
file: lib/Path/Iterator/Rule.pm
- version: 1.006
+ version: 1.008
requires:
Carp: 0
File::Basename: 0
@@ -58,9 +56,11 @@ resources:
bugtracker: https://github.com/dagolden/Path-Iterator-Rule/issues
homepage: https://github.com/dagolden/Path-Iterator-Rule
repository: https://github.com/dagolden/Path-Iterator-Rule.git
-version: 1.006
+version: 1.008
x_authority: cpan:DAGOLDEN
x_contributors:
- 'David Steinbrunner <dsteinbrunner@pobox.com>'
+ - 'Gian Piero Carrubba <gpiero@butterfly.fdc.rm-rf.it>'
- 'Graham Knop <haarg@cpan.org>'
+ - 'Ricardo Signes <rjbs@cpan.org>'
- 'Toby Inkster <tobyink@cpan.org>'
@@ -1,4 +1,5 @@
+# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.012.
use strict;
use warnings;
@@ -36,49 +37,54 @@ my %WriteMakefileArgs = (
"TEST_REQUIRES" => {
"Exporter" => 0,
"ExtUtils::MakeMaker" => 0,
- "File::Spec" => 0,
"File::Spec::Functions" => 0,
"File::Temp" => 0,
"File::pushd" => 0,
- "IO::Handle" => 0,
- "IPC::Open3" => 0,
"Path::Tiny" => 0,
"Test::Deep" => 0,
"Test::Filename" => "0.03",
"Test::More" => "0.92",
- "lib" => 0
+ "lib" => 0,
+ "version" => 0
},
- "VERSION" => "1.006",
+ "VERSION" => "1.008",
"test" => {
"TESTS" => "t/*.t"
}
);
-unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
- my $tr = delete $WriteMakefileArgs{TEST_REQUIRES};
- my $br = $WriteMakefileArgs{BUILD_REQUIRES};
- for my $mod ( keys %$tr ) {
- if ( exists $br->{$mod} ) {
- $br->{$mod} = $tr->{$mod} if $tr->{$mod} > $br->{$mod};
- }
- else {
- $br->{$mod} = $tr->{$mod};
- }
- }
-}
+my %FallbackPrereqs = (
+ "Carp" => 0,
+ "Exporter" => 0,
+ "ExtUtils::MakeMaker" => 0,
+ "File::Basename" => 0,
+ "File::Spec" => 0,
+ "File::Spec::Functions" => 0,
+ "File::Temp" => 0,
+ "File::pushd" => 0,
+ "List::Util" => 0,
+ "Number::Compare" => "0.02",
+ "Path::Tiny" => 0,
+ "Scalar::Util" => 0,
+ "Test::Deep" => 0,
+ "Test::Filename" => "0.03",
+ "Test::More" => "0.92",
+ "Text::Glob" => 0,
+ "Try::Tiny" => 0,
+ "lib" => 0,
+ "re" => 0,
+ "strict" => 0,
+ "version" => 0,
+ "warnings" => 0,
+ "warnings::register" => 0
+);
-unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) {
- my $br = delete $WriteMakefileArgs{BUILD_REQUIRES};
- my $pp = $WriteMakefileArgs{PREREQ_PM};
- for my $mod ( keys %$br ) {
- if ( exists $pp->{$mod} ) {
- $pp->{$mod} = $br->{$mod} if $br->{$mod} > $pp->{$mod};
- }
- else {
- $pp->{$mod} = $br->{$mod};
- }
- }
+
+unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
+ delete $WriteMakefileArgs{TEST_REQUIRES};
+ delete $WriteMakefileArgs{BUILD_REQUIRES};
+ $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs;
}
delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
@@ -2,7 +2,7 @@ NAME
Path::Iterator::Rule - Iterative, recursive file finder
VERSION
- version 1.006
+ version 1.008
SYNOPSIS
use Path::Iterator::Rule;
@@ -12,7 +12,7 @@ SYNOPSIS
# iterator interface
my $next = $rule->iter( @dirs );
- while ( my $file = $next->() ) {
+ while ( defined( my $file = $next->() ) ) {
...
}
@@ -74,7 +74,7 @@ USAGE
Matching and iteration
"iter"
my $next = $rule->iter( @dirs, \%options);
- while ( my $file = $next->() ) {
+ while ( defined( my $file = $next->() ) ) {
...
}
@@ -142,6 +142,8 @@ USAGE
returned relative to different initial search directories based on
"depthfirst", "follow_symlinks" or "loop_safe".
+ When the iterator is exhausted, it will return undef.
+
"iter_fast"
This works just like "iter", except that it optimizes for speed over
safety. Don't do this unless you're sure you need it and accept the
@@ -154,6 +156,8 @@ USAGE
and has the same behaviors as the "iter" method. The "all" method uses
"iter" internally to fetch all results.
+ In scalar context, it will return the count of matched paths.
+
In void context, it is optimized to iterate over everything, but not
store results. This is most useful with the "visitor" option:
@@ -365,6 +369,7 @@ RULE METHODS
$rule->skip_git;
$rule->skip_bzr;
$rule->skip_hg;
+ $rule->skip_darcs;
Skips files and/or prunes directories related to a version control
system. Just like "skip_dirs", these rules should be specified early to
@@ -519,7 +524,7 @@ EXTENDING
foo => sub {
my @args = @_; # do this to customize closure with arguments
return sub {
- my ($item, $basename) = shift;
+ my ($item, $basename) = @_;
return if -d "$item";
return $basename =~ /^foo$/;
}
@@ -719,8 +724,12 @@ AUTHOR
CONTRIBUTORS
* David Steinbrunner <dsteinbrunner@pobox.com>
+ * Gian Piero Carrubba <gpiero@butterfly.fdc.rm-rf.it>
+
* Graham Knop <haarg@cpan.org>
+ * Ricardo Signes <rjbs@cpan.org>
+
* Toby Inkster <tobyink@cpan.org>
COPYRIGHT AND LICENSE
@@ -15,17 +15,20 @@ requires "warnings::register" => "0";
on 'test' => sub {
requires "Exporter" => "0";
requires "ExtUtils::MakeMaker" => "0";
- requires "File::Spec" => "0";
requires "File::Spec::Functions" => "0";
requires "File::Temp" => "0";
requires "File::pushd" => "0";
- requires "IO::Handle" => "0";
- requires "IPC::Open3" => "0";
requires "Path::Tiny" => "0";
requires "Test::Deep" => "0";
requires "Test::Filename" => "0.03";
requires "Test::More" => "0.92";
requires "lib" => "0";
+ requires "version" => "0";
+};
+
+on 'test' => sub {
+ recommends "CPAN::Meta" => "0";
+ recommends "CPAN::Meta::Requirements" => "2.120900";
};
on 'configure' => sub {
@@ -33,6 +36,14 @@ on 'configure' => sub {
};
on 'develop' => sub {
+ requires "Dist::Zilla" => "5.012";
+ requires "Dist::Zilla::Plugin::AppendExternalData" => "0";
+ requires "Dist::Zilla::PluginBundle::DAGOLDEN" => "0.053";
+ requires "File::Spec" => "0";
+ requires "File::Temp" => "0";
+ requires "IO::Handle" => "0";
+ requires "IPC::Open3" => "0";
requires "Test::CPAN::Meta" => "0";
+ requires "Test::More" => "0";
requires "Test::Pod" => "1.41";
};
@@ -4,7 +4,7 @@ use warnings;
package PIR;
# ABSTRACT: Short alias for Path::Iterator::Rule
-our $VERSION = '1.006'; # VERSION
+our $VERSION = '1.008'; # VERSION
# Dependencies
use Path::Iterator::Rule;
@@ -19,7 +19,7 @@ __END__
=pod
-=encoding utf-8
+=encoding UTF-8
=head1 NAME
@@ -27,7 +27,7 @@ PIR - Short alias for Path::Iterator::Rule
=head1 VERSION
-version 1.006
+version 1.008
=head1 SYNOPSIS
@@ -38,7 +38,7 @@ version 1.006
# iterator interface
my $next = $rule->iter( @dirs );
- while ( my $file = $next->() ) {
+ while ( defined( my $file = $next->() ) ) {
...
}
@@ -54,8 +54,6 @@ the full name repeatedly, which is particularly handy for one-liners:
$ perl -MPIR -wE 'say for PIR->new->skip_dirs(".")->perl_module->all(@INC)'
-=for Pod::Coverage method_names_here
-
=head1 USAGE
=head2 Constructors
@@ -82,7 +80,7 @@ rule objects against a common base.
=head3 C<iter>
my $next = $rule->iter( @dirs, \%options);
- while ( my $file = $next->() ) {
+ while ( defined( my $file = $next->() ) ) {
...
}
@@ -157,6 +155,8 @@ subdirectories like C<@INC> or symbolic links), files found could be returned
relative to different initial search directories based on C<depthfirst>,
C<follow_symlinks> or C<loop_safe>.
+When the iterator is exhausted, it will return undef.
+
=head3 C<iter_fast>
This works just like C<iter>, except that it optimizes for speed over
@@ -171,6 +171,8 @@ Returns a list of paths that match the rule. It takes the same arguments and
has the same behaviors as the C<iter> method. The C<all> method uses C<iter>
internally to fetch all results.
+In scalar context, it will return the count of matched paths.
+
In void context, it is optimized to iterate over everything, but not store
results. This is most useful with the C<visitor> option:
@@ -241,6 +243,8 @@ the object to allow method chaining.
This method should be called as early as possible in the rule chain.
See L</skip_dirs> below for further explanation and an example.
+=for Pod::Coverage method_names_here
+
=head1 RULE METHODS
Rule methods are helpers that add constraints. Internally, they generate a
@@ -396,6 +400,7 @@ of Perl distribution files.
$rule->skip_git;
$rule->skip_bzr;
$rule->skip_hg;
+ $rule->skip_darcs;
Skips files and/or prunes directories related to a version control system.
Just like C<skip_dirs>, these rules should be specified early to get the
@@ -569,7 +574,7 @@ if the filename is "foo":
foo => sub {
my @args = @_; # do this to customize closure with arguments
return sub {
- my ($item, $basename) = shift;
+ my ($item, $basename) = @_;
return if -d "$item";
return $basename =~ /^foo$/;
}
@@ -4,7 +4,7 @@ use warnings;
package Path::Iterator::Rule;
# ABSTRACT: Iterative, recursive file finder
-our $VERSION = '1.006'; # VERSION
+our $VERSION = '1.008'; # VERSION
# Register warnings category
use warnings::register;
@@ -286,15 +286,20 @@ sub all_fast {
sub _all {
my $self = shift;
my $iter = shift;
- if ( defined wantarray ) {
+ if (wantarray) {
my @results;
- while ( my $item = $iter->() ) {
+ while ( defined( my $item = $iter->() ) ) {
push @results, $item;
}
return @results;
}
+ elsif ( defined wantarray ) {
+ my $count = 0;
+ $count++ while defined $iter->();
+ return $count;
+ }
else {
- 1 while $iter->();
+ 1 while defined $iter->();
}
}
@@ -655,8 +660,11 @@ my %vcs_rules = (
skip_hg => sub {
return Path::Iterator::Rule->new->skip_dirs('.hg');
},
+ skip_darcs => sub {
+ return Path::Iterator::Rule->new->skip_dirs('_darcs');
+ },
skip_vcs => sub {
- return Path::Iterator::Rule->new->skip_dirs(qw/.git .bzr .hg CVS RCS/)
+ return Path::Iterator::Rule->new->skip_dirs(qw/.git .bzr .hg _darcs CVS RCS/)
->skip_svn->not_name( qr/\.\#$/, qr/,v$/ );
},
);
@@ -701,7 +709,7 @@ __END__
=pod
-=encoding utf-8
+=encoding UTF-8
=head1 NAME
@@ -709,7 +717,7 @@ Path::Iterator::Rule - Iterative, recursive file finder
=head1 VERSION
-version 1.006
+version 1.008
=head1 SYNOPSIS
@@ -720,7 +728,7 @@ version 1.006
# iterator interface
my $next = $rule->iter( @dirs );
- while ( my $file = $next->() ) {
+ while ( defined( my $file = $next->() ) ) {
...
}
@@ -806,7 +814,7 @@ rule objects against a common base.
=head3 C<iter>
my $next = $rule->iter( @dirs, \%options);
- while ( my $file = $next->() ) {
+ while ( defined( my $file = $next->() ) ) {
...
}
@@ -881,6 +889,8 @@ subdirectories like C<@INC> or symbolic links), files found could be returned
relative to different initial search directories based on C<depthfirst>,
C<follow_symlinks> or C<loop_safe>.
+When the iterator is exhausted, it will return undef.
+
=head3 C<iter_fast>
This works just like C<iter>, except that it optimizes for speed over
@@ -895,6 +905,8 @@ Returns a list of paths that match the rule. It takes the same arguments and
has the same behaviors as the C<iter> method. The C<all> method uses C<iter>
internally to fetch all results.
+In scalar context, it will return the count of matched paths.
+
In void context, it is optimized to iterate over everything, but not store
results. This is most useful with the C<visitor> option:
@@ -1120,6 +1132,7 @@ of Perl distribution files.
$rule->skip_git;
$rule->skip_bzr;
$rule->skip_hg;
+ $rule->skip_darcs;
Skips files and/or prunes directories related to a version control system.
Just like C<skip_dirs>, these rules should be specified early to get the
@@ -1293,7 +1306,7 @@ if the filename is "foo":
foo => sub {
my @args = @_; # do this to customize closure with arguments
return sub {
- my ($item, $basename) = shift;
+ my ($item, $basename) = @_;
return if -d "$item";
return $basename =~ /^foo$/;
}
@@ -1530,10 +1543,18 @@ David Steinbrunner <dsteinbrunner@pobox.com>
=item *
+Gian Piero Carrubba <gpiero@butterfly.fdc.rm-rf.it>
+
+=item *
+
Graham Knop <haarg@cpan.org>
=item *
+Ricardo Signes <rjbs@cpan.org>
+
+=item *
+
Toby Inkster <tobyink@cpan.org>
=back
@@ -1,50 +0,0 @@
-use strict;
-use warnings;
-
-# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.033
-
-use Test::More tests => 2 + ($ENV{AUTHOR_TESTING} ? 1 : 0);
-
-
-
-my @module_files = (
- 'PIR.pm',
- 'Path/Iterator/Rule.pm'
-);
-
-
-
-# fake home for cpan-testers
-use File::Temp;
-local $ENV{HOME} = File::Temp::tempdir( CLEANUP => 1 );
-
-
-use File::Spec;
-use IPC::Open3;
-use IO::Handle;
-
-my @warnings;
-for my $lib (@module_files)
-{
- # see L<perlfaq8/How can I capture STDERR from an external command?>
- open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!";
- my $stderr = IO::Handle->new;
-
- my $pid = open3($stdin, '>&STDERR', $stderr, $^X, '-Mblib', '-e', "require q[$lib]");
- binmode $stderr, ':crlf' if $^O eq 'MSWin32';
- my @_warnings = <$stderr>;
- waitpid($pid, 0);
- is($? >> 8, 0, "$lib loaded ok");
-
- if (@_warnings)
- {
- warn @_warnings;
- push @warnings, @_warnings;
- }
-}
-
-
-
-is(scalar(@warnings), 0, 'no warnings found') if $ENV{AUTHOR_TESTING};
-
-
@@ -3,54 +3,137 @@
use strict;
use warnings;
+# This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs 0.013
+
use Test::More tests => 1;
use ExtUtils::MakeMaker;
use File::Spec::Functions;
use List::Util qw/max/;
+use version;
+
+# hide optional CPAN::Meta modules from prereq scanner
+# and check if they are available
+my $cpan_meta = "CPAN::Meta";
+my $cpan_meta_req = "CPAN::Meta::Requirements";
+my $HAS_CPAN_META = eval "require $cpan_meta"; ## no critic
+my $HAS_CPAN_META_REQ = eval "require $cpan_meta_req; $cpan_meta_req->VERSION('2.120900')";
+
+# Verify requirements?
+my $DO_VERIFY_PREREQS = 1;
+
+sub _merge_requires {
+ my ($collector, $prereqs) = @_;
+ for my $phase ( qw/configure build test runtime develop/ ) {
+ next unless exists $prereqs->{$phase};
+ if ( my $req = $prereqs->{$phase}{'requires'} ) {
+ my $cmr = CPAN::Meta::Requirements->from_string_hash( $req );
+ $collector->add_requirements( $cmr );
+ }
+ }
+}
+
+my %include = map {; $_ => 1 } qw(
-my @modules = qw(
- Carp
- Exporter
- ExtUtils::MakeMaker
- File::Basename
- File::Spec
- File::Spec::Functions
- File::Temp
- File::pushd
- IO::Handle
- IPC::Open3
- List::Util
- Number::Compare
- Path::Tiny
- Scalar::Util
- Test::Deep
- Test::Filename
- Test::More
- Text::Glob
- Try::Tiny
- lib
- perl
- re
- strict
- warnings
- warnings::register
);
-# replace modules with dynamic results from MYMETA.json if we can
-# (hide CPAN::Meta from prereq scanner)
-my $cpan_meta = "CPAN::Meta";
-if ( -f "MYMETA.json" && eval "require $cpan_meta" ) { ## no critic
- if ( my $meta = eval { CPAN::Meta->load_file("MYMETA.json") } ) {
- my $prereqs = $meta->prereqs;
- delete $prereqs->{develop};
- my %uniq = map {$_ => 1} map { keys %$_ } map { values %$_ } values %$prereqs;
- $uniq{$_} = 1 for @modules; # don't lose any static ones
- @modules = sort keys %uniq;
+my %exclude = map {; $_ => 1 } qw(
+
+);
+
+# Add static prereqs to the included modules list
+my $static_prereqs = do { my $x = {
+ 'configure' => {
+ 'requires' => {
+ 'ExtUtils::MakeMaker' => '6.17'
+ }
+ },
+ 'develop' => {
+ 'requires' => {
+ 'Dist::Zilla' => '5.012',
+ 'Dist::Zilla::Plugin::AppendExternalData' => '0',
+ 'Dist::Zilla::PluginBundle::DAGOLDEN' => '0.053',
+ 'File::Spec' => '0',
+ 'File::Temp' => '0',
+ 'IO::Handle' => '0',
+ 'IPC::Open3' => '0',
+ 'Test::CPAN::Meta' => '0',
+ 'Test::More' => '0',
+ 'Test::Pod' => '1.41'
+ }
+ },
+ 'runtime' => {
+ 'requires' => {
+ 'Carp' => '0',
+ 'File::Basename' => '0',
+ 'File::Spec' => '0',
+ 'List::Util' => '0',
+ 'Number::Compare' => '0.02',
+ 'Scalar::Util' => '0',
+ 'Text::Glob' => '0',
+ 'Try::Tiny' => '0',
+ 'perl' => '5.010',
+ 're' => '0',
+ 'strict' => '0',
+ 'warnings' => '0',
+ 'warnings::register' => '0'
+ }
+ },
+ 'test' => {
+ 'recommends' => {
+ 'CPAN::Meta' => '0',
+ 'CPAN::Meta::Requirements' => '2.120900'
+ },
+ 'requires' => {
+ 'Exporter' => '0',
+ 'ExtUtils::MakeMaker' => '0',
+ 'File::Spec::Functions' => '0',
+ 'File::Temp' => '0',
+ 'File::pushd' => '0',
+ 'Path::Tiny' => '0',
+ 'Test::Deep' => '0',
+ 'Test::Filename' => '0.03',
+ 'Test::More' => '0.92',
+ 'lib' => '0',
+ 'version' => '0'
+ }
+ }
+ };
+ $x;
+ };
+
+delete $static_prereqs->{develop} if not $ENV{AUTHOR_TESTING};
+$include{$_} = 1 for map { keys %$_ } map { values %$_ } values %$static_prereqs;
+
+# Merge requirements for major phases (if we can)
+my $all_requires;
+if ( $DO_VERIFY_PREREQS && $HAS_CPAN_META_REQ ) {
+ $all_requires = $cpan_meta_req->new;
+ _merge_requires($all_requires, $static_prereqs);
+}
+
+
+# Add dynamic prereqs to the included modules list (if we can)
+my ($source) = grep { -f } 'MYMETA.json', 'MYMETA.yml';
+if ( $source && $HAS_CPAN_META ) {
+ if ( my $meta = eval { CPAN::Meta->load_file($source) } ) {
+ my $dynamic_prereqs = $meta->prereqs;
+ delete $dynamic_prereqs->{develop} if not $ENV{AUTHOR_TESTING};
+ $include{$_} = 1 for map { keys %$_ } map { values %$_ } values %$dynamic_prereqs;
+
+ if ( $DO_VERIFY_PREREQS && $HAS_CPAN_META_REQ ) {
+ _merge_requires($all_requires, $dynamic_prereqs);
+ }
}
}
+else {
+ $source = 'static metadata';
+}
+my @modules = sort grep { ! $exclude{$_} } keys %include;
my @reports = [qw/Version Module/];
+my @dep_errors;
+my $req_hash = defined($all_requires) ? $all_requires->as_string_hash : {};
for my $mod ( @modules ) {
next if $mod eq 'perl';
@@ -62,9 +145,29 @@ for my $mod ( @modules ) {
my $ver = MM->parse_version( catfile($prefix, $file) );
$ver = "undef" unless defined $ver; # Newer MM should do this anyway
push @reports, [$ver, $mod];
+
+ if ( $DO_VERIFY_PREREQS && $all_requires ) {
+ my $req = $req_hash->{$mod};
+ if ( defined $req && length $req ) {
+ if ( ! defined eval { version->parse($ver) } ) {
+ push @dep_errors, "$mod version '$ver' cannot be parsed (version '$req' required)";
+ }
+ elsif ( ! $all_requires->accepts_module( $mod => $ver ) ) {
+ push @dep_errors, "$mod version '$ver' is not in required range '$req'";
+ }
+ }
+ }
+
}
else {
push @reports, ["missing", $mod];
+
+ if ( $DO_VERIFY_PREREQS && $all_requires ) {
+ my $req = $req_hash->{$mod};
+ if ( defined $req && length $req ) {
+ push @dep_errors, "$mod is not installed (version '$req' required)";
+ }
+ }
}
}
@@ -72,9 +175,19 @@ if ( @reports ) {
my $vl = max map { length $_->[0] } @reports;
my $ml = max map { length $_->[1] } @reports;
splice @reports, 1, 0, ["-" x $vl, "-" x $ml];
- diag "Prerequisite Report:\n", map {sprintf(" %*s %*s\n",$vl,$_->[0],-$ml,$_->[1])} @reports;
+ diag "\nVersions for all modules listed in $source (including optional ones):\n",
+ map {sprintf(" %*s %*s\n",$vl,$_->[0],-$ml,$_->[1])} @reports;
+}
+
+if ( @dep_errors ) {
+ diag join("\n",
+ "\n*** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING ***\n",
+ "The following REQUIRED prerequisites were not satisfied:\n",
+ @dep_errors,
+ "\n"
+ );
}
pass;
-# vim: ts=2 sts=2 sw=2 et:
+# vim: ts=4 sts=4 sw=4 et:
@@ -39,8 +39,10 @@ require_ok('Path::Iterator::Rule');
@files = ();
@files = $rule->all($td);
+ my $count = $rule->all($td);
is( scalar @files, 3, "All files" ) or diag explain \@files;
+ is( $count, 3, "All files (scalar context)" ) or diag explain \@files;
$rule = Path::Iterator::Rule->new->dir;
@files = ();
@@ -19,6 +19,7 @@ my @tree = qw(
cccc/.bzr/foo
cccc/.git/foo
cccc/.hg/foo
+ cccc/_darcs/foo
cccc/CVS/foo
cccc/RCS/foo
);
@@ -0,0 +1,54 @@
+use 5.006;
+use strict;
+use warnings;
+
+# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.039
+
+use Test::More tests => 2 + ($ENV{AUTHOR_TESTING} ? 1 : 0);
+
+
+
+my @module_files = (
+ 'PIR.pm',
+ 'Path/Iterator/Rule.pm'
+);
+
+
+
+# fake home for cpan-testers
+use File::Temp;
+local $ENV{HOME} = File::Temp::tempdir( CLEANUP => 1 );
+
+
+my $inc_switch = -d 'blib' ? '-Mblib' : '-Ilib';
+
+use File::Spec;
+use IPC::Open3;
+use IO::Handle;
+
+open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!";
+
+my @warnings;
+for my $lib (@module_files)
+{
+ # see L<perlfaq8/How can I capture STDERR from an external command?>
+ my $stderr = IO::Handle->new;
+
+ my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, '-e', "require q[$lib]");
+ binmode $stderr, ':crlf' if $^O eq 'MSWin32';
+ my @_warnings = <$stderr>;
+ waitpid($pid, 0);
+ is($?, 0, "$lib loaded ok");
+
+ if (@_warnings)
+ {
+ warn @_warnings;
+ push @warnings, @_warnings;
+ }
+}
+
+
+
+is(scalar(@warnings), 0, 'no warnings found') if $ENV{AUTHOR_TESTING};
+
+
@@ -2,7 +2,7 @@ use strict;
use warnings;
use Test::More;
-# generated by Dist::Zilla::Plugin::Test::PodSpelling 2.006001
+# generated by Dist::Zilla::Plugin::Test::PodSpelling 2.006002
use Test::Spelling 0.12;
use Pod::Wordlist;
@@ -21,14 +21,19 @@ Golden
dagolden
Steinbrunner
dsteinbrunner
+Gian
+Piero
+Carrubba
+gpiero
Graham
Knop
haarg
+Ricardo
Toby
Inkster
tobyink
lib
-PIR
Path
Iterator
Rule
+PIR
@@ -1,4 +1,5 @@
#!perl
+# This file was automatically generated by Dist::Zilla::Plugin::MetaTests.
use Test::More;
@@ -1,4 +1,5 @@
#!perl
+# This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests.
use Test::More;
eval "use Test::Pod 1.41";