| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
16
|
|
|
16
|
|
40722561
|
use 5.010001; |
|
|
16
|
|
|
|
|
544
|
|
|
2
|
16
|
|
|
16
|
|
616
|
use strict; |
|
|
16
|
|
|
|
|
399
|
|
|
|
16
|
|
|
|
|
2427
|
|
|
3
|
16
|
|
|
16
|
|
576
|
use warnings; |
|
|
16
|
|
|
|
|
311
|
|
|
|
16
|
|
|
|
|
5424
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Mite::App; |
|
6
|
16
|
|
|
16
|
|
7141
|
use Mite::Miteception -all; |
|
|
16
|
|
|
|
|
119
|
|
|
|
16
|
|
|
|
|
663
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
|
9
|
|
|
|
|
|
|
our $VERSION = '0.012000'; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use Module::Pluggable |
|
12
|
|
|
|
|
|
|
search_path => [ 'Mite::App::Command' ], |
|
13
|
|
|
|
|
|
|
sub_name => '_plugins', |
|
14
|
|
|
|
|
|
|
require => true, |
|
15
|
|
|
|
|
|
|
inner => false, |
|
16
|
|
|
|
|
|
|
on_require_error => sub { |
|
17
|
80
|
|
|
|
|
119317
|
my ( $plugin, $err ) = @_; |
|
18
|
80
|
50
|
|
|
|
502
|
return if $plugin =~ /.mite$/; |
|
19
|
0
|
|
|
|
|
0
|
croak $err; |
|
20
|
16
|
|
|
16
|
|
9850
|
}; |
|
|
16
|
|
|
|
|
154972
|
|
|
|
16
|
|
|
|
|
274
|
|
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
has commands => ( |
|
23
|
|
|
|
|
|
|
is => ro, |
|
24
|
|
|
|
|
|
|
isa => HashRef[Object], |
|
25
|
|
|
|
|
|
|
default => \ '{}', |
|
26
|
|
|
|
|
|
|
); |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
has kingpin => ( |
|
29
|
|
|
|
|
|
|
is => lazy, |
|
30
|
|
|
|
|
|
|
isa => Object, |
|
31
|
|
|
|
|
|
|
handles => { |
|
32
|
|
|
|
|
|
|
_parse_argv => 'parse', |
|
33
|
|
|
|
|
|
|
}, |
|
34
|
|
|
|
|
|
|
); |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
has project => ( |
|
37
|
|
|
|
|
|
|
is => lazy, |
|
38
|
|
|
|
|
|
|
isa => MiteProject, |
|
39
|
|
|
|
|
|
|
handles => [ 'config' ], |
|
40
|
|
|
|
|
|
|
); |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub BUILD { |
|
43
|
16
|
|
|
16
|
0
|
49
|
my $self = shift; |
|
44
|
16
|
|
|
|
|
179
|
for my $plugin ( $self->_plugins ) { |
|
45
|
80
|
|
|
|
|
5967
|
$plugin->new( app => $self ); |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub _default_command { |
|
50
|
0
|
|
|
0
|
|
0
|
return 'compile'; |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub _build_kingpin { |
|
54
|
16
|
|
|
16
|
|
9729
|
require Getopt::Kingpin; |
|
55
|
|
|
|
|
|
|
|
|
56
|
16
|
|
|
|
|
320857
|
my $kingpin = Getopt::Kingpin->new; |
|
57
|
16
|
|
|
|
|
781
|
$kingpin->flags->get( 'help' )->short( 'h' ); |
|
58
|
16
|
|
|
|
|
19477
|
$kingpin->flag( 'verbose', 'Verbose mode.' )->short( 'v' )->bool; |
|
59
|
16
|
|
|
|
|
4317
|
$kingpin->flag( 'search-mite-dir', 'Only look for .mite/ in the current directory.' )->bool->default( true ); |
|
60
|
16
|
|
|
|
|
5789
|
$kingpin->flag( 'exit-if-no-mite-dir', 'Exit quietly if .mite/ cannot be found.' )->bool->default( false ); |
|
61
|
16
|
|
|
|
|
3991
|
$kingpin->flag( 'set', 'Set config option.' )->string_hash; |
|
62
|
|
|
|
|
|
|
|
|
63
|
16
|
|
|
|
|
15598
|
return $kingpin; |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub _build_project { |
|
67
|
14
|
|
|
14
|
|
4256
|
require Mite::Project; |
|
68
|
14
|
|
|
|
|
231
|
return Mite::Project->default; |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub get_flag_value { |
|
72
|
36
|
|
|
36
|
0
|
141
|
my ( $self, $flag ) = @_; |
|
73
|
36
|
|
|
|
|
163
|
my $got = $self->kingpin->flags->get( $flag ); |
|
74
|
36
|
100
|
|
|
|
2556
|
$got ? $got->value : undef; |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub run { |
|
78
|
16
|
|
|
16
|
0
|
217
|
my ( $class, $argv ) = @_; |
|
79
|
|
|
|
|
|
|
|
|
80
|
16
|
|
|
|
|
120
|
my $self = $class->new; |
|
81
|
16
|
|
50
|
|
|
136
|
my $parsed = $self->_parse_argv( $argv || [ @ARGV ] ); |
|
82
|
|
|
|
|
|
|
|
|
83
|
14
|
|
|
|
|
91928
|
$self->project->debug( $self->get_flag_value( 'verbose' ) ); |
|
84
|
14
|
|
|
|
|
108
|
$self->config->search_for_mite_dir( $self->get_flag_value( 'search-mite-dir' ) ); |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
{ |
|
87
|
14
|
|
|
|
|
50
|
my $set_flag = $self->kingpin->flags->get( 'set' ); |
|
|
14
|
|
|
|
|
91
|
|
|
88
|
14
|
50
|
|
|
|
847
|
my %set = %{ $set_flag->value || {} }; |
|
|
14
|
|
|
|
|
283
|
|
|
89
|
14
|
|
|
|
|
255
|
for my $opt ( keys %set ) { |
|
90
|
0
|
|
|
|
|
0
|
$self->config->data->{$opt} = $set{$opt}; |
|
91
|
|
|
|
|
|
|
} |
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
my $command = $parsed->isa( 'Getopt::Kingpin::Command' ) |
|
95
|
|
|
|
|
|
|
? $self->commands->{ $parsed->name } |
|
96
|
14
|
50
|
|
|
|
590
|
: $self->commands->{ $self->_default_command }; |
|
97
|
|
|
|
|
|
|
|
|
98
|
14
|
|
|
|
|
267
|
return $command->execute; |
|
99
|
|
|
|
|
|
|
} |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
1; |