blob: e2cda0a9ca3294ff3e846e782e10685236213978 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
package inc::ExtractInlineTests;
use Moose;
with 'Dist::Zilla::Role::FileGatherer';
use File::Find::Rule;
use inc::MyInline;
use Test::Inline;
sub gather_files {
my $self = shift;
my $arg = shift;
my $inline = Test::Inline->new(
verbose => 0,
ExtractHandler => 'My::Extract',
ContentHandler => 'My::Content',
OutputHandler => My::Output->new($self),
);
for my $pod (
File::Find::Rule->file->name(qr/\.pod$/)->in('lib/Moose/Cookbook') ) {
$inline->add($pod);
}
$inline->save;
}
{
package My::Output;
sub new {
my $class = shift;
my $dzil = shift;
return bless { dzil => $dzil }, $class;
}
sub write {
my $self = shift;
my $name = shift;
my $content = shift;
$name =~ s/^moose_cookbook_//;
$self->{dzil}->add_file(
Dist::Zilla::File::InMemory->new(
name => "t/recipes/$name",
content => $content,
)
);
return 1;
}
}
1;
|