line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Minilla::ModuleMaker::ModuleBuildTiny; |
2
|
1
|
|
|
1
|
|
22
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
23
|
|
4
|
1
|
|
|
1
|
|
4
|
use utf8; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
6
|
|
5
|
1
|
|
|
1
|
|
43
|
use Data::Section::Simple qw(get_data_section); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
65
|
|
6
|
1
|
|
|
1
|
|
6
|
use Text::MicroTemplate qw(render_mt); |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
59
|
|
7
|
1
|
|
|
1
|
|
10
|
use Data::Dumper; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
43
|
|
8
|
1
|
|
|
1
|
|
6
|
use File::Spec::Functions qw(catdir rel2abs); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
51
|
|
9
|
1
|
|
|
1
|
|
6
|
use File::Find (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
10
|
1
|
|
|
1
|
|
515
|
use TAP::Harness::Env; |
|
1
|
|
|
|
|
3745
|
|
|
1
|
|
|
|
|
33
|
|
11
|
1
|
|
|
1
|
|
7
|
use Cwd; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
75
|
|
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
6
|
use Moo; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
10
|
|
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
317
|
no Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
247
|
use Minilla::Util qw(spew_raw); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
746
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub generate { |
20
|
0
|
|
|
0
|
0
|
|
my ($self, $project) = @_; |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
|
local $Data::Dumper::Terse = 1; |
23
|
0
|
|
|
|
|
|
local $Data::Dumper::Useqq = 1; |
24
|
0
|
|
|
|
|
|
local $Data::Dumper::Purity = 1; |
25
|
0
|
|
|
|
|
|
local $Data::Dumper::Indent = 0; |
26
|
0
|
|
|
|
|
|
my $content = get_data_section('Build.PL'); |
27
|
0
|
|
|
0
|
|
|
my $mt = Text::MicroTemplate->new(template => $content, escape_func => sub { $_[0] }); |
|
0
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
my $src = $mt->build->($project); |
29
|
0
|
|
|
|
|
|
spew_raw('Build.PL', $src); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub validate { |
33
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
34
|
|
|
|
|
|
|
|
35
|
0
|
0
|
|
|
|
|
if (-d 'bin/') { |
36
|
0
|
|
|
|
|
|
warn "[ERROR] Module::Build::Tiny doesn't install bin/ directory. You should rename bin/ to script/\n"; |
37
|
0
|
|
|
|
|
|
return 0; |
38
|
|
|
|
|
|
|
} |
39
|
0
|
|
|
|
|
|
return 1; # Yes. It's valid project. |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub prereqs { |
43
|
0
|
|
|
0
|
0
|
|
my ($self, $project) = @_; |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
my %configure_requires = ( |
46
|
|
|
|
|
|
|
'Module::Build::Tiny' => '0.035', |
47
|
|
|
|
|
|
|
); |
48
|
0
|
0
|
|
|
|
|
if ( @{$project->requires_external_bin || []} ) { |
|
0
|
0
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
$configure_requires{'Devel::CheckBin'} = 0; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
my $prereqs = +{ |
53
|
|
|
|
|
|
|
configure => { |
54
|
|
|
|
|
|
|
requires => { |
55
|
|
|
|
|
|
|
%configure_requires, |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
}; |
59
|
|
|
|
|
|
|
|
60
|
0
|
|
|
|
|
|
for my $key (qw(tap_harness_args use_xsutil c_source allow_pureperl)) { |
61
|
0
|
0
|
|
|
|
|
if( $project->$key ){ |
62
|
0
|
|
|
|
|
|
die "$key does not supported by " . __PACKAGE__; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
} |
65
|
0
|
|
|
|
|
|
for my $key (qw(PL_files)) { |
66
|
0
|
0
|
0
|
|
|
|
if( $project->$key && ref($project->$key) eq 'HASH' && %{$project->$key} > 0 ){ |
|
0
|
|
0
|
|
|
|
|
67
|
0
|
|
|
|
|
|
die "$key does not supported by " . __PACKAGE__; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
} |
70
|
0
|
|
|
|
|
|
return $prereqs; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub run_tests { |
74
|
|
|
|
|
|
|
my $harness = TAP::Harness::Env->create({ |
75
|
|
|
|
|
|
|
verbosity => 0, |
76
|
0
|
|
|
0
|
0
|
|
lib => [ map { rel2abs(catdir(qw/blib/, $_), cwd) } qw/arch lib/ ], |
|
0
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
color => -t STDOUT |
78
|
|
|
|
|
|
|
}); |
79
|
0
|
|
|
|
|
|
my @tests = sort +_find(qr/\.t$/, 't'); |
80
|
0
|
0
|
|
|
|
|
if ($ENV{RELEASE_TESTING}) { |
81
|
0
|
|
|
|
|
|
push @tests, sort +_find(qr/\.t$/, 'xt'); |
82
|
|
|
|
|
|
|
} |
83
|
0
|
0
|
|
|
|
|
$harness->runtests(@tests)->has_errors and die; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub _find { |
87
|
0
|
|
|
0
|
|
|
my ($pattern, $dir) = @_; |
88
|
0
|
|
|
|
|
|
my @ret; |
89
|
0
|
0
|
0
|
0
|
|
|
File::Find::find(sub { push @ret, $File::Find::name if /$pattern/ && -f }, $dir) if -d $dir; |
|
0
|
0
|
|
|
|
|
|
90
|
0
|
|
|
|
|
|
return @ret; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
1; |
94
|
|
|
|
|
|
|
__DATA__ |