From: Dave Rolsky <autarch@urth.org>
Date: Wed, 29 Dec 2010 15:27:53 +0000 (-0500)
Subject: Now that all the .pod files have a package statement, we only extract tests if we... 
X-Git-Tag: 1.9900~3^2~21
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=560acb8f063e78071eaa9b9bfc0ee03f8b997db5;p=gitmo%2FMoose.git

Now that all the .pod files have a package statement, we only extract tests if we find more than 2 elements to extract.

Also, tweak generated file name to be more concise.
---

diff --git a/inc/ExtractInlineTests.pm b/inc/ExtractInlineTests.pm
index 0bf6515..753ea22 100644
--- a/inc/ExtractInlineTests.pm
+++ b/inc/ExtractInlineTests.pm
@@ -82,7 +82,7 @@ sub gather_files {
 
         # If we have just one element it's a SYNOPSIS, so there's no
         # tests.
-        return unless @elements > 1;
+        return unless @elements > 2;
 
         if ( @elements && $self->{source} =~ /=head1 NAME\n\n(Moose::Cookbook\S+)/ ) {
             unshift @elements, 'package ' . $1 . ';';
@@ -123,6 +123,8 @@ sub gather_files {
         my $name    = shift;
         my $content = shift;
 
+        $name =~ s/^moose_cookbook_//;
+
         $self->{dzil}->add_file(
             Dist::Zilla::File::InMemory->new(
                 name    => "t/002_recipes/$name",