diff --git a/Build.PL b/Build.PL index 53f04ea4..125aed92 100644 --- a/Build.PL +++ b/Build.PL @@ -13,6 +13,7 @@ my %module_build_args = ( 'File::Temp' => '0', 'File::pushd' => '0', 'FindBin' => '0', + 'JSON' => '0', 'Module::Build' => '0.3601', 'Path::Class' => '0', 'Test::DZil' => '0', @@ -29,7 +30,7 @@ my %module_build_args = ( 'Kent Fredric ' ], 'dist_name' => 'Dist-Zilla-PluginBundle-Author-KENTNL', - 'dist_version' => '1.0.13', + 'dist_version' => '1.0.14', 'license' => 'perl', 'module_name' => 'Dist::Zilla::PluginBundle::Author::KENTNL', 'recommends' => {}, diff --git a/Changes b/Changes index c0759f64..28dec405 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,18 @@ Revision history for Dist-Zilla-PluginBundle-Author-KENTNL +1.0.14 2011-07-18T21:23:49Z + [Bugs] + - Reworked handling of auto_prereqs_skip not to carp needlessly. + + [Features] + - Can use multiple values of auto_prereqs_skip now. + - Now stricter about flags passed to detect typos. + - Minted dists now have an example auto_prereqs_skip + + [Tests] + - Minter test now tests auto_prereq generation and the auto_prereqs_skip + flag. + 1.0.13 2011-07-17T01:06:15Z [Bugs] - Fixed an issue where the change of Dzil's Autoprereqs 'skip' parameter diff --git a/META.json b/META.json index 4f400a13..c4a4aa65 100644 --- a/META.json +++ b/META.json @@ -105,6 +105,7 @@ "File::Temp" : 0, "File::pushd" : 0, "FindBin" : 0, + "JSON" : 0, "Path::Class" : 0, "Test::DZil" : 0, "Test::Fatal" : 0, @@ -117,15 +118,15 @@ "provides" : { "Dist::Zilla::MintingProfile::Author::KENTNL" : { "file" : "lib/Dist/Zilla/MintingProfile/Author/KENTNL.pm", - "version" : "v1.0.13" + "version" : "v1.0.14" }, "Dist::Zilla::Plugin::Author::KENTNL::DistINI" : { "file" : "lib/Dist/Zilla/Plugin/Author/KENTNL/DistINI.pm", - "version" : "v1.0.13" + "version" : "v1.0.14" }, "Dist::Zilla::PluginBundle::Author::KENTNL" : { "file" : "lib/Dist/Zilla/PluginBundle/Author/KENTNL.pm", - "version" : "v1.0.13" + "version" : "v1.0.14" } }, "release_status" : "stable", @@ -137,7 +138,7 @@ "web" : "https://github.com/kentfredric/Dist-Zilla-PluginBundle-Author-KENTNL" } }, - "version" : "1.0.13", + "version" : "1.0.14", "x_BuiltWith" : { "modules" : { "Capture::Tiny" : "0.11", @@ -193,6 +194,7 @@ "File::pushd" : "1.00", "FindBin" : "1.50", "IO::Socket::SSL" : "1.44", + "JSON" : "2.53", "LWP::Protocol::https" : "6.02", "Module::Build" : "0.38", "Moose" : "2.001", diff --git a/META.yml b/META.yml index f135cb56..b410c1cc 100644 --- a/META.yml +++ b/META.yml @@ -9,6 +9,7 @@ build_requires: File::Temp: 0 File::pushd: 0 FindBin: 0 + JSON: 0 Module::Build: 0.3601 Path::Class: 0 Test::DZil: 0 @@ -28,13 +29,13 @@ name: Dist-Zilla-PluginBundle-Author-KENTNL provides: Dist::Zilla::MintingProfile::Author::KENTNL: file: lib/Dist/Zilla/MintingProfile/Author/KENTNL.pm - version: v1.0.13 + version: v1.0.14 Dist::Zilla::Plugin::Author::KENTNL::DistINI: file: lib/Dist/Zilla/Plugin/Author/KENTNL/DistINI.pm - version: v1.0.13 + version: v1.0.14 Dist::Zilla::PluginBundle::Author::KENTNL: file: lib/Dist/Zilla/PluginBundle/Author/KENTNL.pm - version: v1.0.13 + version: v1.0.14 requires: Carp: 0 Class::Load: 0 @@ -96,7 +97,7 @@ requires: resources: homepage: https://github.com/kentfredric/Dist-Zilla-PluginBundle-Author-KENTNL repository: https://github.com/kentfredric/Dist-Zilla-PluginBundle-Author-KENTNL -version: 1.0.13 +version: 1.0.14 x_BuiltWith: modules: Capture::Tiny: 0.11 @@ -152,6 +153,7 @@ x_BuiltWith: File::pushd: 1.00 FindBin: 1.50 IO::Socket::SSL: 1.44 + JSON: 2.53 LWP::Protocol::https: 6.02 Module::Build: 0.38 Moose: 2.001 diff --git a/README b/README index 30262d76..5f98305f 100644 --- a/README +++ b/README @@ -3,7 +3,7 @@ NAME build your distributions. VERSION - version 1.0.13 + version 1.0.14 SYNOPSIS [@Author::KENTNL] diff --git a/lib/Dist/Zilla/MintingProfile/Author/KENTNL.pm b/lib/Dist/Zilla/MintingProfile/Author/KENTNL.pm index a827b282..8f658b3f 100644 --- a/lib/Dist/Zilla/MintingProfile/Author/KENTNL.pm +++ b/lib/Dist/Zilla/MintingProfile/Author/KENTNL.pm @@ -3,7 +3,7 @@ use warnings; package Dist::Zilla::MintingProfile::Author::KENTNL; BEGIN { - $Dist::Zilla::MintingProfile::Author::KENTNL::VERSION = '1.0.13'; + $Dist::Zilla::MintingProfile::Author::KENTNL::VERSION = '1.0.14'; } # ABSTRACT: KENTNL's Minting Profile @@ -26,7 +26,7 @@ Dist::Zilla::MintingProfile::Author::KENTNL - KENTNL's Minting Profile =head1 VERSION -version 1.0.13 +version 1.0.14 =head1 SYNOPSIS diff --git a/lib/Dist/Zilla/Plugin/Author/KENTNL/DistINI.pm b/lib/Dist/Zilla/Plugin/Author/KENTNL/DistINI.pm index 8f942372..2a0dbe45 100644 --- a/lib/Dist/Zilla/Plugin/Author/KENTNL/DistINI.pm +++ b/lib/Dist/Zilla/Plugin/Author/KENTNL/DistINI.pm @@ -3,7 +3,7 @@ use warnings; package Dist::Zilla::Plugin::Author::KENTNL::DistINI; BEGIN { - $Dist::Zilla::Plugin::Author::KENTNL::DistINI::VERSION = '1.0.13'; + $Dist::Zilla::Plugin::Author::KENTNL::DistINI::VERSION = '1.0.14'; } # ABSTRACT: Generate a C for @Author::KENTNL projects. @@ -53,6 +53,7 @@ sub gather_files { '; version_rel_hour = %{rel_hour}n', # '; version_rel_time_zone = %{tz}s', # 'twitter_hash_tags = %{tags}s', # + '; auto_prereqs_skip = File::Find', # $empty, # '[Prereqs]', # $empty, # @@ -114,7 +115,7 @@ Dist::Zilla::Plugin::Author::KENTNL::DistINI - Generate a C for @Autho =head1 VERSION -version 1.0.13 +version 1.0.14 =head1 SYNOPSIS diff --git a/lib/Dist/Zilla/PluginBundle/Author/KENTNL.pm b/lib/Dist/Zilla/PluginBundle/Author/KENTNL.pm index d717f22e..815a3ce5 100644 --- a/lib/Dist/Zilla/PluginBundle/Author/KENTNL.pm +++ b/lib/Dist/Zilla/PluginBundle/Author/KENTNL.pm @@ -3,7 +3,7 @@ use warnings; package Dist::Zilla::PluginBundle::Author::KENTNL; BEGIN { - $Dist::Zilla::PluginBundle::Author::KENTNL::VERSION = '1.0.13'; + $Dist::Zilla::PluginBundle::Author::KENTNL::VERSION = '1.0.14'; } # ABSTRACT: BeLike::KENTNL when you build your distributions. @@ -60,7 +60,7 @@ sub _mk_only { return () if exists $ENV{ 'KENTNL_NO' . $envname }; return @rest unless defined $args; return @rest unless ref $args eq 'HASH'; - return @rest unless exists $args->{ 'no' . $argfield }; + return @rest unless exists $args->{ 'no_' . $argfield }; return (); }; { @@ -106,16 +106,59 @@ sub _if_git_versions { return @{$else}; } +sub _params_list { + return ( + qw( :version auto_prereqs_skip git_versions twitter_only release_fail no_cpan no_git no_twitter twitter_hash_tags twitter_extra_hash_tags ), + ( map { 'version_' . $_ } qw( major minor ), ( map { 'rel_' . $_ } qw( year month day hour time_zone ) ) ), + qw( relea0se_fail ) + ); +} + +sub _param_checker { + my $_self = shift; + + my %params_hash = map { $_ => 1 } $_self->_params_list; + + return sub { + + my ( $self, $param ) = @_; + if ( not exists $params_hash{$param} ) { + require Carp; + Carp::croak("[Author::KENTNL] Parameter $param doesn't appear to be supported"); + } + + }; +} + + +sub mvp_multivalue_args { return qw( auto_prereqs_skip ) } + sub bundle_config { my ( $self, $section ) = @_; my $class = ( ref $self ) || $self; - my $arg = $section->{payload}; + my $arg = $section->{payload}; + my $twitter_conf = { hash_tags => _defined_or( $arg, twitter_hash_tags => '#perl #cpan' ) }; - my $extra_hash = _defined_or( $arg, twitter_extra_hash_tags => q{}, 1 ); + my $extra_hash = _defined_or( $arg, twitter_extra_hash_tags => q{}, 1 ); $twitter_conf->{hash_tags} .= q{ } . $extra_hash if $extra_hash; my $warn_no_git = _if_git_versions( $arg, [1], [0] ); + my $checker = $self->_param_checker; + + for my $param ( keys %{$arg} ) { + $checker->( $self, $param ); + } + + if ( not defined $arg->{auto_prereqs_skip} ) { + $arg->{auto_prereqs_skip} = []; + } + + if ( not ref $arg->{auto_prereqs_skip} eq 'ARRAY' ) { + require Carp; + Carp::carp('[Author::KENTNL] auto_prereqs_skip is expected to be an array ref'); + } + my @config = map { _expand( $class, $_->[0], $_->[1] ) } ( [ _if_git_versions( @@ -148,7 +191,7 @@ sub bundle_config { [ 'ReadmeFromPod' => {} ], [ 'ManifestSkip' => {} ], [ 'Manifest' => {} ], - [ 'AutoPrereqs' => { skip => [ _defined_or( $arg , auto_prereqs_skip => qw{}, 1 )] } ], + [ 'AutoPrereqs' => { skip => $arg->{auto_prereqs_skip} } ], [ 'Prereqs' => { -name => 'BundleDevelNeeds', @@ -222,7 +265,7 @@ Dist::Zilla::PluginBundle::Author::KENTNL - BeLike::KENTNL when you build your d =head1 VERSION -version 1.0.13 +version 1.0.14 =head1 SYNOPSIS @@ -305,6 +348,8 @@ same as twitter_only=1 same as release_fail=1 +=for Pod::Coverage mvp_multivalue_args + =head1 AUTHOR Kent Fredric diff --git a/t/000-report-versions-tiny.t b/t/000-report-versions-tiny.t index 18ca4d38..0732a4d5 100644 --- a/t/000-report-versions-tiny.t +++ b/t/000-report-versions-tiny.t @@ -103,6 +103,7 @@ eval { $v .= pmver('File::Temp','any version') }; eval { $v .= pmver('File::pushd','any version') }; eval { $v .= pmver('FindBin','any version') }; eval { $v .= pmver('IO::Socket::SSL','any version') }; +eval { $v .= pmver('JSON','any version') }; eval { $v .= pmver('LWP::Protocol::https','6.00') }; eval { $v .= pmver('Module::Build','0.3601') }; eval { $v .= pmver('Moose','1.01') }; diff --git a/t/01-Minter.t b/t/01-Minter.t index fd146290..f15bf358 100644 --- a/t/01-Minter.t +++ b/t/01-Minter.t @@ -6,6 +6,7 @@ use Test::More; use FindBin; use Path::Class qw( dir ); use Test::Output qw(); +use JSON qw( from_json ); my ( $root, $corpus, $global ); @@ -15,7 +16,7 @@ BEGIN { $global = $corpus->subdir('global'); } -$ENV{'GIT_AUTHOR_NAME'} = $ENV{'GIT_COMMITTER_NAME'} = 'Anon Y. Mus'; +$ENV{'GIT_AUTHOR_NAME'} = $ENV{'GIT_COMMITTER_NAME'} = 'Anon Y. Mus'; $ENV{'GIT_AUTHOR_EMAIL'} = $ENV{'GIT_COMMITTER_EMAIL'} = 'anonymus@example.org'; use Test::File::ShareDir 0.3.0 -share => @@ -24,10 +25,10 @@ use Test::DZil; my $tzil; - subtest 'mint files' => sub { - $tzil = Minter->_new_from_profile( [ 'Author::KENTNL' => 'default' ], { name => 'DZT-Minty', }, { global_config_root => $global }, ); + $tzil = + Minter->_new_from_profile( [ 'Author::KENTNL' => 'default' ], { name => 'DZT-Minty', }, { global_config_root => $global }, ); pass('Loaded minter config'); @@ -84,6 +85,56 @@ subtest 'build minting' => sub { pass("Got minted dir"); + subtest 'Mangle minted dist.ini for experimental purposes' => sub { + + my $old = $tmpdir->file('dist.ini'); + my $new = $tmpdir->file('dist.ini.new'); + my $distini = $old->openr(); + my $newdistini = $new->openw(); + + while ( defined( my $line = <$distini> ) ) { + print $newdistini $line; + if ( $line =~ /auto_prereqs_skip/ ) { + note "Found skip line: ", explain( { line => $line } ); + pass "Found skip line: $."; + print $newdistini "auto_prereqs_skip = Bogus\n"; + print $newdistini "auto_prereqs_skip = OtherBogus\n"; + } + } + + close $distini; + close $newdistini; + + $old->remove(); + + rename "$new", "$old" or fail("Can't rename $new to $old"); + + }; + + subtest 'Create fake pm with deps to be ignored' => sub { + + my $fn = $tmpdir->subdir('lib')->subdir('DZT')->file('Mintiniator.pm'); + my $fh = $fn->openw(); + + print $fh <<'EOF'; +use strict; +use warnings; +package DZT::Mintiniator; + +# ABSTRACT: Test package to test auto prerequisites skip behaviour + +if(0){ # Stop it actually failing + require Bogus; + require OtherBogus; + require SomethingReallyWanted; +} + +1; +EOF + + pass('Generated file'); + }; + my $bzil = Builder->from_config( { dist_root => $tmpdir }, {}, { global_config_root => $global }, ); pass("Loaded builder configuration"); @@ -111,17 +162,20 @@ subtest 'build minting' => sub { }; } ); - if ( defined $exception ) { - note explain $@; + note explain { 'output was' => { out => $stdout, err => $stderr } }; + + if ( defined $exception ) { + note explain $exception; + # system("urxvt -e bash"); # XXX DEVELOPMENT die $@; } - note explain { 'output was' => { out => $stdout, err => $stderr } }; # system("find",$bzil->tempdir ); my %expected_files = map { $_ => 1 } qw( lib/DZT/Minty.pm + lib/DZT/Mintiniator.pm weaver.ini perlcritic.rc Changes @@ -146,10 +200,12 @@ subtest 'build minting' => sub { ); my %got_files; + my %got_files_refs; for my $file ( @{ $bzil->files } ) { my $name = $file->name; $got_files{$name} = 0 if not exists $got_files{$name}; $got_files{$name} += 1; + $got_files_refs{$name} = $file; } note explain { got => \%got_files, expected => \%expected_files }; @@ -158,7 +214,38 @@ subtest 'build minting' => sub { is_deeply( \%got_files, \%expected_files, 'All expected mint files exist' ); + my $data = from_json( dir( $bzil->tempdir )->subdir('build')->file('META.json')->slurp() ); + + note explain $data; + + is_deeply( + $data->{prereqs}, + { + build => { requires => { 'Module::Build' => '0.3601' }, }, + configure => { requires => { 'Module::Build' => '0.3601' }, }, + develop => { + recommends => { 'Dist::Zilla::PluginBundle::Author::KENTNL::Lite' => '0.01009803' }, + requires => { 'Dist::Zilla::PluginBundle::Author::KENTNL::Lite' => 0 }, + suggests => { 'Dist::Zilla::PluginBundle::Author::KENTNL' => 'v1.0.0' }, + }, + runtime => { + requires => { + 'Moose' => 0, + 'SomethingReallyWanted' => 0, + }, + }, + test => { + requires => { + 'English' => 0, + 'File::Find' => 0, + 'File::Temp' => 0, + 'Test::More' => '0.88', + }, + } + }, + 'Autodetected pre-reqs are sane' + ); + }; done_testing; -