From eef80c26e97ca3b179ae82834c3a14ff047fe7e0 Mon Sep 17 00:00:00 2001 From: Kent Fredric Date: Thu, 5 Sep 2013 20:20:02 +1200 Subject: [PATCH] Build results of 6d3adb0 (on master) --- Build.PL | 11 +- Changes | 23 ++++ MANIFEST | 2 + META.json | 34 ++--- META.yml | 34 ++--- README | 58 +++----- corpus/fake_dist_04/dist.ini | 2 +- corpus/fake_dist_05/dist.ini | 2 +- layout/self_structure.dot | 8 ++ layout/self_structure.png | Bin 0 -> 5704 bytes lib/Dist/Zilla/Plugin/Bootstrap/lib.pm | 179 +++++-------------------- t/00-compile.t | 2 +- t/000-report-versions-tiny.t | 5 +- 13 files changed, 129 insertions(+), 231 deletions(-) create mode 100644 layout/self_structure.dot create mode 100644 layout/self_structure.png diff --git a/Build.PL b/Build.PL index a42643b..2501a56 100644 --- a/Build.PL +++ b/Build.PL @@ -17,28 +17,27 @@ my %module_build_args = ( "Kent Fredric " ], "dist_name" => "Dist-Zilla-Plugin-Bootstrap-lib", - "dist_version" => "0.03000200", + "dist_version" => "0.04000000", "license" => "perl", "module_name" => "Dist::Zilla::Plugin::Bootstrap::lib", "recommends" => {}, "recursive_test_files" => 1, "requires" => { - "Cwd" => 0, - "Moo::HandleMoose::FakeMetaClass" => 0, - "Path::Tiny" => 0, - "Role::Tiny" => 0, - "lib" => 0, + "Dist::Zilla::Role::Bootstrap" => 0, + "Moose" => 0, "perl" => "5.006", "strict" => 0, "warnings" => 0 }, "script_files" => [], "test_requires" => { + "Cwd" => 0, "Dist::Zilla" => 0, "File::Copy::Recursive" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, "Path::FindDev" => 0, + "Path::Tiny" => 0, "Test::More" => "0.98" } ); diff --git a/Changes b/Changes index d91e964..56a3ad1 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,28 @@ Revision history for Dist-Zilla-Plugin-Bootstrap-lib +0.04000000 2013-09-05T08:17:38Z + [!Major and API breaking Changes] + - no_fallback deprecated in favour of fallback = 0/1 + - reimplemented in terms of a proper Moose class and ::Role::Bootstrap + + [!Minor] + - add metapod and related info + + [Dependencies::Added / runtime requires] + - Dist::Zilla::Role::Bootstrap + - Moose + + [Dependencies::Added / test requires] + - Cwd + - Path::Tiny + + [Dependencies::Removed / runtime requires] + - Cwd + - Moo::HandleMoose::FakeMetaClass + - Path::Tiny + - Role::Tiny + - lib + 0.03000200 2013-09-03T03:36:10Z [!Minor] - Add tests diff --git a/MANIFEST b/MANIFEST index fb72db9..f3f25d1 100644 --- a/MANIFEST +++ b/MANIFEST @@ -24,6 +24,8 @@ corpus/fake_dist_05/E-0.01/lib/E.pm corpus/fake_dist_05/dist.ini corpus/fake_dist_05/lib/E.pm dist.ini +layout/self_structure.dot +layout/self_structure.png lib/Dist/Zilla/Plugin/Bootstrap/lib.pm perlcritic.rc t/00-compile.t diff --git a/META.json b/META.json index 8711b89..aeac24a 100644 --- a/META.json +++ b/META.json @@ -44,11 +44,8 @@ }, "runtime" : { "requires" : { - "Cwd" : "0", - "Moo::HandleMoose::FakeMetaClass" : "0", - "Path::Tiny" : "0", - "Role::Tiny" : "0", - "lib" : "0", + "Dist::Zilla::Role::Bootstrap" : "0", + "Moose" : "0", "perl" : "5.006", "strict" : "0", "warnings" : "0" @@ -56,11 +53,13 @@ }, "test" : { "requires" : { + "Cwd" : "0", "Dist::Zilla" : "0", "File::Copy::Recursive" : "0", "IO::Handle" : "0", "IPC::Open3" : "0", "Path::FindDev" : "0", + "Path::Tiny" : "0", "Test::More" : "0.98" } } @@ -68,7 +67,7 @@ "provides" : { "Dist::Zilla::Plugin::Bootstrap::lib" : { "file" : "lib/Dist/Zilla/Plugin/Bootstrap/lib.pm", - "version" : "0.03000200" + "version" : "0.04000000" } }, "release_status" : "stable", @@ -83,32 +82,31 @@ "web" : "https://github.com/kentfredric/Dist-Zilla-Plugin-Bootstrap-lib" } }, - "version" : "0.03000200", + "version" : "0.04000000", "x_BuiltWith" : { "modules" : { "Cwd" : "3.40", "Dist::Zilla" : "4.300037", "Dist::Zilla::PluginBundle::Author::KENTNL" : "1.8.3", "Dist::Zilla::PluginBundle::Author::KENTNL::Lite" : "NA(possibly not installed)", + "Dist::Zilla::Role::Bootstrap" : "0.1.0", "File::Copy::Recursive" : "0.38", "IO::Handle" : "1.34", "IPC::Open3" : "1.13", "Module::Build" : "0.4007", - "Moo::HandleMoose::FakeMetaClass" : "NA(undef)", + "Moose" : "2.1005", "Path::FindDev" : "0.2.0", "Path::Tiny" : "0.031", "Pod::Coverage::TrustPod" : "0.100002", - "Role::Tiny" : "1.003001", "Test::CPAN::Changes" : "0.23", "Test::CPAN::Meta" : "0.23", - "Test::Kwalitee" : "1.13", + "Test::Kwalitee" : "1.14", "Test::More" : "0.98", "Test::Pod" : "1.48", "Test::Pod::Coverage" : "1.08", - "lib" : "0.63", "perl" : "NA(skipped: perl)", "strict" : "1.07", - "version" : "0.9903", + "version" : "0.9904", "warnings" : "1.18" }, "perl" : { @@ -136,12 +134,14 @@ { "class" : "Dist::Zilla::Plugin::Bootstrap::lib", "config" : { - "Dist::Zilla::Plugin::Bootstrap::lib" : { + "Dist::Zilla::Role::Bootstrap" : { + "distname" : "Dist-Zilla-Plugin-Bootstrap-lib", + "fallback" : "1", "try_built" : null } }, "name" : "Bootstrap::lib", - "version" : "0.03000200" + "version" : "0.04000000" }, { "class" : "Dist::Zilla::Plugin::Git::NextVersion", @@ -156,7 +156,7 @@ { "class" : "Dist::Zilla::Plugin::GithubMeta", "name" : "@Author::KENTNL/GithubMeta", - "version" : "0.32" + "version" : "0.34" }, { "class" : "Dist::Zilla::Plugin::MetaProvides::Package", @@ -258,7 +258,7 @@ } }, "name" : "@Author::KENTNL/Test::Compile", - "version" : "2.023" + "version" : "2.025" }, { "class" : "Dist::Zilla::Plugin::Test::Perl::Critic", @@ -449,7 +449,7 @@ } }, "name" : "@Author::KENTNL/Prereqs::MatchInstalled", - "version" : "0.1.1" + "version" : "0.1.2" }, { "class" : "Dist::Zilla::Plugin::Prereqs", diff --git a/META.yml b/META.yml index 26d504d..a0d86f3 100644 --- a/META.yml +++ b/META.yml @@ -3,12 +3,14 @@ abstract: 'A minimal boot-strapping for Dist::Zilla Plug-ins.' author: - 'Kent Fredric ' build_requires: + Cwd: 0 Dist::Zilla: 0 File::Copy::Recursive: 0 IO::Handle: 0 IPC::Open3: 0 Module::Build: 0.4007 Path::FindDev: 0 + Path::Tiny: 0 Test::More: 0.98 configure_requires: Module::Build: 0.4007 @@ -22,13 +24,10 @@ name: Dist-Zilla-Plugin-Bootstrap-lib provides: Dist::Zilla::Plugin::Bootstrap::lib: file: lib/Dist/Zilla/Plugin/Bootstrap/lib.pm - version: 0.03000200 + version: 0.04000000 requires: - Cwd: 0 - Moo::HandleMoose::FakeMetaClass: 0 - Path::Tiny: 0 - Role::Tiny: 0 - lib: 0 + Dist::Zilla::Role::Bootstrap: 0 + Moose: 0 perl: 5.006 strict: 0 warnings: 0 @@ -36,32 +35,31 @@ resources: bugtracker: https://github.com/kentfredric/Dist-Zilla-Plugin-Bootstrap-lib/issues homepage: https://github.com/kentfredric/Dist-Zilla-Plugin-Bootstrap-lib repository: https://github.com/kentfredric/Dist-Zilla-Plugin-Bootstrap-lib.git -version: 0.03000200 +version: 0.04000000 x_BuiltWith: modules: Cwd: 3.40 Dist::Zilla: 4.300037 Dist::Zilla::PluginBundle::Author::KENTNL: 1.8.3 Dist::Zilla::PluginBundle::Author::KENTNL::Lite: 'NA(possibly not installed)' + Dist::Zilla::Role::Bootstrap: 0.1.0 File::Copy::Recursive: 0.38 IO::Handle: 1.34 IPC::Open3: 1.13 Module::Build: 0.4007 - Moo::HandleMoose::FakeMetaClass: NA(undef) + Moose: 2.1005 Path::FindDev: 0.2.0 Path::Tiny: 0.031 Pod::Coverage::TrustPod: 0.100002 - Role::Tiny: 1.003001 Test::CPAN::Changes: 0.23 Test::CPAN::Meta: 0.23 - Test::Kwalitee: 1.13 + Test::Kwalitee: 1.14 Test::More: 0.98 Test::Pod: 1.48 Test::Pod::Coverage: 1.08 - lib: 0.63 perl: 'NA(skipped: perl)' strict: 1.07 - version: 0.9903 + version: 0.9904 warnings: 1.18 perl: original: v5.18.0 @@ -83,10 +81,12 @@ x_Dist_Zilla: - class: Dist::Zilla::Plugin::Bootstrap::lib config: - Dist::Zilla::Plugin::Bootstrap::lib: + Dist::Zilla::Role::Bootstrap: + distname: Dist-Zilla-Plugin-Bootstrap-lib + fallback: 1 try_built: ~ name: Bootstrap::lib - version: 0.03000200 + version: 0.04000000 - class: Dist::Zilla::Plugin::Git::NextVersion name: '@Author::KENTNL/Git::NextVersion' @@ -98,7 +98,7 @@ x_Dist_Zilla: - class: Dist::Zilla::Plugin::GithubMeta name: '@Author::KENTNL/GithubMeta' - version: 0.32 + version: 0.34 - class: Dist::Zilla::Plugin::MetaProvides::Package name: '@Author::KENTNL/MetaProvides::Package' @@ -177,7 +177,7 @@ x_Dist_Zilla: script_finder: - ':ExecFiles' name: '@Author::KENTNL/Test::Compile' - version: 2.023 + version: 2.025 - class: Dist::Zilla::Plugin::Test::Perl::Critic name: '@Author::KENTNL/Test::Perl::Critic' @@ -329,7 +329,7 @@ x_Dist_Zilla: - Test::More - Dist::Zilla::PluginBundle::Author::KENTNL name: '@Author::KENTNL/Prereqs::MatchInstalled' - version: 0.1.1 + version: 0.1.2 - class: Dist::Zilla::Plugin::Prereqs config: diff --git a/README b/README index 9e8d6c0..f0ef9f5 100644 --- a/README +++ b/README @@ -3,39 +3,20 @@ NAME Dist::Zilla Plug-ins. VERSION - version 0.03000200 + version 0.04000000 SYNOPSIS [Bootstrap::lib] try_built = 1 ; try using an existing built distribution named Dist-Name-* - no_fallback = 1 ; if try_built can't find a built distribution, or there's more than one, don't bootstrap + fallback = 0 ; if try_built can't find a built distribution, or there's more than one, don't bootstrap ; using lib/ instead DESCRIPTION - This module does the very simple task of injecting the distributions - 'lib' directory into @INC at the point of its inclusion, so that you can - use plug-ins you're writing for "Dist::Zilla", to release the plug-in - itself. + This module exists for loading either "/lib" or + "/Dist-Name-$VERSION/lib" into your @INC early on. -METHODS - "log_debug" - 1; - "plugin_name" - 'Bootstrap::lib' - "new" - my $conf = __PACKAGE__->new({ config => \%arbitrary_hash}); - - "does" - Lazily invokes Role::Tiny::does_role on demand. - - "meta" - Lazily creates a meta object using Moo - - "dump_config" - Dumps the configuration of this plugin to "dzil" - - "register_component" - This is where all the real work happens. + This is mostly useful for writing "Dist::Zilla" plug-ins, so that you + may build and release a plug-in using itself. USE CASES Simple single-phase self-dependency @@ -62,7 +43,7 @@ USE CASES [Bootstap::lib] try_built = 1 - no_fallback = 1 + fallback = 0 Will do what you want. @@ -134,20 +115,17 @@ PRECAUTIONS discover that, and hard-code those values in "dist.ini" to start with. STILL NOT REALLY A PLUGIN - Though the interface is getting more plugin-like every day, all of the - behaviour is still implemented at construction time, practically as soon - as the underlying Config::MVP engine has parsed it from the - configuration. - - As such, it is completely removed from the real plugin execution phases, - and unlike real plugins which appear on the plugin stash, this module - does not appear there. - - GOOD LUCK - I wrote this plug-in, mostly because I was boiler-plating the code into - every dist I had that needed it, and it became annoying, especially - having to update the code across distributions to handle "Dist::Zilla" - "API" changes. + Starting at version 0.04000000 ( read: 0.04_0000_00 aka 0.04 + 0 x 4 + 0 + x 2 ) this module is a fully fledged class, different only from standard + Dist::Zilla Plugins in that it doesn't partake in normal phase order, + and only executes during a special custom "::Bootstrap" phase, which is + more or less a different name and implementation of "BUILD", in that + "bootstrap" is invoked after "plugin_from_config" is called ( where + "new" is called ), which occurs somewhere in the middle of + "register_component" + + This module also appears on the plugin stash, and responds naturally to + "metaconfig" requests. AUTHOR Kent Fredric diff --git a/corpus/fake_dist_04/dist.ini b/corpus/fake_dist_04/dist.ini index 747d7fe..a9bf229 100644 --- a/corpus/fake_dist_04/dist.ini +++ b/corpus/fake_dist_04/dist.ini @@ -6,7 +6,7 @@ copyright_holder = Kent Fredric [Bootstrap::lib] try_built = 1 -no_fallback = 1 +fallback = 0 [MetaConfig] [MetaJSON] diff --git a/corpus/fake_dist_05/dist.ini b/corpus/fake_dist_05/dist.ini index 747d7fe..a9bf229 100644 --- a/corpus/fake_dist_05/dist.ini +++ b/corpus/fake_dist_05/dist.ini @@ -6,7 +6,7 @@ copyright_holder = Kent Fredric [Bootstrap::lib] try_built = 1 -no_fallback = 1 +fallback = 0 [MetaConfig] [MetaJSON] diff --git a/layout/self_structure.dot b/layout/self_structure.dot new file mode 100644 index 0000000..bad9271 --- /dev/null +++ b/layout/self_structure.dot @@ -0,0 +1,8 @@ +strict digraph Perl { + graph [compound=1, concentrate=1, overlap=false, rankdir=LR, ranksep=1, smoothing=triangle, splines=spline]; + node [label="\N", shape=record, style=dotted]; + edge [minlen=1]; + "Dist::Zilla::Plugin::Bootstrap::lib" [label="{{ class}| Dist::Zilla::Plugin::Bootstrap::lib}", shape=Mrecord, style=solid, color="#7e1e9c", fontsize=7, height="0.1"]; + "Dist::Zilla::Role::Bootstrap" [label=" Dist::Zilla::Role::Bootstrap"]; + "Dist::Zilla::Role::Bootstrap" -> "Dist::Zilla::Plugin::Bootstrap::lib" [arrowhead=open, arrowsize="0.5", color="#653700", dir=forward, fontsize=6, headclip=1, label="consumed by", samehead=head, tailclip=1, weight=5]; +} diff --git a/layout/self_structure.png b/layout/self_structure.png new file mode 100644 index 0000000000000000000000000000000000000000..76a860a6199c817d7d2fa59f96526a1a9939edab GIT binary patch literal 5704 zcmV-O7Psk%P)fFMZoxZ}8f-|QX79k-B0y%N4Evrf;JmzM|e0SQ<>EdR60 zhd>~Z&(Sj{CntnYmqqXaKkM{tL_`F_2P9zmu>8*|9|D0upuZ9F?<0v14+4Qepq@d# zYMl7+AP@+I4+7^12-GtO1OoL80{O?t@2L_34|w1n;8p=QOp@=T4^>q7eGmxLGsr&=m&;2Fc3Za}^1cYzN||-JSA3QkE2yu|qG7WC7?PGiAh^)WLu}2w@);n>d4K&U5EY_@ z)23rL%UU|r!>Ns1u0GVnC!a2*7QHz+0g*sv$RI(2^yfQ{M5V0i#6J$~wjF{XDqC_} zC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HBPp#(O!NmoOqU7d)^G;Gh}El1j{hzj229#MGxIo+Ot}F9%psP7PM4G ztuc}ZQ?1&p-xA)uJU>TXMt+jVty*^1W?;YHIO*bhf&Y+th+2m?h=*<-HbUCb^yK@_SzYzBV1G8z)qa#93`WQCz};H-;mLm+zT?hk zpDTiT29XvI|13N>;R5{sc|v*=qIeL8nm zD1p-JlViG=)Rz)W@Adb~8BRMq(@FpLCPOi-Xw7%a!-F&G<&1Q657{PN6j3eTifI_~+2w{<-<#)ynlp=RIy; znTZh-qqrlMN-UUIHV>{XH`aIa4l=(H$TR-2k8eIdx$}B??0M{*4CA*WmP*{8_v!6U zp2#!GW-ZA9l1xuL0E)%=836JO0OT0}$TI+tX8_1E0FY;Jj>eN5Aj$N^Lw^vU5cCH@ zo&oYK?bv?ZG-N92w5zMv>r+Wg@;3F=@1{P$pXb?H@>9ZPNyidNrzhoVwVEX{$=lRd uznl61-Uk6do&kV70|0pj0P+lg|HXG* $class }, 'Moo::HandleMoose::FakeMetaClass'; -} - - -sub dump_config { return { q{} . __PACKAGE__, $_[0]->{config} } } - -sub _try_bootstrap_built { - my ($config) = @_; - my $logger = $config->{logger}; - my $distname = $config->{distname}; - my $cwd = $config->{cwd}; - my $fallback = $config->{fallback}; +use Moose; +with 'Dist::Zilla::Role::Bootstrap'; - my $libdir = $cwd->child($distname); +sub bootstrap { + my ($self) = @_; - $logger->log_debug( [ 'trying to bootstrap %s-*', $libdir ] ); + my $bootstrap_root = $self->_bootstrap_root; - my (@candidates) = grep { $_->basename =~ /^\Q$distname\E-/ } grep { $_->is_dir } $cwd->children; - - if ( scalar @candidates == 1 ) { - return $candidates[0]->child('lib'); - } - $logger->log_debug( [ 'candidate: %s', $_->basename ] ) for @candidates; - - if ( not $fallback ) { - $logger->log( [ 'candidates for bootstrap (%s) != 1, and fallback disabled. not bootstrapping', 0 + @candidates ] ); + if ( not $bootstrap_root ) { return; } - $logger->log( [ 'candidates for bootstrap (%s) != 1, fallback to boostrapping lib/', 0 + @candidates ] ); - return $cwd->child('lib'); -} - - -sub register_component { - my ( $plugin_class, $name, $payload, $section ) = @_; - my $zilla = $section->sequence->assembler->zilla; - my $logger = $zilla->chrome->logger->proxy( - { - proxy_prefix => '[' . $name . '] ', - } - ); - my $distname = $zilla->name; - $logger->log_debug( [ 'online, %s v%s', $plugin_class, $plugin_class->VERSION || 0 ] ); - - $payload->{try_built} = undef if not exists $payload->{try_built}; - - if ( $payload->{try_built} ) { - $payload->{fallback} = 1 if not exists $payload->{fallback}; - $payload->{fallback} = undef if exists $payload->{no_fallback}; - } - - require Path::Tiny; - my $cwd = Path::Tiny::path(cwd); - - my $bootstrap_path; - - if ( not $payload->{try_built} ) { - $bootstrap_path = $cwd->child('lib'); - } - else { - my $config = { cwd => $cwd, logger => $logger, fallback => $payload->{fallback}, distname => $distname }; - $bootstrap_path = _try_bootstrap_built($config); - } - - if ( defined $bootstrap_path ) { - require lib; - lib->import("$bootstrap_path"); - $logger->log( [ 'Bootstrapping %s', "$bootstrap_path" ] ); - } - - my $plugin_config = { - config => { - ( exists $payload->{try_built} ? ( try_built => $payload->{try_built} ) : () ), - ( exists $payload->{fallback} ? ( fallback => $payload->{fallback} ) : () ), - ( exists $payload->{no_fallback} ? ( no_fallback => $payload->{no_fallback} ) : () ), - } - }; - - push @{ $zilla->plugins }, $plugin_class->new($plugin_config); - - return unless defined $bootstrap_path; - + my $bootstrap_path = $bootstrap_root->child('lib'); + $self->_add_inc("$bootstrap_path"); + $self->log( [ 'Bootstrapping %s', "$bootstrap_path" ] ); my $it = $bootstrap_path->iterator( { recurse => 1 } ); while ( my $file = $it->() ) { next unless $file->basename =~ /[.]pm$/msx; my $rpath = $file->relative($bootstrap_path)->stringify; if ( exists $INC{$rpath} ) { - $logger->log( [ '%s was not bootstrapped. You need to move Bootstrap::lib higher', $rpath ] ); + $self->log( [ '%s was not bootstrapped. You need to move Bootstrap::lib higher', $rpath ] ); } } @@ -138,6 +46,9 @@ sub register_component { } +__PACKAGE__->meta->make_immutable; +no Moose; + 1; __END__ @@ -150,50 +61,21 @@ Dist::Zilla::Plugin::Bootstrap::lib - A minimal boot-strapping for Dist::Zilla P =head1 VERSION -version 0.03000200 +version 0.04000000 =head1 SYNOPSIS [Bootstrap::lib] try_built = 1 ; try using an existing built distribution named Dist-Name-* - no_fallback = 1 ; if try_built can't find a built distribution, or there's more than one, don't bootstrap + fallback = 0 ; if try_built can't find a built distribution, or there's more than one, don't bootstrap ; using lib/ instead =head1 DESCRIPTION -This module does the very simple task of -injecting the distributions 'lib' directory into @INC -at the point of its inclusion, so that you can use -plug-ins you're writing for L<< C|Dist::Zilla >>, to release -the plug-in itself. - -=head1 METHODS - -=head2 C - 1; - -=head2 C - 'Bootstrap::lib' +This module exists for loading either C or C into your C<@INC> early on. -=head2 C - - my $conf = __PACKAGE__->new({ config => \%arbitrary_hash}); - -=head2 C - -Lazily invokes Role::Tiny::does_role on demand. - -=head2 C - -Lazily creates a meta object using Moo - -=head2 C - -Dumps the configuration of this plugin to C - -=head2 C - -This is where all the real work happens. +This is mostly useful for writing L<< C|Dist::Zilla >> plug-ins, so that you may build and release +a plug-in using itself. =head1 USE CASES @@ -222,7 +104,7 @@ For that [Bootstap::lib] try_built = 1 - no_fallback = 1 + fallback = 0 Will do what you want. @@ -291,15 +173,22 @@ The only way of working around that I can envision is adding parameters to C phase, +which is more or less a different name and implementation of C, in that C is invoked after C is called ( where C is called ), which occurs somewhere in the middle of C + +This module also appears on the plugin stash, and responds naturally to C requests. -As such, it is completely removed from the real plugin execution phases, and unlike real plugins which appear on the plugin stash, this module does not appear there. +=begin MetaPOD::JSON v1.1.0 + +{ + "namespace":"Dist::Zilla::Plugin::Bootstrap::lib", + "interface":"class", + "does":"Dist::Zilla::Role::Bootstrap" +} -=head2 GOOD LUCK -I wrote this plug-in, mostly because I was boiler-plating the code into every dist I had that needed it, and -it became annoying, especially having to update the code across distributions to handle -L<< C|Dist::Zilla >> C changes. +=end MetaPOD::JSON =head1 AUTHOR diff --git a/t/00-compile.t b/t/00-compile.t index 7e74d84..340ef7e 100644 --- a/t/00-compile.t +++ b/t/00-compile.t @@ -1,7 +1,7 @@ use strict; use warnings; -# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.023 +# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.025 use Test::More tests => 1 + ($ENV{AUTHOR_TESTING} ? 1 : 0); diff --git a/t/000-report-versions-tiny.t b/t/000-report-versions-tiny.t index ec25bc4..d2574dc 100644 --- a/t/000-report-versions-tiny.t +++ b/t/000-report-versions-tiny.t @@ -52,22 +52,21 @@ eval { $v .= pmver('Cwd','any version') }; eval { $v .= pmver('Dist::Zilla','any version') }; eval { $v .= pmver('Dist::Zilla::PluginBundle::Author::KENTNL','v1.8.3') }; eval { $v .= pmver('Dist::Zilla::PluginBundle::Author::KENTNL::Lite','v1.3.0') }; +eval { $v .= pmver('Dist::Zilla::Role::Bootstrap','any version') }; eval { $v .= pmver('File::Copy::Recursive','any version') }; eval { $v .= pmver('IO::Handle','any version') }; eval { $v .= pmver('IPC::Open3','any version') }; eval { $v .= pmver('Module::Build','0.4007') }; -eval { $v .= pmver('Moo::HandleMoose::FakeMetaClass','any version') }; +eval { $v .= pmver('Moose','any version') }; eval { $v .= pmver('Path::FindDev','any version') }; eval { $v .= pmver('Path::Tiny','any version') }; eval { $v .= pmver('Pod::Coverage::TrustPod','any version') }; -eval { $v .= pmver('Role::Tiny','any version') }; eval { $v .= pmver('Test::CPAN::Changes','0.19') }; eval { $v .= pmver('Test::CPAN::Meta','any version') }; eval { $v .= pmver('Test::Kwalitee','1.08') }; eval { $v .= pmver('Test::More','0.98') }; eval { $v .= pmver('Test::Pod','1.41') }; eval { $v .= pmver('Test::Pod::Coverage','1.08') }; -eval { $v .= pmver('lib','any version') }; eval { $v .= pmver('strict','any version') }; eval { $v .= pmver('version','0.9901') }; eval { $v .= pmver('warnings','any version') };