line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Presto::CommandFactory; |
2
|
|
|
|
|
|
|
BEGIN { |
3
|
1
|
|
|
1
|
|
53344
|
$App::Presto::CommandFactory::AUTHORITY = 'cpan:BPHILLIPS'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
{ |
6
|
|
|
|
|
|
|
$App::Presto::CommandFactory::VERSION = '0.009'; |
7
|
|
|
|
|
|
|
} |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: Responsible for installing all commands |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
1347
|
use Moo; |
|
1
|
|
|
|
|
65551
|
|
|
1
|
|
|
|
|
10
|
|
12
|
1
|
|
|
1
|
|
8703
|
use Module::Pluggable require => 1, sub_name => 'commands', search_path => ['App::Presto::Command']; |
|
1
|
|
|
|
|
26699
|
|
|
1
|
|
|
|
|
10
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub install_commands { |
15
|
1
|
|
|
1
|
0
|
3347
|
my $self = shift; |
16
|
1
|
|
|
|
|
4
|
my $ctx = shift; |
17
|
1
|
|
|
|
|
5
|
foreach my $command_module($self->commands){ |
18
|
1
|
|
|
|
|
15
|
my $command = $command_module->new( context => $ctx ); |
19
|
1
|
|
|
|
|
72
|
$command->install; |
20
|
|
|
|
|
|
|
} |
21
|
1
|
|
|
|
|
570
|
return; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub help_categories { |
25
|
2
|
|
|
2
|
0
|
1680
|
my $self = shift; |
26
|
2
|
|
|
|
|
4
|
my %categories; |
27
|
2
|
|
|
|
|
8
|
foreach my $command_module($self->commands){ |
28
|
2
|
100
|
|
|
|
23
|
if($command_module->does('App::Presto::CommandHasHelp') ){ |
29
|
1
|
|
|
|
|
52
|
(my $short_module = $command_module) =~ s/^.*::Command:://; |
30
|
1
|
|
|
|
|
4
|
$short_module =~ s/::/-/g; |
31
|
1
|
|
|
|
|
4
|
$categories{$short_module} = $command_module->help_categories; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
2
|
|
|
|
|
33
|
return \%categories; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
__END__ |