diff --git a/Build.PL b/Build.PL index 51390dc..d7497e7 100644 --- a/Build.PL +++ b/Build.PL @@ -7,16 +7,13 @@ use Module::Build 0.3601; my %module_build_args = ( 'build_requires' => { - 'Dist::Zilla::Tester' => '0', + 'Dist::Zilla::Util::Test::KENTNL' => '0.01000004', 'English' => '0', 'File::Find' => '0', 'File::Temp' => '0', 'Module::Build' => '0.3601', - 'Params::Util' => '0', - 'Sub::Exporter' => '0', 'Test::Fatal' => '0', - 'Test::More' => '0.88', - 'Try::Tiny' => '0' + 'Test::More' => '0.88' }, 'configure_requires' => { 'Module::Build' => '0.3601' @@ -26,15 +23,14 @@ my %module_build_args = ( 'Kent Fredric ' ], 'dist_name' => 'Dist-Zilla-Plugin-MetaProvides', - 'dist_version' => '1.11044405', + 'dist_version' => '1.12044518', 'license' => 'perl', 'module_name' => 'Dist::Zilla::Plugin::MetaProvides', 'recommends' => {}, 'recursive_test_files' => 1, 'requires' => { - 'Carp' => '0', 'Dist::Zilla::Role::MetaProvider' => '0', - 'Hash::Merge::Simple' => '0', + 'Dist::Zilla::Util::EmulatePhase' => '0.01000101', 'Moose' => '0', 'Moose::Role' => '0', 'MooseX::Types' => '0', diff --git a/Changes b/Changes index 6fa7f55..c6bc583 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,15 @@ Revision history for Dist-Zilla-Plugin-MetaProvides +1.12044518 2010-11-04 19:32:54 Pacific/Auckland + Spliced Test deps into its own module. + Shipped work behind _try_regen_metadata to Dist::Zilla::Util::EmulatePhase + meta_noindex is now *ON* by default. This behavioural change is reason for Bumping the minor to 12. + Rationale: + If you're using MetaNoIndex and this module, then you want things to get skipped. + With provides =>, cpan won't do any indexing itself, so no_index in the data does nothing. + So, this module brings that power back to life by implementing it manually. + Add thanks while I remember. + 1.11044405 2010-11-03 06:04:51 Pacific/Auckland Drop silly extra depends that sneaked in. It was hobbitses, and they are pesky. diff --git a/MANIFEST b/MANIFEST index 3c58c17..ddb0d88 100644 --- a/MANIFEST +++ b/MANIFEST @@ -18,7 +18,6 @@ t/000-report-versions-tiny.t t/01-MetaProvider-Provider.t t/author-critic.t t/lib/Dist/Zilla/Plugin/FakePlugin.pm -t/lib/TZil.pm t/release-distmeta.t t/release-eol.t t/release-kwalitee.t diff --git a/META.json b/META.json index 6600875..c4a2b82 100644 --- a/META.json +++ b/META.json @@ -37,9 +37,8 @@ }, "runtime" : { "requires" : { - "Carp" : 0, "Dist::Zilla::Role::MetaProvider" : 0, - "Hash::Merge::Simple" : 0, + "Dist::Zilla::Util::EmulatePhase" : "0.01000101", "Moose" : 0, "Moose::Role" : 0, "MooseX::Types" : 0, @@ -49,34 +48,31 @@ }, "test" : { "requires" : { - "Dist::Zilla::Tester" : 0, + "Dist::Zilla::Util::Test::KENTNL" : "0.01000004", "English" : 0, "File::Find" : 0, "File::Temp" : 0, - "Params::Util" : 0, - "Sub::Exporter" : 0, "Test::Fatal" : 0, - "Test::More" : "0.88", - "Try::Tiny" : 0 + "Test::More" : "0.88" } } }, "provides" : { "Dist::Zilla::MetaProvides::ProvideRecord" : { "file" : "lib/Dist/Zilla/MetaProvides/ProvideRecord.pm", - "version" : "1.11044405" + "version" : "1.12044518" }, "Dist::Zilla::MetaProvides::Types" : { "file" : "lib/Dist/Zilla/MetaProvides/Types.pm", - "version" : "1.11044405" + "version" : "1.12044518" }, "Dist::Zilla::Plugin::MetaProvides" : { "file" : "lib/Dist/Zilla/Plugin/MetaProvides.pm", - "version" : "1.11044405" + "version" : "1.12044518" }, "Dist::Zilla::Role::MetaProvider::Provider" : { "file" : "lib/Dist/Zilla/Role/MetaProvider/Provider.pm", - "version" : "1.11044405" + "version" : "1.12044518" } }, "release_status" : "stable", @@ -88,9 +84,25 @@ "web" : "http://github.com/kentfredric/dist-zilla-plugin-metaprovides/tree" } }, - "version" : "1.11044405", + "version" : "1.12044518", "x_BuiltWith" : { - "modules" : {}, + "modules" : { + "Dist::Zilla::PluginBundle::KENTNL" : "0.01017122", + "Dist::Zilla::PluginBundle::KENTNL::Lite" : "0.01000002", + "Dist::Zilla::Role::MetaProvider" : "4.102342", + "Dist::Zilla::Util::EmulatePhase" : "0.01000101", + "Dist::Zilla::Util::Test::KENTNL" : "0.01000011", + "File::Find" : "1.15", + "File::Temp" : "0.22", + "Module::Build" : "0.3607", + "Moose" : "1.17", + "Moose::Role" : "1.17", + "MooseX::Types" : "0.24", + "MooseX::Types::Moose" : "0.24", + "Test::Fatal" : "0.003", + "Test::More" : "0.96", + "namespace::autoclean" : "0.11" + }, "perl" : "5.012002", "platform" : "linux", "uname" : "Linux 2.6.36-gentoo x86_64 GenuineIntel GNU/Linux\n" @@ -103,7 +115,7 @@ "Dist::Zilla::Plugin::AutoVersion::Relative" : { "format" : "{{ sprintf('%d.%02d%04d%02d', $major, $minor, days, hours) }}", "major" : "1", - "minor" : "11", + "minor" : "12", "relative_to" : { "day" : "24", "hour" : "0", @@ -156,7 +168,7 @@ { "class" : "Dist::Zilla::Plugin::MetaProvides::Package", "name" : "@KENTNL/MetaProvides::Package", - "version" : "1.11034304" + "version" : "1.11044404" }, { "class" : "Dist::Zilla::Plugin::MetaJSON", @@ -245,7 +257,7 @@ } }, "name" : "@KENTNL/MetaData::BuiltWith", - "version" : "0.01005122" + "version" : "0.01014716" }, { "class" : "Dist::Zilla::Plugin::CompileTests", diff --git a/META.yml b/META.yml index 00b5b50..3ab7f27 100644 --- a/META.yml +++ b/META.yml @@ -3,16 +3,13 @@ abstract: "Generating and Populating 'provides' in your META.yml" author: - 'Kent Fredric ' build_requires: - Dist::Zilla::Tester: 0 + Dist::Zilla::Util::Test::KENTNL: 0.01000004 English: 0 File::Find: 0 File::Temp: 0 Module::Build: 0.3601 - Params::Util: 0 - Sub::Exporter: 0 Test::Fatal: 0 Test::More: 0.88 - Try::Tiny: 0 configure_requires: Module::Build: 0.3601 dynamic_config: 0 @@ -25,20 +22,19 @@ name: Dist-Zilla-Plugin-MetaProvides provides: Dist::Zilla::MetaProvides::ProvideRecord: file: lib/Dist/Zilla/MetaProvides/ProvideRecord.pm - version: 1.11044405 + version: 1.12044518 Dist::Zilla::MetaProvides::Types: file: lib/Dist/Zilla/MetaProvides/Types.pm - version: 1.11044405 + version: 1.12044518 Dist::Zilla::Plugin::MetaProvides: file: lib/Dist/Zilla/Plugin/MetaProvides.pm - version: 1.11044405 + version: 1.12044518 Dist::Zilla::Role::MetaProvider::Provider: file: lib/Dist/Zilla/Role/MetaProvider/Provider.pm - version: 1.11044405 + version: 1.12044518 requires: - Carp: 0 Dist::Zilla::Role::MetaProvider: 0 - Hash::Merge::Simple: 0 + Dist::Zilla::Util::EmulatePhase: 0.01000101 Moose: 0 Moose::Role: 0 MooseX::Types: 0 @@ -47,9 +43,24 @@ requires: resources: homepage: http://github.com/kentfredric/dist-zilla-plugin-metaprovides/tree repository: git://github.com/kentfredric/dist-zilla-plugin-metaprovides.git -version: 1.11044405 +version: 1.12044518 x_BuiltWith: - modules: {} + modules: + Dist::Zilla::PluginBundle::KENTNL: 0.01017122 + Dist::Zilla::PluginBundle::KENTNL::Lite: 0.01000002 + Dist::Zilla::Role::MetaProvider: 4.102342 + Dist::Zilla::Util::EmulatePhase: 0.01000101 + Dist::Zilla::Util::Test::KENTNL: 0.01000011 + File::Find: 1.15 + File::Temp: 0.22 + Module::Build: 0.3607 + Moose: 1.17 + Moose::Role: 1.17 + MooseX::Types: 0.24 + MooseX::Types::Moose: 0.24 + Test::Fatal: 0.003 + Test::More: 0.96 + namespace::autoclean: 0.11 perl: 5.012002 platform: linux uname: "Linux 2.6.36-gentoo x86_64 GenuineIntel GNU/Linux\n" @@ -61,7 +72,7 @@ x_Dist_Zilla: Dist::Zilla::Plugin::AutoVersion::Relative: format: "{{ sprintf('%d.%02d%04d%02d', $major, $minor, days, hours) }}" major: 1 - minor: 11 + minor: 12 relative_to: day: 24 hour: 0 @@ -103,7 +114,7 @@ x_Dist_Zilla: - class: Dist::Zilla::Plugin::MetaProvides::Package name: '@KENTNL/MetaProvides::Package' - version: 1.11034304 + version: 1.11044404 - class: Dist::Zilla::Plugin::MetaJSON name: '@KENTNL/MetaJSON' @@ -171,7 +182,7 @@ x_Dist_Zilla: - '-i' uname_call: uname name: '@KENTNL/MetaData::BuiltWith' - version: 0.01005122 + version: 0.01014716 - class: Dist::Zilla::Plugin::CompileTests name: '@KENTNL/CompileTests' diff --git a/README b/README index 3da4577..691a71b 100644 --- a/README +++ b/README @@ -3,7 +3,7 @@ NAME in your META.yml VERSION - version 1.11044405 + version 1.12044518 SYNOPSIS In your projects dist.ini diff --git a/dist.ini b/dist.ini index 82104af..9524e6f 100644 --- a/dist.ini +++ b/dist.ini @@ -8,7 +8,7 @@ main_module = lib/Dist/Zilla/Plugin/MetaProvides.pm [@KENTNL] version_major = 1 -version_minor = 11 +version_minor = 12 version_rel_year = 2009 version_rel_month = 8 version_rel_day = 24 diff --git a/lib/Dist/Zilla/MetaProvides/ProvideRecord.pm b/lib/Dist/Zilla/MetaProvides/ProvideRecord.pm index 8dc6e15..c74db4d 100644 --- a/lib/Dist/Zilla/MetaProvides/ProvideRecord.pm +++ b/lib/Dist/Zilla/MetaProvides/ProvideRecord.pm @@ -3,7 +3,7 @@ use warnings; package Dist::Zilla::MetaProvides::ProvideRecord; BEGIN { - $Dist::Zilla::MetaProvides::ProvideRecord::VERSION = '1.11044405'; + $Dist::Zilla::MetaProvides::ProvideRecord::VERSION = '1.12044518'; } # ABSTRACT: Data Management Record for MetaProvider::Provides Based Class @@ -49,7 +49,7 @@ Dist::Zilla::MetaProvides::ProvideRecord - Data Management Record for MetaProvid =head1 VERSION -version 1.11044405 +version 1.12044518 =head1 ATTRIBUTES diff --git a/lib/Dist/Zilla/MetaProvides/Types.pm b/lib/Dist/Zilla/MetaProvides/Types.pm index 7abe059..5188ca3 100644 --- a/lib/Dist/Zilla/MetaProvides/Types.pm +++ b/lib/Dist/Zilla/MetaProvides/Types.pm @@ -1,8 +1,9 @@ use strict; use warnings; + package Dist::Zilla::MetaProvides::Types; BEGIN { - $Dist::Zilla::MetaProvides::Types::VERSION = '1.11044405'; + $Dist::Zilla::MetaProvides::Types::VERSION = '1.12044518'; } # ABSTRACT: Utility Types for the MetaProvides Plugin @@ -31,7 +32,7 @@ Dist::Zilla::MetaProvides::Types - Utility Types for the MetaProvides Plugin =head1 VERSION -version 1.11044405 +version 1.12044518 =head1 SUBTYPES diff --git a/lib/Dist/Zilla/Plugin/MetaProvides.pm b/lib/Dist/Zilla/Plugin/MetaProvides.pm index 9c5ab7c..b0dba0a 100644 --- a/lib/Dist/Zilla/Plugin/MetaProvides.pm +++ b/lib/Dist/Zilla/Plugin/MetaProvides.pm @@ -1,8 +1,9 @@ use strict; use warnings; + package Dist::Zilla::Plugin::MetaProvides; BEGIN { - $Dist::Zilla::Plugin::MetaProvides::VERSION = '1.11044405'; + $Dist::Zilla::Plugin::MetaProvides::VERSION = '1.12044518'; } # ABSTRACT: Generating and Populating 'provides' in your META.yml @@ -19,7 +20,7 @@ Dist::Zilla::Plugin::MetaProvides - Generating and Populating 'provides' in your =head1 VERSION -version 1.11044405 +version 1.12044518 =head1 SYNOPSIS diff --git a/lib/Dist/Zilla/Role/MetaProvider/Provider.pm b/lib/Dist/Zilla/Role/MetaProvider/Provider.pm index 337d052..803695a 100644 --- a/lib/Dist/Zilla/Role/MetaProvider/Provider.pm +++ b/lib/Dist/Zilla/Role/MetaProvider/Provider.pm @@ -3,7 +3,7 @@ use warnings; package Dist::Zilla::Role::MetaProvider::Provider; BEGIN { - $Dist::Zilla::Role::MetaProvider::Provider::VERSION = '1.11044405'; + $Dist::Zilla::Role::MetaProvider::Provider::VERSION = '1.12044518'; } # ABSTRACT: A Role for Metadata providers specific to the 'provider' key. @@ -11,6 +11,7 @@ BEGIN { # $Id:$ use Moose::Role; use MooseX::Types::Moose (':all'); +use Dist::Zilla::Util::EmulatePhase 0.01000101 qw( get_metadata ); use namespace::autoclean; @@ -39,7 +40,7 @@ has inherit_missing => ( has meta_noindex => ( is => 'ro', isa => Bool, - default => 0, + default => 1, documentation => 'Scan for the meta_noindex metadata key and do not add provides records for things in it', ); @@ -56,32 +57,15 @@ sub _resolve_version { return ( 'version', $version ); } -sub _try_regen_metadata { - my ( $self ) = @_; - # This is a list of modules known to create the meta_noindex key. Re-call these by hand. - my @scanfor = qw( - MetaNoIndex - ); - # Collect the plugins that look like they work - my @discovered; - for my $plugin ( @{ $self->zilla->plugins_with('-MetaProvider') } ) { - for my $scan ( @scanfor ){ - push @discovered, $plugin if $plugin->isa( "Dist::Zilla::Plugin::${scan}" ); +sub _try_regen_metadata { + my ($self) = @_; + return get_metadata( + { + zilla => $self->zilla, + isa => [qw( =MetaNoIndex )] } - } - if ( not @discovered ){ - $self->log('No suitable plugins discovered'); - return {}; - } - $self->log(length @discovered . " plugins found"); - # emulate Dist::Zilla, aggregate, and return. - - my $meta = {}; - require Hash::Merge::Simple; - $meta = Hash::Merge::Simple::merge($meta, $_->metadata) - for @discovered; - return $meta; + ); } @@ -95,30 +79,32 @@ sub _apply_meta_noindex { my $meta = $self->_try_regen_metadata; - if ( not keys %$meta or not exists $meta->{no_index} ){ - require Carp; - Carp::carp("No no_index attribute found while trying to apply meta_noindex for" . $self->plugin_name); + if ( not keys %$meta or not exists $meta->{no_index} ) { + $self->log_debug( "No no_index attribute found while trying to apply meta_noindex for" . $self->plugin_name ); return @items; } + else { + $self->log_debug("no_index found in metadata, will apply rules"); + } my $noindex = $meta->{'no_index'}; - my ( $files, $dirs, $packages, $namespaces ) = ( [], [], [] , [] ); - $files = $noindex->{'file'} if exists $noindex->{'file'}; - $dirs = $noindex->{'dir'} if exists $noindex->{'dir'}; - $dirs = $noindex->{'directory'} if exists $noindex->{'directory'}; - $packages = $noindex->{'package'} if exists $noindex->{'package'}; - $namespaces = $noindex->{'namespace'} if exists $noindex->{'namespace'}; - - for my $file ( @$files ){ + my ( $files, $dirs, $packages, $namespaces ) = ( [], [], [], [] ); + $files = $noindex->{'file'} if exists $noindex->{'file'}; + $dirs = $noindex->{'dir'} if exists $noindex->{'dir'}; + $dirs = $noindex->{'directory'} if exists $noindex->{'directory'}; + $packages = $noindex->{'package'} if exists $noindex->{'package'}; + $namespaces = $noindex->{'namespace'} if exists $noindex->{'namespace'}; + + for my $file (@$files) { @items = grep { $_->file ne $file } @items; } - for my $module ( @$packages ){ + for my $module (@$packages) { @items = grep { $_->module ne $module } @items; } - for my $dir ( @$dirs ) { + for my $dir (@$dirs) { @items = grep { $_->file !~ qr{^\Q$dir\E($|/)} } @items; } - for my $namespace ( @$namespaces ){ + for my $namespace (@$namespaces) { @items = grep { $_->module !~ qr{^\Q$namespace\E($|::)} } @items; } return @items; @@ -148,7 +134,7 @@ Dist::Zilla::Role::MetaProvider::Provider - A Role for Metadata providers specif =head1 VERSION -version 1.11044405 +version 1.12044518 =head1 PERFORMS ROLES @@ -280,6 +266,15 @@ results returned from C<$self-Eprovides>. =back +=head1 THANKS + +=over 4 + +=item * Thanks to David Golden ( xdg / DAGOLDEN ) for the suggestion of the no_index feature +for compatibility with MetaNoIndex plugin. + +=back + =head1 AUTHOR Kent Fredric diff --git a/t/000-report-versions-tiny.t b/t/000-report-versions-tiny.t index 765773f..0d87854 100644 --- a/t/000-report-versions-tiny.t +++ b/t/000-report-versions-tiny.t @@ -48,25 +48,21 @@ sub pmver { return sprintf('%-40s => %-10s%-15s%s', $module, $pmver, $wanted, "\n"); } -eval { $v .= pmver('Carp','any version') }; eval { $v .= pmver('Dist::Zilla::PluginBundle::KENTNL','0.01017119') }; eval { $v .= pmver('Dist::Zilla::PluginBundle::KENTNL::Lite','0.01009803') }; eval { $v .= pmver('Dist::Zilla::Role::MetaProvider','any version') }; -eval { $v .= pmver('Dist::Zilla::Tester','any version') }; +eval { $v .= pmver('Dist::Zilla::Util::EmulatePhase','0.01000101') }; +eval { $v .= pmver('Dist::Zilla::Util::Test::KENTNL','0.01000004') }; eval { $v .= pmver('English','any version') }; eval { $v .= pmver('File::Find','any version') }; eval { $v .= pmver('File::Temp','any version') }; -eval { $v .= pmver('Hash::Merge::Simple','any version') }; eval { $v .= pmver('Module::Build','0.3601') }; eval { $v .= pmver('Moose','any version') }; eval { $v .= pmver('Moose::Role','any version') }; eval { $v .= pmver('MooseX::Types','any version') }; eval { $v .= pmver('MooseX::Types::Moose','any version') }; -eval { $v .= pmver('Params::Util','any version') }; -eval { $v .= pmver('Sub::Exporter','any version') }; eval { $v .= pmver('Test::Fatal','any version') }; eval { $v .= pmver('Test::More','0.88') }; -eval { $v .= pmver('Try::Tiny','any version') }; eval { $v .= pmver('namespace::autoclean','any version') }; diff --git a/t/01-MetaProvider-Provider.t b/t/01-MetaProvider-Provider.t index 44c150e..127dc27 100644 --- a/t/01-MetaProvider-Provider.t +++ b/t/01-MetaProvider-Provider.t @@ -7,7 +7,7 @@ use Test::Fatal; use lib 't/lib'; -use TZil; +use Dist::Zilla::Util::Test::KENTNL 0.01000004 qw( test_config ); sub make_plugin { my @args = @_; diff --git a/t/lib/TZil.pm b/t/lib/TZil.pm deleted file mode 100644 index 9e0660f..0000000 --- a/t/lib/TZil.pm +++ /dev/null @@ -1,136 +0,0 @@ -use strict; -use warnings; -package # NO PAUSE PLX - TZil; - -use Try::Tiny; -use Dist::Zilla::Tester qw( Builder ); -use Params::Util qw(_HASH0); - -use Sub::Exporter -setup => { - exports => [ - test_config => - simple_ini => \'_simple_ini', - ], - groups => [ default => [ qw( -all ) ] ] -}; - -sub test_config { - my ( $conf ) = shift; - my $args = []; - if ( $conf->{dist_root} ) { - $args->[0] = { dist_root => $conf->{dist_root} }; - } - if ( $conf->{ini} ){ - $args->[1] ||= {}; - $args->[1]->{add_files} ||= {}; - $args->[1]->{add_files}->{'source/dist.ini'} = _simple_ini()->( @{ $conf->{ini} } ); - } - my $build_error = undef; - my $instance; - try { - $instance = Builder->from_config( @$args ); - - if ( $conf->{build} ){ - $instance->build(); - } - } catch { - $build_error = $_; - }; - - if ( $conf->{post_build_callback} ) { - $conf->{post_build_callback}->({ - error => $build_error, - instance => $instance, - }); - } - - if ( $conf->{find_plugin} ){ - my $plugin = $instance->plugin_named( $conf->{find_plugin} ); - if ( $conf->{callback} ){ - my $error = undef; - my $method = $conf->{callback}->{method}; - my $args = $conf->{callback}->{args}; - my $call = $conf->{callback}->{code}; - my $response; - try { - $response = $instance->$method( @$args ); - } catch { - $error = $_; - }; - return $call->({ - error => $error, - response => $response, - instance => $instance, - }); - } else { - return $plugin; - } - } -} - -sub _build_ini_builder { - my ($starting_core) = @_; - $starting_core ||= {}; - - sub { - my (@arg) = @_; - my $new_core = _HASH0($arg[0]) ? shift(@arg) : {}; - - my $core_config = { %$starting_core, %$new_core }; - - my $config = ''; - - for my $key (keys %$core_config) { - my @values = ref $core_config->{ $key } - ? @{ $core_config->{ $key } } - : $core_config->{ $key }; - - $config .= "$key = $_\n" for grep {defined} @values; - } - - $config .= "\n" if length $config; - - for my $line (@arg) { - my @plugin = ref $line ? @$line : ($line, {}); - my $moniker = shift @plugin; - my $name = _HASH0($plugin[0]) ? undef : shift @plugin; - my $payload = shift(@plugin) || {}; - - die "TOO MANY ARGS TO PLUGIN GAHLGHALAGH" if @plugin; - - $config .= '[' . $moniker; - $config .= ' / ' . $name if defined $name; - $config .= "]\n"; - - for my $key (keys %$payload) { - my @values = ref $payload->{ $key } - ? @{ $payload->{ $key } } - : $payload->{ $key }; - - $config .= "$key = $_\n" for @values; - } - - $config .= "\n"; - } - - return $config; - } -} - -sub _dist_ini { - _build_ini_builder; -} - -sub _simple_ini { - _build_ini_builder({ - name => 'DZT-Sample', - abstract => 'Sample DZ Dist', - version => '0.001', - author => 'E. Xavier Ample ', - license => 'Perl_5', - copyright_holder => 'E. Xavier Ample', - }); -} - -1; \ No newline at end of file