Expand tests, showing regex finder is broken
[catagits/CatalystX-HelpText.git] / lib / CatalystX / HelpText / Finder / TemplateToolkit.pm
1 package CatalystX::HelpText::Finder::TemplateToolkit;
2 use Moose;
3 use List::MoreUtils qw/ uniq /;
4 use MooseX::Types::Moose qw/Str/;
5 use Template;
6 use namespace::autoclean;
7
8 has template_search_dir => (
9     isa => Str,
10     is => 'ro',
11     required => 1,
12 );
13
14 sub find_helptext_keys_in_fn {
15     my ($self, $fn) = @_;
16     my @keys = ();
17     my $t = Template->new({
18         INCLUDE_PATH => [ $self->template_search_dir ],
19         ABSOLUTE => 1,
20     });
21     my $out;
22     $t->process($fn, { help_text => sub { push @keys, shift } }, \$out);
23     return [ uniq @keys ];
24 }
25
26 __PACKAGE__->meta->make_immutable;
27 1;
28