line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
107
|
|
|
107
|
|
4950750
|
use 5.010001; |
|
107
|
|
|
|
|
634
|
|
2
|
107
|
|
|
107
|
|
645
|
use strict; |
|
107
|
|
|
|
|
259
|
|
|
107
|
|
|
|
|
2882
|
|
3
|
107
|
|
|
107
|
|
642
|
use warnings; |
|
107
|
|
|
|
|
280
|
|
|
107
|
|
|
|
|
5767
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
use Mite::Miteception -all; |
6
|
107
|
|
|
107
|
|
1851
|
|
|
107
|
|
|
|
|
284
|
|
|
107
|
|
|
|
|
1145
|
|
7
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
8
|
|
|
|
|
|
|
our $VERSION = '0.011000'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has mite_dir_name => |
11
|
|
|
|
|
|
|
is => ro, |
12
|
|
|
|
|
|
|
isa => Str, |
13
|
|
|
|
|
|
|
default => '.mite'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has mite_dir => |
16
|
|
|
|
|
|
|
is => ro, |
17
|
|
|
|
|
|
|
isa => Path, |
18
|
|
|
|
|
|
|
coerce => true, |
19
|
|
|
|
|
|
|
lazy => true, |
20
|
|
|
|
|
|
|
default => sub { |
21
|
|
|
|
|
|
|
my $self = shift; |
22
|
|
|
|
|
|
|
return $self->find_mite_dir || |
23
|
|
|
|
|
|
|
croak "No @{[$self->mite_dir_name]} directory found.\n"; |
24
|
|
|
|
|
|
|
}; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
has config_file => |
27
|
|
|
|
|
|
|
is => ro, |
28
|
|
|
|
|
|
|
isa => Path, |
29
|
|
|
|
|
|
|
coerce => true, |
30
|
|
|
|
|
|
|
lazy => true, |
31
|
|
|
|
|
|
|
default => sub { |
32
|
|
|
|
|
|
|
my $self = shift; |
33
|
|
|
|
|
|
|
return $self->mite_dir->child("config"); |
34
|
|
|
|
|
|
|
}; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
has data => |
37
|
|
|
|
|
|
|
is => rw, |
38
|
|
|
|
|
|
|
isa => HashRef, |
39
|
|
|
|
|
|
|
lazy => true, |
40
|
|
|
|
|
|
|
default => sub { |
41
|
|
|
|
|
|
|
my $self = shift; |
42
|
|
|
|
|
|
|
return $self->yaml_load( $self->config_file->slurp_utf8 ); |
43
|
|
|
|
|
|
|
}; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
has search_for_mite_dir => |
46
|
|
|
|
|
|
|
is => rw, |
47
|
|
|
|
|
|
|
isa => Bool, |
48
|
|
|
|
|
|
|
default => true; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
my ( $self, $dir ) = ( shift, @_ ); |
51
|
|
|
|
|
|
|
$dir //= Path::Tiny->cwd; |
52
|
13
|
|
|
13
|
0
|
5337
|
|
53
|
13
|
|
66
|
|
|
275
|
return Path::Tiny::path($dir)->child($self->mite_dir_name)->mkpath; |
54
|
|
|
|
|
|
|
} |
55
|
13
|
|
|
|
|
1126
|
|
56
|
|
|
|
|
|
|
my ( $self, $data ) = ( shift, @_ ); |
57
|
|
|
|
|
|
|
$data //= $self->data; |
58
|
|
|
|
|
|
|
|
59
|
10
|
|
|
10
|
0
|
499
|
$self->config_file->spew_utf8( $self->yaml_dump( $data ) ); |
60
|
10
|
|
66
|
|
|
61
|
return; |
61
|
|
|
|
|
|
|
} |
62
|
10
|
|
|
|
|
72
|
|
63
|
10
|
|
|
|
|
81377
|
my ( $self, $dir ) = ( shift, @_ ); |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
my $maybe_mite = Path::Tiny::path($dir)->child($self->mite_dir_name); |
66
|
|
|
|
|
|
|
return $maybe_mite if -d $maybe_mite; |
67
|
3286
|
|
|
3286
|
0
|
6491
|
return; |
68
|
|
|
|
|
|
|
} |
69
|
3286
|
|
|
|
|
8083
|
|
70
|
3286
|
100
|
|
|
|
176303
|
my ( $self, $current ) = ( shift, @_ ); |
71
|
3265
|
|
|
|
|
53740
|
$current //= Path::Tiny->cwd; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
do { |
74
|
|
|
|
|
|
|
my $maybe_mite = $self->dir_has_mite($current); |
75
|
840
|
|
|
840
|
0
|
5730
|
return $maybe_mite if $maybe_mite; |
76
|
840
|
|
66
|
|
|
7277
|
|
77
|
|
|
|
|
|
|
$current = $current->parent; |
78
|
840
|
|
100
|
|
|
54157
|
} while $self->search_for_mite_dir && !$current->is_rootdir; |
79
|
3285
|
|
|
|
|
57727
|
|
80
|
3285
|
100
|
|
|
|
7533
|
return; |
81
|
|
|
|
|
|
|
} |
82
|
3264
|
|
|
|
|
11925
|
|
83
|
|
|
|
|
|
|
my $self = shift; |
84
|
|
|
|
|
|
|
$self->data->{perltidy} && eval { require Perl::Tidy; 1 }; |
85
|
819
|
|
|
|
|
19867
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
my ( $class, $yaml ) = ( shift, @_ ); |
88
|
|
|
|
|
|
|
|
89
|
88
|
|
|
88
|
0
|
239
|
require YAML::XS; |
90
|
88
|
50
|
|
|
|
355
|
return YAML::XS::Load($yaml); |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
my ( $class, $data ) = ( shift, @_ ); |
94
|
9
|
|
|
9
|
0
|
10931
|
|
95
|
|
|
|
|
|
|
require YAML::XS; |
96
|
9
|
|
|
|
|
2907
|
return YAML::XS::Dump($data); |
97
|
9
|
|
|
|
|
23036
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
1; |