Dist-Zilla-Plugin-Test-ReportPrereqs-0.029/0000775000175000017500000000000014356565371016633 5ustar xdgxdgDist-Zilla-Plugin-Test-ReportPrereqs-0.029/tidyall.ini0000644000175000017500000000024014356565371020770 0ustar xdgxdg; Install Code::TidyAll ; run "tidyall -a" to tidy all files ; run "tidyall -g" to tidy only files modified from git [PerlTidy] select = {lib,t}/**/*.{pl,pm,t} Dist-Zilla-Plugin-Test-ReportPrereqs-0.029/dist.ini0000644000175000017500000000033114356565371020272 0ustar xdgxdgname = Dist-Zilla-Plugin-Test-ReportPrereqs author = David Golden license = Apache_2_0 copyright_holder = David Golden copyright_year = 2012 [@DAGOLDEN] :version = 0.072 no_minimum_perl = 1 Dist-Zilla-Plugin-Test-ReportPrereqs-0.029/cpanfile0000644000175000017500000000355014356565371020340 0ustar xdgxdg# This file is generated by Dist::Zilla::Plugin::CPANFile v6.029 # Do not edit this file directly. To change prereqs, edit the `dist.ini` file. requires "Data::Dumper" => "0"; requires "Data::Section" => "0.200002"; requires "Dist::Zilla" => "4"; requires "Dist::Zilla::File::FromCode" => "0"; requires "Dist::Zilla::File::InMemory" => "0"; requires "Dist::Zilla::Role::FileGatherer" => "0"; requires "Dist::Zilla::Role::PrereqSource" => "0"; requires "Moose" => "0"; requires "Moose::Util::TypeConstraints" => "0"; requires "Sub::Exporter::ForMethods" => "0"; requires "perl" => "5.020"; requires "warnings" => "0"; on 'test' => sub { requires "CPAN::Meta" => "0"; requires "Capture::Tiny" => "0"; requires "Dist::Zilla::Tester" => "0"; requires "ExtUtils::MakeMaker" => "0"; requires "File::Spec" => "0"; requires "File::pushd" => "0"; requires "Path::Tiny" => "0"; requires "Test::Harness" => "0"; requires "Test::More" => "0.96"; requires "perl" => "5.020"; requires "strict" => "0"; }; on 'test' => sub { recommends "CPAN::Meta" => "2.120900"; }; on 'configure' => sub { requires "ExtUtils::MakeMaker" => "6.17"; requires "perl" => "5.020"; }; on 'develop' => sub { requires "Dist::Zilla" => "5"; requires "Dist::Zilla::PluginBundle::DAGOLDEN" => "0.072"; requires "File::Spec" => "0"; requires "File::Temp" => "0"; requires "IO::Handle" => "0"; requires "IPC::Open3" => "0"; requires "Pod::Coverage::TrustPod" => "0"; requires "Pod::Wordlist" => "0"; requires "Software::License::Apache_2_0" => "0"; requires "Test::CPAN::Meta" => "0"; requires "Test::More" => "0"; requires "Test::Perl::Critic" => "0"; requires "Test::Pod" => "1.41"; requires "Test::Pod::Coverage" => "1.08"; requires "Test::Portability::Files" => "0"; requires "Test::Spelling" => "0.12"; requires "Test::Version" => "1"; requires "strict" => "0"; }; Dist-Zilla-Plugin-Test-ReportPrereqs-0.029/Changes0000644000175000017500000001276514356565371020137 0ustar xdgxdgRevision history for Dist-Zilla-Plugin-Test-ReportPrereqs 0.029 2023-01-08 11:10:31-05:00 America/New_York [Changed] - Reports minimum Perl required. (rjbs) 0.028 2020-08-12 09:08:25-04:00 America/New_York [Changed] - Passed a test name in the call to `pass()` in the generated test file. This makes the output nicer when the test is run via Test2::Harness. (Dave Rolsky) 0.027 2017-05-07 22:59:43-04:00 America/New_York [Fixed] - fixed error in 0.026 that would cause t/00-report-prereqs.dd to be pruned by [PruneCruft] 0.026 2017-05-05 22:30:00-04:00 America/New_York [Fixed] - Prereq data file is properly sourced in newer perls, when . is no longer in @INC [Changed] - Improve diagnostics if loading metadata fails. 0.025 2016-06-09 22:08:35-04:00 America/New_York [Fixed] - Prereq source reported correctly if (MY)META fails to load. 0.024 2016-02-26 13:18:29-05:00 America/New_York [Changed] - Switched tests to use Path::Tiny over assuming dzil objects are Path::Class. 0.022 2016-02-25 17:15:30-05:00 America/New_York [Added] - Added option to use Module::Metadata for prereq version extraction 0.021 2015-03-24 23:38:55-04:00 America/New_York [Fixed] - fixed test corpus to avoid META validation errors 0.020 2015-01-27 09:59:52-05:00 America/New_York [Changed] - drop the Want column from the "Other Modules" section 0.019 2014-08-13 12:20:18-04:00 America/New_York [Changed] - Modules included in the dist.ini file are now put in their own report section "Other Modules" instead of being merged into Runtime Requires. 0.018 2014-08-01 12:22:01-04:00 America/New_York [Changed] - Removes List::Util and Scalar::Util as runtime dependencies for better backward compatibility; also fixes an unintialized value warning in the generated test file when CPAN::Meta isn't installed - Removes Path::Class and Cwd as a test dependencies - Adds CPAN::Meta as a test dependency (which shouldn't really matter since Dist::Zilla has it as a dependency anyway) 0.017 2014-07-30 16:48:36-04:00 America/New_York [Changed] - generated test file uses File::Spec instead of File::Spec::Functions 0.016 2014-07-29 14:07:49-04:00 America/New_York [Fixed] - Fixed how the version regular expression is used (whoops!) 0.015 2014-07-29 13:28:06-04:00 America/New_York [Changed] - removes dependency on version.pm and uses its regular expression instead. [Fixed] - generated test file no longer fatal if verifying prereqs without CPAN::Meta installed. 0.014 2014-07-17 18:09:03-04:00 America/New_York [Changed] - Test file generation split in two. The test file is gathered early and is available for analysis/munging by other plugins. The static dependency data is saved into another file late (after prereqs are finalized). The test file loads the static data at runtime. This should make this plugin validate with [VerifyPhases]. - Test report format now splits out report by phase and type. This means that "Test Requires" are distinct from "Runtime Requires" and if there are different versions required for each phase, those are visible in the report. 0.013 2014-01-24 11:42:12-05:00 America/New_York [Changed] - Embeds the complete static prerequisite hash into the generated file; no longer creates just a static list (that varied based on AUTHOR_TESTING); 0.012 2014-01-14 15:49:18-05:00 America/New_York [Changed] - Modifies the test file with the static prerequisite list in memory during the InstallTool phase rather only on disk in the AfterBuild phase (Kent Fredric) 0.011 2014-01-07 11:46:22 America/New_York [Fixed] - now also verifying develop prereqs, when AUTHOR_TESTING is set (Karen Etheridge) 0.010 2013-10-16 17:02:34 America/New_York [Fixed] - fixed handling of modules with no $VERSION 0.009 2013-10-15 19:48:32 America/New_York [Changed] - now injecting test-recommends prereqs to enable prereq verification (Karen Etheridge) 0.008 2013-10-13 15:33:03 America/New_York [Fixed] - dropped use of newer CPAN::Meta::Requirement method so we're more backwards compatible 0.007 2013-10-12 13:50:23 America/New_York [Fixed] - 'exclude' option now respected when MYMETA.json is present [Changed] - now (optionally) reporting on any missing prereqs after listing all module versions [Karen Etheridge] - develop prereqs are now also reported/checked when AUTHOR_TESTING 0.006 2013-02-12 17:48:57 America/New_York [Fixed] - Don't report on 'develop' prereqs 0.005 2013-02-11 12:26:51 America/New_York [Changed] - Always reports, regardless of AUTOMATED_TESTING; this way even manual bug reports will give us the information we want 0.004 2012-05-16 11:33:16 America/New_York [Added] - New 'include' and 'exclude' attributes may be used to add additional modules or to remove modules from the report list [Randy Stauner] 0.003 2012-05-14 15:23:08 America/New_York [Fixed] - Optional CPAN::Meta requirement of generated test file is now obscured to hide it from prerequisite scanners. - Static requirements are merged with dynamic ones to ensure the most complete report possible on modules of interest 0.002 2012-05-14 15:11:36 America/New_York [Changed] - Fixed formatting in generated test file 0.001 2012-05-14 14:51:15 America/New_York - Initial release Dist-Zilla-Plugin-Test-ReportPrereqs-0.029/CONTRIBUTING.mkdn0000644000175000017500000000660414356565371021421 0ustar xdgxdg## HOW TO CONTRIBUTE Thank you for considering contributing to this distribution. This file contains instructions that will help you work with the source code. The distribution is managed with Dist::Zilla. This means that many of the usual files you might expect are not in the repository, but are generated at release time, as is much of the documentation. Some generated files are kept in the repository as a convenience (e.g. Makefile.PL or cpanfile). Generally, **you do not need Dist::Zilla to contribute patches**. You do need Dist::Zilla to create a tarball. See below for guidance. ### Getting dependencies If you have App::cpanminus 1.6 or later installed, you can use `cpanm` to satisfy dependencies like this: $ cpanm --installdeps . Otherwise, look for either a `Makefile.PL` or `cpanfile` file for a list of dependencies to satisfy. ### Running tests You can run tests directly using the `prove` tool: $ prove -l $ prove -lv t/some_test_file.t For most of my distributions, `prove` is entirely sufficient for you to test any patches you have. I use `prove` for 99% of my testing during development. ### Code style and tidying Please try to match any existing coding style. If there is a `.perltidyrc` file, please install Perl::Tidy and use perltidy before submitting patches. If there is a `tidyall.ini` file, you can also install Code::TidyAll and run `tidyall` on a file or `tidyall -a` to tidy all files. ### Patching documentation Much of the documentation Pod is generated at release time. Some is generated boilerplate; other documentation is built from pseudo-POD directives in the source like C<=method> or C<=func>. If you would like to submit a documentation edit, please limit yourself to the documentation you see. If you see typos or documentation issues in the generated docs, please email or open a bug ticket instead of patching. ### Where to send patches and pull requests If you found this distribution on Github, sending a pull-request is the best way to contribute. If a pull-request isn't possible, a bug ticket with a patch file is the next best option. As a last resort, an email to the author(s) is acceptable. ## Installing and using Dist::Zilla Dist::Zilla is not required for contributing, but if you'd like to learn more, this section will get you up to speed. Dist::Zilla is a very powerful authoring tool, optimized for maintaining a large number of distributions with a high degree of automation, but it has a large dependency chain, a bit of a learning curve and requires a number of author-specific plugins. To install it from CPAN, I recommend one of the following approaches for the quickest installation: # using CPAN.pm, but bypassing non-functional pod tests $ cpan TAP::Harness::Restricted $ PERL_MM_USE_DEFAULT=1 HARNESS_CLASS=TAP::Harness::Restricted cpan Dist::Zilla # using cpanm, bypassing *all* tests $ cpanm -n Dist::Zilla In either case, it's probably going to take about 10 minutes. Go for a walk, go get a cup of your favorite beverage, take a bathroom break, or whatever. When you get back, Dist::Zilla should be ready for you. Then you need to install any plugins specific to this distribution: $ cpan `dzil authordeps` $ dzil authordeps | cpanm Once installed, here are some dzil commands you might try: $ dzil build $ dzil test $ dzil xtest You can learn more about Dist::Zilla at http://dzil.org/ Dist-Zilla-Plugin-Test-ReportPrereqs-0.029/META.yml0000644000175000017500000000366114356565371020110 0ustar xdgxdg--- abstract: 'Report on prerequisite versions during automated testing' author: - 'David Golden ' build_requires: CPAN::Meta: '0' Capture::Tiny: '0' Dist::Zilla::Tester: '0' ExtUtils::MakeMaker: '0' File::Spec: '0' File::pushd: '0' Path::Tiny: '0' Test::Harness: '0' Test::More: '0.96' perl: '5.020' strict: '0' configure_requires: ExtUtils::MakeMaker: '6.17' perl: '5.020' dynamic_config: 0 generated_by: 'Dist::Zilla version 6.029, CPAN::Meta::Converter version 2.150010' license: apache meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Dist-Zilla-Plugin-Test-ReportPrereqs no_index: directory: - corpus - examples - t - xt package: - DB provides: Dist::Zilla::Plugin::Test::ReportPrereqs: file: lib/Dist/Zilla/Plugin/Test/ReportPrereqs.pm version: '0.029' requires: Data::Dumper: '0' Data::Section: '0.200002' Dist::Zilla: '4' Dist::Zilla::File::FromCode: '0' Dist::Zilla::File::InMemory: '0' Dist::Zilla::Role::FileGatherer: '0' Dist::Zilla::Role::PrereqSource: '0' Moose: '0' Moose::Util::TypeConstraints: '0' Sub::Exporter::ForMethods: '0' perl: '5.020' warnings: '0' resources: bugtracker: https://github.com/dagolden/Dist-Zilla-Plugin-Test-ReportPrereqs/issues homepage: https://github.com/dagolden/Dist-Zilla-Plugin-Test-ReportPrereqs repository: https://github.com/dagolden/Dist-Zilla-Plugin-Test-ReportPrereqs.git version: '0.029' x_authority: cpan:DAGOLDEN x_contributors: - 'Brendan Byrd ' - 'Dave Rolsky ' - 'Karen Etheridge ' - 'Kent Fredric ' - 'Randy Stauner ' - 'Ricardo Signes ' - 'Yanick Champoux ' x_generated_by_perl: v5.36.0 x_serialization_backend: 'YAML::Tiny version 1.73' x_spdx_expression: Apache-2.0 Dist-Zilla-Plugin-Test-ReportPrereqs-0.029/lib/0000775000175000017500000000000014356565371017401 5ustar xdgxdgDist-Zilla-Plugin-Test-ReportPrereqs-0.029/lib/Dist/0000775000175000017500000000000014356565371020304 5ustar xdgxdgDist-Zilla-Plugin-Test-ReportPrereqs-0.029/lib/Dist/Zilla/0000775000175000017500000000000014356565371021357 5ustar xdgxdgDist-Zilla-Plugin-Test-ReportPrereqs-0.029/lib/Dist/Zilla/Plugin/0000775000175000017500000000000014356565371022615 5ustar xdgxdgDist-Zilla-Plugin-Test-ReportPrereqs-0.029/lib/Dist/Zilla/Plugin/Test/0000775000175000017500000000000014356565371023534 5ustar xdgxdgDist-Zilla-Plugin-Test-ReportPrereqs-0.029/lib/Dist/Zilla/Plugin/Test/ReportPrereqs.pm0000644000175000017500000004154614356565371026717 0ustar xdgxdguse 5.020; use warnings; package Dist::Zilla::Plugin::Test::ReportPrereqs; # ABSTRACT: Report on prerequisite versions during automated testing our $VERSION = '0.029'; use Dist::Zilla 4 (); use Moose; with 'Dist::Zilla::Role::FileGatherer', 'Dist::Zilla::Role::PrereqSource'; use Sub::Exporter::ForMethods; use Data::Section 0.200002 # encoding and bytes { installer => Sub::Exporter::ForMethods::method_installer }, '-setup'; use Data::Dumper; use Moose::Util::TypeConstraints 'enum'; sub mvp_multivalue_args { return qw( include exclude ); } foreach my $attr (qw( include exclude )) { has "${attr}s" => ( init_arg => $attr, is => 'ro', traits => ['Array'], default => sub { [] }, handles => { "${attr}d_modules" => 'elements', }, ); } has verify_prereqs => ( is => 'ro', isa => 'Bool', default => 1, ); has version_extractor => ( is => 'ro', isa => enum( [qw(ExtUtils::MakeMaker Module::Metadata)] ), default => 'ExtUtils::MakeMaker', ); sub register_prereqs { my $self = shift; $self->zilla->register_prereqs( { phase => 'test', type => 'requires', }, 'Test::More' => 0, $self->version_extractor => 0, 'File::Spec' => 0, ); $self->zilla->register_prereqs( { phase => 'test', type => 'recommends', }, 'CPAN::Meta' => '2.120900', ); } sub gather_files { my $self = shift; my $data = $self->merged_section_data; return unless $data and %$data; require Dist::Zilla::File::InMemory; for my $filename ( keys %$data ) { $self->add_file( Dist::Zilla::File::InMemory->new( { name => $filename, content => $self->_munge_test( ${ $data->{$filename} } ), } ) ); } require Dist::Zilla::File::FromCode; $self->add_file( Dist::Zilla::File::FromCode->new( { name => $self->_dump_filename, code => sub { $self->_dump_prereqs }, } ) ); return; } sub _munge_test { my ( $self, $guts ) = @_; $guts =~ s{INSERT_VERSION_HERE}{$self->VERSION || ''}e; $guts =~ s{INSERT_DD_FILENAME_HERE}{'./' . $self->_dump_filename}e; $guts =~ s{INSERT_INCLUDED_MODULES_HERE}{_format_list($self->included_modules)}e; $guts =~ s{INSERT_EXCLUDED_MODULES_HERE}{_format_list($self->excluded_modules)}e; $guts =~ s{INSERT_VERIFY_PREREQS_CONFIG}{$self->verify_prereqs ? 1 : 0}e; $guts =~ s{VERSION_EXTRACTOR_MODULE}{$self->version_extractor}e; if ( $self->version_extractor eq 'ExtUtils::MakeMaker' ) { $guts =~ s'VERSION_EXTRACTION'MM->parse_version( File::Spec->catfile($prefix, $file) )'; } else { # Module::Metadata $guts =~ s'VERSION_EXTRACTION'Module::Metadata->new_from_file( File::Spec->catfile($prefix, $file) )->version'; } return $guts; } sub _dump_filename { 't/00-report-prereqs.dd' } sub _format_list { return join( "\n", map { " $_" } @_ ); } sub _dump_prereqs { my $self = shift; my $prereqs = $self->zilla->prereqs->as_string_hash; return ("do { my " . Data::Dumper->new( [$prereqs], ['x'] )->Purity(1)->Sortkeys(1)->Terse(0)->Dump() . ' $x;' . "\n }" ); } __PACKAGE__->meta->make_immutable; 1; #pod =for Pod::Coverage #pod gather_files #pod mvp_multivalue_args #pod register_prereqs #pod #pod =head1 SYNOPSIS #pod #pod # in dist.ini #pod [Test::ReportPrereqs] #pod include = Acme::FYI #pod exclude = Acme::Dont::Care #pod #pod =head1 DESCRIPTION #pod #pod This L plugin adds a F test file and an accompanying #pod F data file. It reports #pod the version of all modules listed in the distribution metadata prerequisites #pod (including 'recommends', 'suggests', etc.). However, any 'develop' prereqs #pod are not reported (unless they show up in another category). #pod #pod If a F file exists and L is installed on the testing #pod machine, F will be examined for prerequisites in addition, as it #pod would include any dynamic prerequisites not set in the distribution metadata. #pod #pod Versions are reported based on the result of C from #pod L, which means prerequisite modules are not actually #pod loaded (which avoids various edge cases with certain modules). Parse errors are #pod reported as "undef". If a module is not installed, "missing" is reported #pod instead of a version string. #pod #pod Additionally, if L is installed, unfulfilled required prerequisites #pod are reported after the list of all versions based on either F #pod (preferably) or F (fallback). #pod #pod =head1 CONFIGURATION #pod #pod =head2 include #pod #pod An C attribute can be specified (multiple times) to add modules #pod to the report. This can be useful if there is a module in the dependency #pod chain that is problematic but is not directly required by this project. #pod These modules will be listed in an "Other Modules" section at the end of #pod the report. #pod #pod =head2 exclude #pod #pod An C attribute can be specified (multiple times) to remove #pod modules from the report (if you had a reason to do so). #pod #pod =head2 verify_prereqs #pod #pod When set, installed versions of all 'requires' prerequisites are verified #pod against those specified. Defaults to true, but requires CPAN::Meta to be installed. #pod #pod =head2 version_extractor #pod #pod Specifies the module to use to extract each installed prerequisite's #pod version. Defaults to L, which is recommended for most #pod situations. It can also be specified as L, which can be #pod useful if L's mechanism is too naive, or if #pod L is not already a prerequisite of the distribution. #pod #pod =head1 SEE ALSO #pod #pod Other Dist::Zilla::Plugins do similar things in slightly different ways that didn't #pod suit my style and needs. #pod #pod =for :list #pod * L -- requires prereqs to be satisfied #pod * L -- bundles a copy of YAML::Tiny, reads prereqs only from META.yml, and attempts to load them with C #pod * L -- static list only, loads modules with C #pod #pod =cut =pod =encoding UTF-8 =head1 NAME Dist::Zilla::Plugin::Test::ReportPrereqs - Report on prerequisite versions during automated testing =head1 VERSION version 0.029 =head1 SYNOPSIS # in dist.ini [Test::ReportPrereqs] include = Acme::FYI exclude = Acme::Dont::Care =head1 DESCRIPTION This L plugin adds a F test file and an accompanying F data file. It reports the version of all modules listed in the distribution metadata prerequisites (including 'recommends', 'suggests', etc.). However, any 'develop' prereqs are not reported (unless they show up in another category). If a F file exists and L is installed on the testing machine, F will be examined for prerequisites in addition, as it would include any dynamic prerequisites not set in the distribution metadata. Versions are reported based on the result of C from L, which means prerequisite modules are not actually loaded (which avoids various edge cases with certain modules). Parse errors are reported as "undef". If a module is not installed, "missing" is reported instead of a version string. Additionally, if L is installed, unfulfilled required prerequisites are reported after the list of all versions based on either F (preferably) or F (fallback). =for Pod::Coverage gather_files mvp_multivalue_args register_prereqs =head1 CONFIGURATION =head2 include An C attribute can be specified (multiple times) to add modules to the report. This can be useful if there is a module in the dependency chain that is problematic but is not directly required by this project. These modules will be listed in an "Other Modules" section at the end of the report. =head2 exclude An C attribute can be specified (multiple times) to remove modules from the report (if you had a reason to do so). =head2 verify_prereqs When set, installed versions of all 'requires' prerequisites are verified against those specified. Defaults to true, but requires CPAN::Meta to be installed. =head2 version_extractor Specifies the module to use to extract each installed prerequisite's version. Defaults to L, which is recommended for most situations. It can also be specified as L, which can be useful if L's mechanism is too naive, or if L is not already a prerequisite of the distribution. =head1 SEE ALSO Other Dist::Zilla::Plugins do similar things in slightly different ways that didn't suit my style and needs. =over 4 =item * L -- requires prereqs to be satisfied =item * L -- bundles a copy of YAML::Tiny, reads prereqs only from META.yml, and attempts to load them with C =item * L -- static list only, loads modules with C =back =for :stopwords cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan =head1 SUPPORT =head2 Bugs / Feature Requests Please report any bugs or feature requests through the issue tracker at L. You will be notified automatically of any progress on your issue. =head2 Source Code This is open source software. The code repository is available for public review and contribution under the terms of the license. L git clone https://github.com/dagolden/Dist-Zilla-Plugin-Test-ReportPrereqs.git =head1 AUTHOR David Golden =head1 CONTRIBUTORS =for stopwords Brendan Byrd Dave Rolsky Karen Etheridge Kent Fredric Randy Stauner Ricardo Signes Yanick Champoux =over 4 =item * Brendan Byrd =item * Dave Rolsky =item * Karen Etheridge =item * Kent Fredric =item * Randy Stauner =item * Ricardo Signes =item * Yanick Champoux =back =head1 COPYRIGHT AND LICENSE This software is Copyright (c) 2012 by David Golden. This is free software, licensed under: The Apache License, Version 2.0, January 2004 =cut __DATA__ ___[ t/00-report-prereqs.t ]___ #!perl use strict; use warnings; # This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs INSERT_VERSION_HERE use Test::More tests => 1; use VERSION_EXTRACTOR_MODULE; use File::Spec; # from $version::LAX my $lax_version_re = qr/(?: undef | (?: (?:[0-9]+) (?: \. | (?:\.[0-9]+) (?:_[0-9]+)? )? | (?:\.[0-9]+) (?:_[0-9]+)? ) | (?: v (?:[0-9]+) (?: (?:\.[0-9]+)+ (?:_[0-9]+)? )? | (?:[0-9]+)? (?:\.[0-9]+){2,} (?:_[0-9]+)? ) )/x; # hide optional CPAN::Meta modules from prereq scanner # and check if they are available my $cpan_meta = "CPAN::Meta"; my $cpan_meta_pre = "CPAN::Meta::Prereqs"; my $HAS_CPAN_META = eval "require $cpan_meta; $cpan_meta->VERSION('2.120900')" && eval "require $cpan_meta_pre"; ## no critic # Verify requirements? my $DO_VERIFY_PREREQS = INSERT_VERIFY_PREREQS_CONFIG; sub _max { my $max = shift; $max = ( $_ > $max ) ? $_ : $max for @_; return $max; } sub _merge_prereqs { my ($collector, $prereqs) = @_; # CPAN::Meta::Prereqs object if (ref $collector eq $cpan_meta_pre) { return $collector->with_merged_prereqs( CPAN::Meta::Prereqs->new( $prereqs ) ); } # Raw hashrefs for my $phase ( keys %$prereqs ) { for my $type ( keys %{ $prereqs->{$phase} } ) { for my $module ( keys %{ $prereqs->{$phase}{$type} } ) { $collector->{$phase}{$type}{$module} = $prereqs->{$phase}{$type}{$module}; } } } return $collector; } my @include = qw( INSERT_INCLUDED_MODULES_HERE ); my @exclude = qw( INSERT_EXCLUDED_MODULES_HERE ); # Add static prereqs to the included modules list my $static_prereqs = do 'INSERT_DD_FILENAME_HERE'; # Merge all prereqs (either with ::Prereqs or a hashref) my $full_prereqs = _merge_prereqs( ( $HAS_CPAN_META ? $cpan_meta_pre->new : {} ), $static_prereqs ); # Add dynamic prereqs to the included modules list (if we can) my ($source) = grep { -f } 'MYMETA.json', 'MYMETA.yml'; my $cpan_meta_error; if ( $source && $HAS_CPAN_META && (my $meta = eval { CPAN::Meta->load_file($source) } ) ) { $full_prereqs = _merge_prereqs($full_prereqs, $meta->prereqs); } else { $cpan_meta_error = $@; # capture error from CPAN::Meta->load_file($source) $source = 'static metadata'; } my @full_reports; my @dep_errors; my $req_hash = $HAS_CPAN_META ? $full_prereqs->as_string_hash : $full_prereqs; # Add static includes into a fake section for my $mod (@include) { $req_hash->{other}{modules}{$mod} = 0; } for my $phase ( qw(configure build test runtime develop other) ) { next unless $req_hash->{$phase}; next if ($phase eq 'develop' and not $ENV{AUTHOR_TESTING}); for my $type ( qw(requires recommends suggests conflicts modules) ) { next unless $req_hash->{$phase}{$type}; my $title = ucfirst($phase).' '.ucfirst($type); my @reports = [qw/Module Want Have/]; for my $mod ( sort keys %{ $req_hash->{$phase}{$type} } ) { next if grep { $_ eq $mod } @exclude; my $want = $req_hash->{$phase}{$type}{$mod}; $want = "undef" unless defined $want; $want = "any" if !$want && $want == 0; if ($mod eq 'perl') { push @reports, ['perl', $want, $]]; next; } my $req_string = $want eq 'any' ? 'any version required' : "version '$want' required"; my $file = $mod; $file =~ s{::}{/}g; $file .= ".pm"; my ($prefix) = grep { -e File::Spec->catfile($_, $file) } @INC; if ($prefix) { my $have = VERSION_EXTRACTION; $have = "undef" unless defined $have; push @reports, [$mod, $want, $have]; if ( $DO_VERIFY_PREREQS && $HAS_CPAN_META && $type eq 'requires' ) { if ( $have !~ /\A$lax_version_re\z/ ) { push @dep_errors, "$mod version '$have' cannot be parsed ($req_string)"; } elsif ( ! $full_prereqs->requirements_for( $phase, $type )->accepts_module( $mod => $have ) ) { push @dep_errors, "$mod version '$have' is not in required range '$want'"; } } } else { push @reports, [$mod, $want, "missing"]; if ( $DO_VERIFY_PREREQS && $type eq 'requires' ) { push @dep_errors, "$mod is not installed ($req_string)"; } } } if ( @reports ) { push @full_reports, "=== $title ===\n\n"; my $ml = _max( map { length $_->[0] } @reports ); my $wl = _max( map { length $_->[1] } @reports ); my $hl = _max( map { length $_->[2] } @reports ); if ($type eq 'modules') { splice @reports, 1, 0, ["-" x $ml, "", "-" x $hl]; push @full_reports, map { sprintf(" %*s %*s\n", -$ml, $_->[0], $hl, $_->[2]) } @reports; } else { splice @reports, 1, 0, ["-" x $ml, "-" x $wl, "-" x $hl]; push @full_reports, map { sprintf(" %*s %*s %*s\n", -$ml, $_->[0], $wl, $_->[1], $hl, $_->[2]) } @reports; } push @full_reports, "\n"; } } } if ( @full_reports ) { diag "\nVersions for all modules listed in $source (including optional ones):\n\n", @full_reports; } if ( $cpan_meta_error || @dep_errors ) { diag "\n*** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING ***\n"; } if ( $cpan_meta_error ) { my ($orig_source) = grep { -f } 'MYMETA.json', 'MYMETA.yml'; diag "\nCPAN::Meta->load_file('$orig_source') failed with: $cpan_meta_error\n"; } if ( @dep_errors ) { diag join("\n", "\nThe following REQUIRED prerequisites were not satisfied:\n", @dep_errors, "\n" ); } pass('Reported prereqs'); # vim: ts=4 sts=4 sw=4 et: Dist-Zilla-Plugin-Test-ReportPrereqs-0.029/LICENSE0000644000175000017500000002633514356565371017647 0ustar xdgxdgThis software is Copyright (c) 2012 by David Golden. This is free software, licensed under: The Apache License, Version 2.0, January 2004 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright 2012 David Golden Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Dist-Zilla-Plugin-Test-ReportPrereqs-0.029/perlcritic.rc0000644000175000017500000000116614356565371021323 0ustar xdgxdgseverity = 5 verbose = 8 [Variables::ProhibitPunctuationVars] allow = $@ $! [TestingAndDebugging::ProhibitNoStrict] allow = refs [Variables::ProhibitEvilVariables] variables = $DB::single # Turn these off [-BuiltinFunctions::ProhibitStringyEval] [-ControlStructures::ProhibitPostfixControls] [-ControlStructures::ProhibitUnlessBlocks] [-Documentation::RequirePodSections] [-InputOutput::ProhibitInteractiveTest] [-References::ProhibitDoubleSigils] [-RegularExpressions::RequireExtendedFormatting] [-InputOutput::ProhibitTwoArgOpen] [-Modules::ProhibitEvilModules] # Turn this on [Lax::ProhibitStringyEval::ExceptForRequire] Dist-Zilla-Plugin-Test-ReportPrereqs-0.029/corpus/0000775000175000017500000000000014356565371020146 5ustar xdgxdgDist-Zilla-Plugin-Test-ReportPrereqs-0.029/corpus/DZ/0000775000175000017500000000000014356565371020463 5ustar xdgxdgDist-Zilla-Plugin-Test-ReportPrereqs-0.029/corpus/DZ/dist.ini0000644000175000017500000000111514356565371022123 0ustar xdgxdgname = Foo version = 1.23 author = foobar license = Perl_5 abstract = Test Library copyright_holder = foobar copyright_year = 2009 [GatherDir] [MakeMaker] [AutoPrereqs] [Prereqs / RuntimeRequires] Secretly::Used::Module = 0 Missing::Prereq = 0 [Prereqs / RuntimeRecommends] Foo::Bar::Baz::Not::On::CPAN = 0 [Prereqs / RuntimeSuggests] Tie::File = 0 [Prereqs / TestSuggests] Test::More = 0.96 [Test::ReportPrereqs] include = An::Extra::Module::That::Causes::Problems include = An::Extra::Module::That::Causes::More::Problems exclude = Secretly::Used::Module verify_prereqs = 1 Dist-Zilla-Plugin-Test-ReportPrereqs-0.029/corpus/DZ/Changes0000644000175000017500000000007314356565371021754 0ustar xdgxdgChanges 1.23 2009-11-16 19:15:45 CET - foo - bar - baz Dist-Zilla-Plugin-Test-ReportPrereqs-0.029/corpus/DZ/foobar0000644000175000017500000000004114356565371021647 0ustar xdgxdgthis file is meant for testing...Dist-Zilla-Plugin-Test-ReportPrereqs-0.029/corpus/DZ/lib/0000775000175000017500000000000014356565371021231 5ustar xdgxdgDist-Zilla-Plugin-Test-ReportPrereqs-0.029/corpus/DZ/lib/Foo.pm0000644000175000017500000000022314356565371022305 0ustar xdgxdgpackage Foo; use strict; use warnings; # ABSTRACT: Foo this thing use File::Spec; use File::Basename; 1; =head1 DESCRIPTION Foo the foo. =cut Dist-Zilla-Plugin-Test-ReportPrereqs-0.029/corpus/DZ/t/0000775000175000017500000000000014356565371020726 5ustar xdgxdgDist-Zilla-Plugin-Test-ReportPrereqs-0.029/corpus/DZ/t/foo.t0000644000175000017500000000045714356565371021702 0ustar xdgxdguse 5.006; use strict; use warnings; use Test::More tests => 1; use IO::File; pass; # # This file is part of Dist-Zilla-Plugin-Test-ReportPrereqs # # This software is Copyright (c) 2012 by David Golden. # # This is free software, licensed under: # # The Apache License, Version 2.0, January 2004 # Dist-Zilla-Plugin-Test-ReportPrereqs-0.029/README0000644000175000017500000001002314356565371017505 0ustar xdgxdgNAME Dist::Zilla::Plugin::Test::ReportPrereqs - Report on prerequisite versions during automated testing VERSION version 0.029 SYNOPSIS # in dist.ini [Test::ReportPrereqs] include = Acme::FYI exclude = Acme::Dont::Care DESCRIPTION This Dist::Zilla plugin adds a t/00-report-prereqs.t test file and an accompanying t/00-report-prereqs.dd data file. It reports the version of all modules listed in the distribution metadata prerequisites (including 'recommends', 'suggests', etc.). However, any 'develop' prereqs are not reported (unless they show up in another category). If a MYMETA.json file exists and CPAN::Meta is installed on the testing machine, MYMETA.json will be examined for prerequisites in addition, as it would include any dynamic prerequisites not set in the distribution metadata. Versions are reported based on the result of "parse_version" from ExtUtils::MakeMaker, which means prerequisite modules are not actually loaded (which avoids various edge cases with certain modules). Parse errors are reported as "undef". If a module is not installed, "missing" is reported instead of a version string. Additionally, if CPAN::Meta is installed, unfulfilled required prerequisites are reported after the list of all versions based on either MYMETA (preferably) or META (fallback). CONFIGURATION include An "include" attribute can be specified (multiple times) to add modules to the report. This can be useful if there is a module in the dependency chain that is problematic but is not directly required by this project. These modules will be listed in an "Other Modules" section at the end of the report. exclude An "exclude" attribute can be specified (multiple times) to remove modules from the report (if you had a reason to do so). verify_prereqs When set, installed versions of all 'requires' prerequisites are verified against those specified. Defaults to true, but requires CPAN::Meta to be installed. version_extractor Specifies the module to use to extract each installed prerequisite's version. Defaults to ExtUtils::MakeMaker, which is recommended for most situations. It can also be specified as Module::Metadata, which can be useful if ExtUtils::MakeMaker's mechanism is too naive, or if ExtUtils::MakeMaker is not already a prerequisite of the distribution. SEE ALSO Other Dist::Zilla::Plugins do similar things in slightly different ways that didn't suit my style and needs. * Dist::Zilla::Plugin::Test::PrereqsFromMeta -- requires prereqs to be satisfied * Dist::Zilla::Plugin::Test::ReportVersions -- bundles a copy of YAML::Tiny, reads prereqs only from META.yml, and attempts to load them with "require" * Dist::Zilla::Plugin::ReportVersions::Tiny -- static list only, loads modules with "require" SUPPORT Bugs / Feature Requests Please report any bugs or feature requests through the issue tracker at . You will be notified automatically of any progress on your issue. Source Code This is open source software. The code repository is available for public review and contribution under the terms of the license. git clone https://github.com/dagolden/Dist-Zilla-Plugin-Test-ReportPrereqs.git AUTHOR David Golden CONTRIBUTORS * Brendan Byrd * Dave Rolsky * Karen Etheridge * Kent Fredric * Randy Stauner * Ricardo Signes * Yanick Champoux COPYRIGHT AND LICENSE This software is Copyright (c) 2012 by David Golden. This is free software, licensed under: The Apache License, Version 2.0, January 2004 Dist-Zilla-Plugin-Test-ReportPrereqs-0.029/Makefile.PL0000644000175000017500000000430314356565371020603 0ustar xdgxdg# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.029. use strict; use warnings; use 5.020; use ExtUtils::MakeMaker 6.17; my %WriteMakefileArgs = ( "ABSTRACT" => "Report on prerequisite versions during automated testing", "AUTHOR" => "David Golden ", "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => "6.17" }, "DISTNAME" => "Dist-Zilla-Plugin-Test-ReportPrereqs", "LICENSE" => "apache", "MIN_PERL_VERSION" => "5.020", "NAME" => "Dist::Zilla::Plugin::Test::ReportPrereqs", "PREREQ_PM" => { "Data::Dumper" => 0, "Data::Section" => "0.200002", "Dist::Zilla" => 4, "Dist::Zilla::File::FromCode" => 0, "Dist::Zilla::File::InMemory" => 0, "Dist::Zilla::Role::FileGatherer" => 0, "Dist::Zilla::Role::PrereqSource" => 0, "Moose" => 0, "Moose::Util::TypeConstraints" => 0, "Sub::Exporter::ForMethods" => 0, "warnings" => 0 }, "TEST_REQUIRES" => { "CPAN::Meta" => 0, "Capture::Tiny" => 0, "Dist::Zilla::Tester" => 0, "ExtUtils::MakeMaker" => 0, "File::Spec" => 0, "File::pushd" => 0, "Path::Tiny" => 0, "Test::Harness" => 0, "Test::More" => "0.96", "strict" => 0 }, "VERSION" => "0.029", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "CPAN::Meta" => 0, "Capture::Tiny" => 0, "Data::Dumper" => 0, "Data::Section" => "0.200002", "Dist::Zilla" => 4, "Dist::Zilla::File::FromCode" => 0, "Dist::Zilla::File::InMemory" => 0, "Dist::Zilla::Role::FileGatherer" => 0, "Dist::Zilla::Role::PrereqSource" => 0, "Dist::Zilla::Tester" => 0, "ExtUtils::MakeMaker" => 0, "File::Spec" => 0, "File::pushd" => 0, "Moose" => 0, "Moose::Util::TypeConstraints" => 0, "Path::Tiny" => 0, "Sub::Exporter::ForMethods" => 0, "Test::Harness" => 0, "Test::More" => "0.96", "strict" => 0, "warnings" => 0 ); unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { delete $WriteMakefileArgs{TEST_REQUIRES}; delete $WriteMakefileArgs{BUILD_REQUIRES}; $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); Dist-Zilla-Plugin-Test-ReportPrereqs-0.029/xt/0000775000175000017500000000000014356565371017266 5ustar xdgxdgDist-Zilla-Plugin-Test-ReportPrereqs-0.029/xt/author/0000775000175000017500000000000014356565371020570 5ustar xdgxdgDist-Zilla-Plugin-Test-ReportPrereqs-0.029/xt/author/pod-syntax.t0000644000175000017500000000025214356565371023060 0ustar xdgxdg#!perl # This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. use strict; use warnings; use Test::More; use Test::Pod 1.41; all_pod_files_ok(); Dist-Zilla-Plugin-Test-ReportPrereqs-0.029/xt/author/pod-coverage.t0000644000175000017500000000036514356565371023332 0ustar xdgxdg#!perl # This file was automatically generated by Dist::Zilla::Plugin::PodCoverageTests. use strict; use warnings; use Test::Pod::Coverage 1.08; use Pod::Coverage::TrustPod; all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' }); Dist-Zilla-Plugin-Test-ReportPrereqs-0.029/xt/author/portability.t0000644000175000017500000000016314356565371023315 0ustar xdgxdguse strict; use warnings; use Test::More; use Test::Portability::Files; options(test_one_dot => 0); run_tests(); Dist-Zilla-Plugin-Test-ReportPrereqs-0.029/xt/author/00-compile.t0000644000175000017500000000271114356565371022621 0ustar xdgxdguse 5.006; use strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::Compile 2.058 use Test::More; plan tests => 2; my @module_files = ( 'Dist/Zilla/Plugin/Test/ReportPrereqs.pm' ); # fake home for cpan-testers use File::Temp; local $ENV{HOME} = File::Temp::tempdir( CLEANUP => 1 ); my @switches = ( -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 my $stderr = IO::Handle->new; diag('Running: ', join(', ', map { my $str = $_; $str =~ s/'/\\'/g; q{'} . $str . q{'} } $^X, @switches, '-e', "require q[$lib]")) if $ENV{PERL_COMPILE_TEST_DEBUG}; my $pid = open3($stdin, '>&STDERR', $stderr, $^X, @switches, '-e', "require q[$lib]"); binmode $stderr, ':crlf' if $^O eq 'MSWin32'; my @_warnings = <$stderr>; waitpid($pid, 0); is($?, 0, "$lib loaded ok"); shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/ and not eval { +require blib; blib->VERSION('1.01') }; if (@_warnings) { warn @_warnings; push @warnings, @_warnings; } } is(scalar(@warnings), 0, 'no warnings found') or diag 'got warnings: ', ( Test::More->can('explain') ? Test::More::explain(\@warnings) : join("\n", '', @warnings) ); Dist-Zilla-Plugin-Test-ReportPrereqs-0.029/xt/author/distmeta.t0000644000175000017500000000022314356565371022562 0ustar xdgxdg#!perl # This file was automatically generated by Dist::Zilla::Plugin::MetaTests. use strict; use warnings; use Test::CPAN::Meta; meta_yaml_ok(); Dist-Zilla-Plugin-Test-ReportPrereqs-0.029/xt/author/pod-spell.t0000644000175000017500000000066714356565371022663 0ustar xdgxdguse strict; use warnings; use Test::More; # generated by Dist::Zilla::Plugin::Test::PodSpelling 2.007005 use Test::Spelling 0.12; use Pod::Wordlist; add_stopwords(); all_pod_files_spelling_ok( qw( bin lib ) ); __DATA__ Brendan Byrd Champoux Dave David Dist Etheridge Fredric Golden Karen Kent Perl Plugin Randy ReportPrereqs Ricardo Rolsky Signes Stauner Test Yanick Zilla autarch dagolden ether kentfredric lib randy rjbs yanick Dist-Zilla-Plugin-Test-ReportPrereqs-0.029/xt/author/critic.t0000644000175000017500000000020114356565371022221 0ustar xdgxdg#!perl use strict; use warnings; use Test::Perl::Critic (-profile => "perlcritic.rc") x!! -e "perlcritic.rc"; all_critic_ok(); Dist-Zilla-Plugin-Test-ReportPrereqs-0.029/xt/author/test-version.t0000644000175000017500000000063714356565371023423 0ustar xdgxdguse strict; use warnings; use Test::More; # generated by Dist::Zilla::Plugin::Test::Version 1.09 use Test::Version; my @imports = qw( version_all_ok ); my $params = { is_strict => 0, has_version => 1, multiple => 0, }; push @imports, $params if version->parse( $Test::Version::VERSION ) >= version->parse('1.002'); Test::Version->import(@imports); version_all_ok; done_testing; Dist-Zilla-Plugin-Test-ReportPrereqs-0.029/MANIFEST0000644000175000017500000000110514356565371017757 0ustar xdgxdg# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.029. CONTRIBUTING.mkdn Changes LICENSE MANIFEST META.json META.yml Makefile.PL README corpus/DZ/Changes corpus/DZ/dist.ini corpus/DZ/foobar corpus/DZ/lib/Foo.pm corpus/DZ/t/foo.t cpanfile dist.ini lib/Dist/Zilla/Plugin/Test/ReportPrereqs.pm perlcritic.rc t/00-report-prereqs.dd t/00-report-prereqs.t t/report.t tidyall.ini xt/author/00-compile.t xt/author/critic.t xt/author/distmeta.t xt/author/pod-coverage.t xt/author/pod-spell.t xt/author/pod-syntax.t xt/author/portability.t xt/author/test-version.t Dist-Zilla-Plugin-Test-ReportPrereqs-0.029/t/0000775000175000017500000000000014356565371017076 5ustar xdgxdgDist-Zilla-Plugin-Test-ReportPrereqs-0.029/t/00-report-prereqs.t0000644000175000017500000001345214356565371022475 0ustar xdgxdg#!perl use strict; use warnings; # This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs 0.028 use Test::More tests => 1; use ExtUtils::MakeMaker; use File::Spec; # from $version::LAX my $lax_version_re = qr/(?: undef | (?: (?:[0-9]+) (?: \. | (?:\.[0-9]+) (?:_[0-9]+)? )? | (?:\.[0-9]+) (?:_[0-9]+)? ) | (?: v (?:[0-9]+) (?: (?:\.[0-9]+)+ (?:_[0-9]+)? )? | (?:[0-9]+)? (?:\.[0-9]+){2,} (?:_[0-9]+)? ) )/x; # hide optional CPAN::Meta modules from prereq scanner # and check if they are available my $cpan_meta = "CPAN::Meta"; my $cpan_meta_pre = "CPAN::Meta::Prereqs"; my $HAS_CPAN_META = eval "require $cpan_meta; $cpan_meta->VERSION('2.120900')" && eval "require $cpan_meta_pre"; ## no critic # Verify requirements? my $DO_VERIFY_PREREQS = 1; sub _max { my $max = shift; $max = ( $_ > $max ) ? $_ : $max for @_; return $max; } sub _merge_prereqs { my ($collector, $prereqs) = @_; # CPAN::Meta::Prereqs object if (ref $collector eq $cpan_meta_pre) { return $collector->with_merged_prereqs( CPAN::Meta::Prereqs->new( $prereqs ) ); } # Raw hashrefs for my $phase ( keys %$prereqs ) { for my $type ( keys %{ $prereqs->{$phase} } ) { for my $module ( keys %{ $prereqs->{$phase}{$type} } ) { $collector->{$phase}{$type}{$module} = $prereqs->{$phase}{$type}{$module}; } } } return $collector; } my @include = qw( ); my @exclude = qw( ); # Add static prereqs to the included modules list my $static_prereqs = do './t/00-report-prereqs.dd'; # Merge all prereqs (either with ::Prereqs or a hashref) my $full_prereqs = _merge_prereqs( ( $HAS_CPAN_META ? $cpan_meta_pre->new : {} ), $static_prereqs ); # Add dynamic prereqs to the included modules list (if we can) my ($source) = grep { -f } 'MYMETA.json', 'MYMETA.yml'; my $cpan_meta_error; if ( $source && $HAS_CPAN_META && (my $meta = eval { CPAN::Meta->load_file($source) } ) ) { $full_prereqs = _merge_prereqs($full_prereqs, $meta->prereqs); } else { $cpan_meta_error = $@; # capture error from CPAN::Meta->load_file($source) $source = 'static metadata'; } my @full_reports; my @dep_errors; my $req_hash = $HAS_CPAN_META ? $full_prereqs->as_string_hash : $full_prereqs; # Add static includes into a fake section for my $mod (@include) { $req_hash->{other}{modules}{$mod} = 0; } for my $phase ( qw(configure build test runtime develop other) ) { next unless $req_hash->{$phase}; next if ($phase eq 'develop' and not $ENV{AUTHOR_TESTING}); for my $type ( qw(requires recommends suggests conflicts modules) ) { next unless $req_hash->{$phase}{$type}; my $title = ucfirst($phase).' '.ucfirst($type); my @reports = [qw/Module Want Have/]; for my $mod ( sort keys %{ $req_hash->{$phase}{$type} } ) { next if $mod eq 'perl'; next if grep { $_ eq $mod } @exclude; my $file = $mod; $file =~ s{::}{/}g; $file .= ".pm"; my ($prefix) = grep { -e File::Spec->catfile($_, $file) } @INC; my $want = $req_hash->{$phase}{$type}{$mod}; $want = "undef" unless defined $want; $want = "any" if !$want && $want == 0; my $req_string = $want eq 'any' ? 'any version required' : "version '$want' required"; if ($prefix) { my $have = MM->parse_version( File::Spec->catfile($prefix, $file) ); $have = "undef" unless defined $have; push @reports, [$mod, $want, $have]; if ( $DO_VERIFY_PREREQS && $HAS_CPAN_META && $type eq 'requires' ) { if ( $have !~ /\A$lax_version_re\z/ ) { push @dep_errors, "$mod version '$have' cannot be parsed ($req_string)"; } elsif ( ! $full_prereqs->requirements_for( $phase, $type )->accepts_module( $mod => $have ) ) { push @dep_errors, "$mod version '$have' is not in required range '$want'"; } } } else { push @reports, [$mod, $want, "missing"]; if ( $DO_VERIFY_PREREQS && $type eq 'requires' ) { push @dep_errors, "$mod is not installed ($req_string)"; } } } if ( @reports ) { push @full_reports, "=== $title ===\n\n"; my $ml = _max( map { length $_->[0] } @reports ); my $wl = _max( map { length $_->[1] } @reports ); my $hl = _max( map { length $_->[2] } @reports ); if ($type eq 'modules') { splice @reports, 1, 0, ["-" x $ml, "", "-" x $hl]; push @full_reports, map { sprintf(" %*s %*s\n", -$ml, $_->[0], $hl, $_->[2]) } @reports; } else { splice @reports, 1, 0, ["-" x $ml, "-" x $wl, "-" x $hl]; push @full_reports, map { sprintf(" %*s %*s %*s\n", -$ml, $_->[0], $wl, $_->[1], $hl, $_->[2]) } @reports; } push @full_reports, "\n"; } } } if ( @full_reports ) { diag "\nVersions for all modules listed in $source (including optional ones):\n\n", @full_reports; } if ( $cpan_meta_error || @dep_errors ) { diag "\n*** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING ***\n"; } if ( $cpan_meta_error ) { my ($orig_source) = grep { -f } 'MYMETA.json', 'MYMETA.yml'; diag "\nCPAN::Meta->load_file('$orig_source') failed with: $cpan_meta_error\n"; } if ( @dep_errors ) { diag join("\n", "\nThe following REQUIRED prerequisites were not satisfied:\n", @dep_errors, "\n" ); } pass('Reported prereqs'); # vim: ts=4 sts=4 sw=4 et: Dist-Zilla-Plugin-Test-ReportPrereqs-0.029/t/report.t0000644000175000017500000000410614356565371020575 0ustar xdgxdguse 5.006; use strict; use warnings; use Test::More 0.96; use Capture::Tiny qw/capture/; use CPAN::Meta; # needed for missing prereq detection test use Dist::Zilla::Tester; use File::pushd qw/pushd/; use File::Spec; use Path::Tiny; use Test::Harness; my $test_file = File::Spec->catfile(qw(t 00-report-prereqs.t)); my $root = 'corpus/DZ'; # Adapted from DZP-CheckChangesHasContent sub capture_test_results { my $build_dir = shift; my $test_file_full = File::Spec->catfile( $build_dir, $test_file ); my $wd = pushd $build_dir; return capture { # I'd use TAP::Parser here, except the docs are horrid. local $ENV{HARNESS_VERBOSE} = 1; Test::Harness::execute_tests( tests => [$test_file_full] ); }; } { my $tzil = Dist::Zilla::Tester->from_config( { dist_root => $root }, ); ok( $tzil, "created test dist" ); $tzil->build_in; { my $build_dir = path($tzil->tempdir)->child('build'); my $wd = pushd( $build_dir ); capture { system( $^X, 'Makefile.PL' ) }; # create MYMETA.json } my ( $out, $err, $total, $failed ) = capture_test_results( $tzil->built_in ); is( $total->{ok}, 1, 'test passed' ) or diag "STDOUT:\n", $out, "STDERR:\n", $err, "\n"; like( $err, qr/Versions for all modules listed in (?:MY)?META/, "Saw report header" ); like( $err, qr/\bFile::Basename\b/, "prereq reported" ); like( $err, qr/\bAn::Extra::Module::That::Causes::Problems\b/, "module included" ); like( $err, qr/\bAn::Extra::Module::That::Causes::More::Problems\b/, "multiple modules included" ); unlike( $err, qr/\bSecretly::Used::Module\b/, "module excluded" ); like( $err, qr/\bWARNING\b.*The following.*Missing::Prereq is not installed\b/s, "warning issued when missing prereqs detected" ); } done_testing; # # This file is part of Dist-Zilla-Plugin-Test-ReportPrereqs # # This software is Copyright (c) 2012 by David Golden. # # This is free software, licensed under: # # The Apache License, Version 2.0, January 2004 # Dist-Zilla-Plugin-Test-ReportPrereqs-0.029/t/00-report-prereqs.dd0000644000175000017500000000652314356565371022622 0ustar xdgxdgdo { my $x = { 'configure' => { 'requires' => { 'ExtUtils::MakeMaker' => '6.17', 'perl' => '5.020' } }, 'develop' => { 'requires' => { 'Dist::Zilla' => '5', 'Dist::Zilla::PluginBundle::DAGOLDEN' => '0.072', 'File::Spec' => '0', 'File::Temp' => '0', 'IO::Handle' => '0', 'IPC::Open3' => '0', 'Pod::Coverage::TrustPod' => '0', 'Pod::Wordlist' => '0', 'Software::License::Apache_2_0' => '0', 'Test::CPAN::Meta' => '0', 'Test::More' => '0', 'Test::Perl::Critic' => '0', 'Test::Pod' => '1.41', 'Test::Pod::Coverage' => '1.08', 'Test::Portability::Files' => '0', 'Test::Spelling' => '0.12', 'Test::Version' => '1', 'strict' => '0' } }, 'runtime' => { 'requires' => { 'Data::Dumper' => '0', 'Data::Section' => '0.200002', 'Dist::Zilla' => '4', 'Dist::Zilla::File::FromCode' => '0', 'Dist::Zilla::File::InMemory' => '0', 'Dist::Zilla::Role::FileGatherer' => '0', 'Dist::Zilla::Role::PrereqSource' => '0', 'Moose' => '0', 'Moose::Util::TypeConstraints' => '0', 'Sub::Exporter::ForMethods' => '0', 'perl' => '5.020', 'warnings' => '0' } }, 'test' => { 'recommends' => { 'CPAN::Meta' => '2.120900' }, 'requires' => { 'CPAN::Meta' => '0', 'Capture::Tiny' => '0', 'Dist::Zilla::Tester' => '0', 'ExtUtils::MakeMaker' => '0', 'File::Spec' => '0', 'File::pushd' => '0', 'Path::Tiny' => '0', 'Test::Harness' => '0', 'Test::More' => '0.96', 'perl' => '5.020', 'strict' => '0' } } }; $x; }Dist-Zilla-Plugin-Test-ReportPrereqs-0.029/META.json0000644000175000017500000000741114356565371020255 0ustar xdgxdg{ "abstract" : "Report on prerequisite versions during automated testing", "author" : [ "David Golden " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 6.029, CPAN::Meta::Converter version 2.150010", "license" : [ "apache_2_0" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "Dist-Zilla-Plugin-Test-ReportPrereqs", "no_index" : { "directory" : [ "corpus", "examples", "t", "xt" ], "package" : [ "DB" ] }, "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "6.17", "perl" : "5.020" } }, "develop" : { "requires" : { "Dist::Zilla" : "5", "Dist::Zilla::PluginBundle::DAGOLDEN" : "0.072", "File::Spec" : "0", "File::Temp" : "0", "IO::Handle" : "0", "IPC::Open3" : "0", "Pod::Coverage::TrustPod" : "0", "Pod::Wordlist" : "0", "Software::License::Apache_2_0" : "0", "Test::CPAN::Meta" : "0", "Test::More" : "0", "Test::Perl::Critic" : "0", "Test::Pod" : "1.41", "Test::Pod::Coverage" : "1.08", "Test::Portability::Files" : "0", "Test::Spelling" : "0.12", "Test::Version" : "1", "strict" : "0" } }, "runtime" : { "requires" : { "Data::Dumper" : "0", "Data::Section" : "0.200002", "Dist::Zilla" : "4", "Dist::Zilla::File::FromCode" : "0", "Dist::Zilla::File::InMemory" : "0", "Dist::Zilla::Role::FileGatherer" : "0", "Dist::Zilla::Role::PrereqSource" : "0", "Moose" : "0", "Moose::Util::TypeConstraints" : "0", "Sub::Exporter::ForMethods" : "0", "perl" : "5.020", "warnings" : "0" } }, "test" : { "recommends" : { "CPAN::Meta" : "2.120900" }, "requires" : { "CPAN::Meta" : "0", "Capture::Tiny" : "0", "Dist::Zilla::Tester" : "0", "ExtUtils::MakeMaker" : "0", "File::Spec" : "0", "File::pushd" : "0", "Path::Tiny" : "0", "Test::Harness" : "0", "Test::More" : "0.96", "perl" : "5.020", "strict" : "0" } } }, "provides" : { "Dist::Zilla::Plugin::Test::ReportPrereqs" : { "file" : "lib/Dist/Zilla/Plugin/Test/ReportPrereqs.pm", "version" : "0.029" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/dagolden/Dist-Zilla-Plugin-Test-ReportPrereqs/issues" }, "homepage" : "https://github.com/dagolden/Dist-Zilla-Plugin-Test-ReportPrereqs", "repository" : { "type" : "git", "url" : "https://github.com/dagolden/Dist-Zilla-Plugin-Test-ReportPrereqs.git", "web" : "https://github.com/dagolden/Dist-Zilla-Plugin-Test-ReportPrereqs" } }, "version" : "0.029", "x_authority" : "cpan:DAGOLDEN", "x_contributors" : [ "Brendan Byrd ", "Dave Rolsky ", "Karen Etheridge ", "Kent Fredric ", "Randy Stauner ", "Ricardo Signes ", "Yanick Champoux " ], "x_generated_by_perl" : "v5.36.0", "x_serialization_backend" : "Cpanel::JSON::XS version 4.29", "x_spdx_expression" : "Apache-2.0" }