line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
16
|
|
|
16
|
|
38598928
|
use 5.010001; |
|
16
|
|
|
|
|
344
|
|
2
|
16
|
|
|
16
|
|
343
|
use strict; |
|
16
|
|
|
|
|
212
|
|
|
16
|
|
|
|
|
1621
|
|
3
|
16
|
|
|
16
|
|
289
|
use warnings; |
|
16
|
|
|
|
|
199
|
|
|
16
|
|
|
|
|
3282
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
use Mite::Miteception -all; |
6
|
16
|
|
|
16
|
|
4710
|
|
|
16
|
|
|
|
|
112
|
|
|
16
|
|
|
|
|
453
|
|
7
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
8
|
|
|
|
|
|
|
our $VERSION = '0.011000'; |
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
|
|
|
|
|
101237
|
return if $plugin =~ /.mite$/; |
18
|
80
|
50
|
|
|
|
519
|
croak $err; |
19
|
0
|
|
|
|
|
0
|
}; |
20
|
16
|
|
|
16
|
|
8821
|
|
|
16
|
|
|
|
|
142884
|
|
|
16
|
|
|
|
|
242
|
|
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
|
50
|
$plugin->new( app => $self ); |
44
|
16
|
|
|
|
|
118
|
} |
45
|
80
|
|
|
|
|
5333
|
} |
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
|
|
8343
|
$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
|
|
|
|
|
304089
|
$kingpin->flag( 'exit-if-no-mite-dir', 'Exit quietly if .mite/ cannot be found.' )->bool->default( false ); |
57
|
16
|
|
|
|
|
760
|
$kingpin->flag( 'set', 'Set config option.' )->string_hash; |
58
|
16
|
|
|
|
|
18448
|
|
59
|
16
|
|
|
|
|
3944
|
return $kingpin; |
60
|
16
|
|
|
|
|
5559
|
} |
61
|
16
|
|
|
|
|
3899
|
|
62
|
|
|
|
|
|
|
require Mite::Project; |
63
|
16
|
|
|
|
|
14932
|
return Mite::Project->default; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
my ( $self, $flag ) = @_; |
67
|
14
|
|
|
14
|
|
4131
|
my $got = $self->kingpin->flags->get( $flag ); |
68
|
14
|
|
|
|
|
238
|
$got ? $got->value : undef; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
my ( $class, $argv ) = @_; |
72
|
36
|
|
|
36
|
0
|
146
|
|
73
|
36
|
|
|
|
|
216
|
my $self = $class->new; |
74
|
36
|
100
|
|
|
|
2426
|
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
|
204
|
|
79
|
|
|
|
|
|
|
{ |
80
|
16
|
|
|
|
|
130
|
my $set_flag = $self->kingpin->flags->get( 'set' ); |
81
|
16
|
|
50
|
|
|
154
|
my %set = %{ $set_flag->value || {} }; |
82
|
|
|
|
|
|
|
for my $opt ( keys %set ) { |
83
|
14
|
|
|
|
|
86185
|
$self->config->data->{$opt} = $set{$opt}; |
84
|
14
|
|
|
|
|
102
|
} |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
14
|
|
|
|
|
48
|
my $command = $parsed->isa( 'Getopt::Kingpin::Command' ) |
|
14
|
|
|
|
|
64
|
|
88
|
14
|
50
|
|
|
|
722
|
? $self->commands->{ $parsed->name } |
|
14
|
|
|
|
|
265
|
|
89
|
14
|
|
|
|
|
206
|
: $self->commands->{ $self->_default_command }; |
90
|
0
|
|
|
|
|
0
|
|
91
|
|
|
|
|
|
|
return $command->execute; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
1; |