line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
16
|
|
|
16
|
|
71375364
|
use 5.010001; |
|
16
|
|
|
|
|
361
|
|
2
|
16
|
|
|
16
|
|
296
|
use strict; |
|
16
|
|
|
|
|
251
|
|
|
16
|
|
|
|
|
1691
|
|
3
|
16
|
|
|
16
|
|
356
|
use warnings; |
|
16
|
|
|
|
|
145
|
|
|
16
|
|
|
|
|
3763
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
use Mite::Miteception -all; |
6
|
16
|
|
|
16
|
|
5361
|
|
|
16
|
|
|
|
|
98
|
|
|
16
|
|
|
|
|
450
|
|
7
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
8
|
|
|
|
|
|
|
our $VERSION = '0.010008'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use Module::Pluggable |
11
|
|
|
|
|
|
|
search_path => [ 'Mite::App::Command' ], |
12
|
|
|
|
|
|
|
sub_name => '_plugins', |
13
|
|
|
|
|
|
|
require => true, |
14
|
|
|
|
|
|
|
inner => false, |
15
|
|
|
|
|
|
|
on_require_error => sub { |
16
|
|
|
|
|
|
|
my ( $plugin, $err ) = @_; |
17
|
80
|
|
|
|
|
83401
|
return if $plugin =~ /.mite$/; |
18
|
80
|
50
|
|
|
|
447
|
croak $err; |
19
|
0
|
|
|
|
|
0
|
}; |
20
|
16
|
|
|
16
|
|
7749
|
|
|
16
|
|
|
|
|
137636
|
|
|
16
|
|
|
|
|
448
|
|
21
|
|
|
|
|
|
|
has commands => ( |
22
|
|
|
|
|
|
|
is => ro, |
23
|
|
|
|
|
|
|
isa => HashRef[Object], |
24
|
|
|
|
|
|
|
default => \ '{}', |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
has kingpin => ( |
28
|
|
|
|
|
|
|
is => lazy, |
29
|
|
|
|
|
|
|
isa => Object, |
30
|
|
|
|
|
|
|
handles => { |
31
|
|
|
|
|
|
|
_parse_argv => 'parse', |
32
|
|
|
|
|
|
|
}, |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
has project => ( |
36
|
|
|
|
|
|
|
is => lazy, |
37
|
|
|
|
|
|
|
isa => MiteProject, |
38
|
|
|
|
|
|
|
handles => [ 'config' ], |
39
|
|
|
|
|
|
|
); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
my $self = shift; |
42
|
|
|
|
|
|
|
for my $plugin ( $self->_plugins ) { |
43
|
16
|
|
|
16
|
0
|
53
|
$plugin->new( app => $self ); |
44
|
16
|
|
|
|
|
168
|
} |
45
|
80
|
|
|
|
|
4692
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
return 'compile'; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
0
|
|
0
|
require Getopt::Kingpin; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
my $kingpin = Getopt::Kingpin->new; |
53
|
|
|
|
|
|
|
$kingpin->flags->get( 'help' )->short( 'h' ); |
54
|
16
|
|
|
16
|
|
7778
|
$kingpin->flag( 'verbose', 'Verbose mode.' )->short( 'v' )->bool; |
55
|
|
|
|
|
|
|
$kingpin->flag( 'search-mite-dir', 'Only look for .mite/ in the current directory.' )->bool->default( true ); |
56
|
16
|
|
|
|
|
265908
|
$kingpin->flag( 'exit-if-no-mite-dir', 'Exit quietly if .mite/ cannot be found.' )->bool->default( false ); |
57
|
16
|
|
|
|
|
641
|
$kingpin->flag( 'set', 'Set config option.' )->string_hash; |
58
|
16
|
|
|
|
|
18001
|
|
59
|
16
|
|
|
|
|
3370
|
return $kingpin; |
60
|
16
|
|
|
|
|
3232
|
} |
61
|
16
|
|
|
|
|
3081
|
|
62
|
|
|
|
|
|
|
require Mite::Project; |
63
|
16
|
|
|
|
|
13181
|
return Mite::Project->default; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
my ( $self, $flag ) = @_; |
67
|
14
|
|
|
14
|
|
3819
|
my $got = $self->kingpin->flags->get( $flag ); |
68
|
14
|
|
|
|
|
185
|
$got ? $got->value : undef; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
my ( $class, $argv ) = @_; |
72
|
36
|
|
|
36
|
0
|
109
|
|
73
|
36
|
|
|
|
|
142
|
my $self = $class->new; |
74
|
36
|
100
|
|
|
|
2014
|
my $parsed = $self->_parse_argv( $argv || [ @ARGV ] ); |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
$self->project->debug( $self->get_flag_value( 'verbose' ) ); |
77
|
|
|
|
|
|
|
$self->config->search_for_mite_dir( $self->get_flag_value( 'search-mite-dir' ) ); |
78
|
16
|
|
|
16
|
0
|
179
|
|
79
|
|
|
|
|
|
|
{ |
80
|
16
|
|
|
|
|
64
|
my $set_flag = $self->kingpin->flags->get( 'set' ); |
81
|
16
|
|
50
|
|
|
1469
|
my %set = %{ $set_flag->value || {} }; |
82
|
|
|
|
|
|
|
for my $opt ( keys %set ) { |
83
|
14
|
|
|
|
|
74863
|
$self->config->data->{$opt} = $set{$opt}; |
84
|
14
|
|
|
|
|
67
|
} |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
14
|
|
|
|
|
37
|
my $command = $parsed->isa( 'Getopt::Kingpin::Command' ) |
|
14
|
|
|
|
|
55
|
|
88
|
14
|
50
|
|
|
|
602
|
? $self->commands->{ $parsed->name } |
|
14
|
|
|
|
|
212
|
|
89
|
14
|
|
|
|
|
155
|
: $self->commands->{ $self->_default_command }; |
90
|
0
|
|
|
|
|
0
|
|
91
|
|
|
|
|
|
|
return $command->execute; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
1; |