| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Module::Setup::Test::Utils; |
|
2
|
46
|
|
|
46
|
|
30169
|
use strict; |
|
|
46
|
|
|
|
|
87
|
|
|
|
46
|
|
|
|
|
1771
|
|
|
3
|
46
|
|
|
46
|
|
247
|
use warnings; |
|
|
46
|
|
|
|
|
75
|
|
|
|
46
|
|
|
|
|
1475
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
46
|
|
|
46
|
|
105969
|
use File::Temp; |
|
|
46
|
|
|
|
|
2005791
|
|
|
|
46
|
|
|
|
|
5312
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
46
|
|
|
46
|
|
31031
|
use Module::Setup; |
|
|
46
|
|
|
|
|
929
|
|
|
|
46
|
|
|
|
|
5257
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# chdir HOME to avoid "Cannot remove current directory" warning |
|
10
|
46
|
|
|
46
|
|
2038
|
END{ chdir } |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
my $stdout = []; |
|
13
|
34
|
|
|
34
|
1
|
240
|
sub stdout { $stdout } |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub import { |
|
16
|
47
|
|
|
47
|
|
461
|
my $class = shift; |
|
17
|
47
|
|
|
|
|
171
|
my $caller = caller; |
|
18
|
47
|
|
|
|
|
151
|
my %args = @_; |
|
19
|
|
|
|
|
|
|
|
|
20
|
47
|
|
|
|
|
167
|
for my $func (qw/ context module_setup stdout dialog default_dialog setup_dir target_dir clear_tempdir flavors_dir template_dir additional_dir additional_config_file plugins_dir config_file /) { |
|
21
|
46
|
|
|
46
|
|
449
|
no strict 'refs'; |
|
|
46
|
|
|
|
|
111
|
|
|
|
46
|
|
|
|
|
4274
|
|
|
22
|
658
|
|
|
|
|
721
|
*{"$caller\::$func"} = \&{ $func }; |
|
|
658
|
|
|
|
|
2926
|
|
|
|
658
|
|
|
|
|
1192
|
|
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
|
|
25
|
47
|
|
|
|
|
764
|
strict->import; |
|
26
|
47
|
|
|
|
|
518
|
warnings->import; |
|
27
|
|
|
|
|
|
|
|
|
28
|
47
|
100
|
|
|
|
631
|
unless ($args{without_stdout}) { |
|
29
|
46
|
|
|
46
|
|
270
|
no warnings 'redefine'; |
|
|
46
|
|
|
|
|
94
|
|
|
|
46
|
|
|
|
|
27515
|
|
|
30
|
46
|
|
|
10
|
|
2090
|
*Module::Setup::stdout = sub { push @{ $stdout }, $_[1] }; |
|
|
10
|
|
|
|
|
28
|
|
|
|
10
|
|
|
|
|
191
|
|
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub _path_dir (@) { |
|
35
|
345
|
|
|
345
|
|
3423
|
Module::Setup::Path::Dir->new(@_); |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
my $setup_dir; |
|
38
|
|
|
|
|
|
|
sub setup_dir (@) { |
|
39
|
188
|
100
|
|
188
|
1
|
6558
|
$setup_dir = File::Temp->newdir unless $setup_dir; |
|
40
|
188
|
|
|
|
|
41067
|
_path_dir($setup_dir, @_); |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
sub flavors_dir { |
|
43
|
71
|
|
|
71
|
1
|
205
|
setup_dir('flavors', @_); |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
sub template_dir { |
|
46
|
11
|
|
|
11
|
1
|
3004
|
my $flavor = shift; |
|
47
|
11
|
|
|
|
|
40
|
flavors_dir($flavor, 'template', @_); |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
sub additional_dir { |
|
50
|
42
|
|
|
42
|
1
|
2543
|
my $flavor = shift; |
|
51
|
42
|
|
|
|
|
133
|
flavors_dir($flavor, 'additional', @_); |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
sub additional_config_file { |
|
54
|
15
|
|
|
15
|
1
|
209
|
my $flavor = shift; |
|
55
|
15
|
|
|
|
|
48
|
additional_dir($flavor)->file('config.yaml'); |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
sub plugins_dir { |
|
58
|
5
|
|
|
5
|
1
|
21
|
my $flavor = shift; |
|
59
|
5
|
|
|
|
|
25
|
flavors_dir($flavor, 'plugins', @_); |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
sub config_file { |
|
62
|
9
|
|
|
9
|
1
|
2787
|
my $flavor = shift; |
|
63
|
9
|
|
|
|
|
28
|
flavors_dir($flavor)->file('config.yaml'); |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
my $target_dir; |
|
67
|
|
|
|
|
|
|
sub target_dir (@) { |
|
68
|
157
|
100
|
|
157
|
1
|
4578
|
$target_dir = File::Temp->newdir unless $target_dir; |
|
69
|
157
|
|
|
|
|
21488
|
_path_dir($target_dir, @_); |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub clear_tempdir { |
|
73
|
16
|
|
|
16
|
1
|
151
|
$setup_dir = undef; |
|
74
|
16
|
|
|
|
|
120
|
$target_dir = undef; |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
my $context; |
|
78
|
19
|
|
|
19
|
1
|
2681
|
sub context { $context } |
|
79
|
|
|
|
|
|
|
sub module_setup ($@) { |
|
80
|
95
|
|
|
95
|
1
|
20853
|
$stdout = []; |
|
81
|
95
|
|
|
|
|
4653
|
my($options, @argv) = @_; |
|
82
|
95
|
100
|
|
|
|
473
|
@argv = @{ $argv[0] } if ref $argv[0] eq 'ARRAY'; |
|
|
10
|
|
|
|
|
37
|
|
|
83
|
|
|
|
|
|
|
|
|
84
|
95
|
100
|
|
|
|
678
|
$options->{module_setup_dir} = setup_dir unless $options->{module_setup_dir}; |
|
85
|
95
|
100
|
|
|
|
27280
|
if ($options->{target}) { |
|
86
|
53
|
|
|
|
|
220
|
$options->{target} = target_dir; |
|
87
|
|
|
|
|
|
|
} |
|
88
|
|
|
|
|
|
|
|
|
89
|
95
|
|
|
|
|
4450
|
$context = Module::Setup->new( |
|
90
|
|
|
|
|
|
|
options => $options, |
|
91
|
|
|
|
|
|
|
argv => \@argv, |
|
92
|
|
|
|
|
|
|
); |
|
93
|
95
|
|
|
|
|
856
|
$context->run; |
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub dialog (;&) { |
|
97
|
35
|
|
|
35
|
1
|
14928
|
my $code = shift; |
|
98
|
46
|
|
|
46
|
|
4137
|
no warnings 'redefine'; |
|
|
46
|
|
|
|
|
121
|
|
|
|
46
|
|
|
|
|
13841
|
|
|
99
|
35
|
|
|
|
|
258
|
*Module::Setup::dialog = $code; |
|
100
|
|
|
|
|
|
|
} |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub default_dialog { |
|
103
|
|
|
|
|
|
|
dialog { |
|
104
|
139
|
|
|
139
|
|
485
|
my($self, $msg, $default) = @_; |
|
105
|
139
|
100
|
|
|
|
785
|
return 'n' if $msg =~ /Check Makefile.PL\?/i; |
|
106
|
120
|
100
|
|
|
|
358
|
return 'n' if $msg =~ /Subversion friendly\?/i; |
|
107
|
119
|
|
|
|
|
766
|
return $default; |
|
108
|
16
|
|
|
16
|
1
|
232
|
}; |
|
109
|
|
|
|
|
|
|
} |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
1; |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 NAME |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Module::Setup::Test::Utils - Test utils |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 METHODS |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head2 module_setup |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head2 context |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head2 stdout |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head2 clear_tempdir |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head2 dialog |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head2 default_dialog |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head2 target_dir |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head2 setup_dir |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head2 flavors_dir |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head2 template_dir |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head2 plugins_dir |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head2 config_file |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=head2 additional_dir |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head2 additional_config_file |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=cut |