summaryrefslogtreecommitdiff
path: root/author/extract-inline-tests
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2015-06-06 17:50:16 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2015-06-06 17:50:16 +0000
commit5ac2026f7eed78958d69d051e7a8e993dcf51205 (patch)
tree298c3d2f08bdfe5689998b11892d72a897985be1 /author/extract-inline-tests
downloadMoose-tarball-5ac2026f7eed78958d69d051e7a8e993dcf51205.tar.gz
Diffstat (limited to 'author/extract-inline-tests')
-rwxr-xr-xauthor/extract-inline-tests47
1 files changed, 47 insertions, 0 deletions
diff --git a/author/extract-inline-tests b/author/extract-inline-tests
new file mode 100755
index 0000000..aa90787
--- /dev/null
+++ b/author/extract-inline-tests
@@ -0,0 +1,47 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use File::Find::Rule;
+use Getopt::Long;
+use Test::Inline;
+
+use lib 'inc';
+use MyInline;
+
+my $quiet;
+GetOptions( 'quiet' => \$quiet );
+
+my $inline = Test::Inline->new(
+ verbose => !$quiet,
+ ExtractHandler => 'My::Extract',
+ ContentHandler => 'My::Content',
+ OutputHandler => 'My::Output',
+);
+
+for my $pod (
+ File::Find::Rule->file->name(qr/\.pod$/)->in('lib/Moose/Cookbook') ) {
+ $inline->add($pod);
+}
+
+$inline->save;
+
+{
+
+ package My::Output;
+
+ use Path::Tiny;
+
+ sub write {
+ my $class = shift;
+ my $name = shift;
+ my $content = shift;
+
+ $name =~ s/^moose_cookbook_//;
+
+ path( "t/recipes/$name" )->spew( $content );
+
+ return 1;
+ }
+}