line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Minilla::ModuleMaker::ModuleBuildTiny; |
2
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
31
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
34
|
|
4
|
1
|
|
|
1
|
|
6
|
use utf8; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
5
|
1
|
|
|
1
|
|
26
|
use Data::Section::Simple qw(get_data_section); |
|
1
|
|
|
|
|
12
|
|
|
1
|
|
|
|
|
59
|
|
6
|
1
|
|
|
1
|
|
7
|
use Text::MicroTemplate qw(render_mt); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
47
|
|
7
|
1
|
|
|
1
|
|
7
|
use Data::Dumper; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
51
|
|
8
|
1
|
|
|
1
|
|
7
|
use File::Spec::Functions qw(catdir rel2abs); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
46
|
|
9
|
1
|
|
|
1
|
|
6
|
use File::Find (); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
24
|
|
10
|
1
|
|
|
1
|
|
488
|
use TAP::Harness::Env; |
|
1
|
|
|
|
|
3656
|
|
|
1
|
|
|
|
|
36
|
|
11
|
1
|
|
|
1
|
|
7
|
use Cwd; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
58
|
|
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
6
|
use Moo; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
4
|
|
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
306
|
no Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3
|
|
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
249
|
use Minilla::Util qw(spew_raw); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
722
|
|
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__ |