line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
106
|
|
|
106
|
|
3870317
|
use 5.010001; |
|
106
|
|
|
|
|
395
|
|
2
|
106
|
|
|
106
|
|
616
|
use strict; |
|
106
|
|
|
|
|
236
|
|
|
106
|
|
|
|
|
2634
|
|
3
|
106
|
|
|
106
|
|
594
|
use warnings; |
|
106
|
|
|
|
|
223
|
|
|
106
|
|
|
|
|
5251
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
use Mite::Miteception -all; |
6
|
106
|
|
|
106
|
|
1825
|
|
|
106
|
|
|
|
|
247
|
|
|
106
|
|
|
|
|
938
|
|
7
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
8
|
|
|
|
|
|
|
our $VERSION = '0.010008'; |
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
|
4150
|
|
53
|
13
|
|
66
|
|
|
225
|
return Path::Tiny::path($dir)->child($self->mite_dir_name)->mkpath; |
54
|
|
|
|
|
|
|
} |
55
|
13
|
|
|
|
|
792
|
|
56
|
|
|
|
|
|
|
my ( $self, $data ) = ( shift, @_ ); |
57
|
|
|
|
|
|
|
$data //= $self->data; |
58
|
|
|
|
|
|
|
|
59
|
10
|
|
|
10
|
0
|
390
|
$self->config_file->spew_utf8( $self->yaml_dump( $data ) ); |
60
|
10
|
|
66
|
|
|
44
|
return; |
61
|
|
|
|
|
|
|
} |
62
|
10
|
|
|
|
|
40
|
|
63
|
10
|
|
|
|
|
17056
|
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
|
3434
|
|
|
3434
|
0
|
5623
|
return; |
68
|
|
|
|
|
|
|
} |
69
|
3434
|
|
|
|
|
6056
|
|
70
|
3434
|
100
|
|
|
|
137052
|
my ( $self, $current ) = ( shift, @_ ); |
71
|
3413
|
|
|
|
|
47137
|
$current //= Path::Tiny->cwd; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
do { |
74
|
|
|
|
|
|
|
my $maybe_mite = $self->dir_has_mite($current); |
75
|
877
|
|
|
877
|
0
|
4493
|
return $maybe_mite if $maybe_mite; |
76
|
877
|
|
66
|
|
|
6626
|
|
77
|
|
|
|
|
|
|
$current = $current->parent; |
78
|
877
|
|
100
|
|
|
44373
|
} while $self->search_for_mite_dir && !$current->is_rootdir; |
79
|
3433
|
|
|
|
|
50564
|
|
80
|
3433
|
100
|
|
|
|
6702
|
return; |
81
|
|
|
|
|
|
|
} |
82
|
3412
|
|
|
|
|
9607
|
|
83
|
|
|
|
|
|
|
my $self = shift; |
84
|
|
|
|
|
|
|
$self->data->{perltidy} && eval { require Perl::Tidy; 1 }; |
85
|
856
|
|
|
|
|
17472
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
my ( $class, $yaml ) = ( shift, @_ ); |
88
|
|
|
|
|
|
|
|
89
|
96
|
|
|
96
|
0
|
240
|
require YAML::XS; |
90
|
96
|
50
|
|
|
|
308
|
return YAML::XS::Load($yaml); |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
my ( $class, $data ) = ( shift, @_ ); |
94
|
9
|
|
|
9
|
0
|
9883
|
|
95
|
|
|
|
|
|
|
require YAML::XS; |
96
|
9
|
|
|
|
|
2450
|
return YAML::XS::Dump($data); |
97
|
9
|
|
|
|
|
19266
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
1; |