line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Presto::CommandFactory; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:MPERRY'; |
3
|
|
|
|
|
|
|
$App::Presto::CommandFactory::VERSION = '0.010'; |
4
|
|
|
|
|
|
|
# ABSTRACT: Responsible for installing all commands |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
12710
|
use Moo; |
|
1
|
|
|
|
|
8693
|
|
|
1
|
|
|
|
|
4
|
|
7
|
1
|
|
|
1
|
|
1925
|
use Module::Pluggable require => 1, sub_name => 'commands', search_path => ['App::Presto::Command']; |
|
1
|
|
|
|
|
5957
|
|
|
1
|
|
|
|
|
5
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub install_commands { |
10
|
1
|
|
|
1
|
0
|
1243
|
my $self = shift; |
11
|
1
|
|
|
|
|
1
|
my $ctx = shift; |
12
|
1
|
|
|
|
|
2
|
foreach my $command_module($self->commands){ |
13
|
1
|
|
|
|
|
8
|
my $command = $command_module->new( context => $ctx ); |
14
|
1
|
|
|
|
|
40
|
$command->install; |
15
|
|
|
|
|
|
|
} |
16
|
1
|
|
|
|
|
194
|
return; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub help_categories { |
20
|
2
|
|
|
2
|
0
|
758
|
my $self = shift; |
21
|
2
|
|
|
|
|
2
|
my %categories; |
22
|
2
|
|
|
|
|
5
|
foreach my $command_module($self->commands){ |
23
|
2
|
100
|
|
|
|
13
|
if($command_module->does('App::Presto::CommandHasHelp') ){ |
24
|
1
|
|
|
|
|
38
|
(my $short_module = $command_module) =~ s/^.*::Command:://; |
25
|
1
|
|
|
|
|
2
|
$short_module =~ s/::/-/g; |
26
|
1
|
|
|
|
|
2
|
$categories{$short_module} = $command_module->help_categories; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
2
|
|
|
|
|
25
|
return \%categories; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
__END__ |