line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::InlineModule; |
2
|
|
|
|
|
|
|
our $VERSION = '0.04'; |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
1309
|
use Inline::Module(); |
|
1
|
|
|
|
|
2809
|
|
|
1
|
|
|
|
|
17
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
209
|
use Moose; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
extends 'Dist::Zilla::Plugin::MakeMaker::Awesome'; |
8
|
|
|
|
|
|
|
with qw(Dist::Zilla::Role::AfterBuild Dist::Zilla::Role::FileGatherer); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has module => ( |
11
|
|
|
|
|
|
|
is => 'ro', |
12
|
|
|
|
|
|
|
isa => 'ArrayRef[Str]', |
13
|
|
|
|
|
|
|
traits => ['Array'], |
14
|
|
|
|
|
|
|
required => 1, |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has stub => ( |
18
|
|
|
|
|
|
|
is => 'ro', |
19
|
|
|
|
|
|
|
lazy => 1, |
20
|
|
|
|
|
|
|
builder => '_build_stub', |
21
|
|
|
|
|
|
|
isa => 'ArrayRef[Str]', |
22
|
|
|
|
|
|
|
traits => ['Array'], |
23
|
|
|
|
|
|
|
required => 0, |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
has ilsm => ( |
27
|
|
|
|
|
|
|
is => 'ro', |
28
|
|
|
|
|
|
|
isa => 'ArrayRef[Str]', |
29
|
|
|
|
|
|
|
traits => ['Array'], |
30
|
|
|
|
|
|
|
required => 0, |
31
|
|
|
|
|
|
|
default => sub { ['Inline::C'] }, |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub _build_stub { |
35
|
|
|
|
|
|
|
my ($self) = @_; |
36
|
|
|
|
|
|
|
return [ map "${_}::Inline", @{$self->module} ]; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# Lets us pass the options more than once: |
40
|
|
|
|
|
|
|
sub mvp_multivalue_args { qw(module stub ilsm) } |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# Add lines to use Inline::Module to Makefile.PL |
43
|
|
|
|
|
|
|
around _build_header => sub { |
44
|
|
|
|
|
|
|
return <<'...'; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
use lib 'inc'; |
47
|
|
|
|
|
|
|
use Inline::Module; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
... |
50
|
|
|
|
|
|
|
}; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# Add list of modules to the postamble arguments. |
53
|
|
|
|
|
|
|
around _build_WriteMakefile_args => sub { |
54
|
|
|
|
|
|
|
my $orig = shift; |
55
|
|
|
|
|
|
|
my $self = shift; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
my $make_args = $self->$orig(@_); |
58
|
|
|
|
|
|
|
$self->{inline_meta} = |
59
|
|
|
|
|
|
|
$make_args->{postamble}{inline} = { |
60
|
|
|
|
|
|
|
module => $self->module, |
61
|
|
|
|
|
|
|
stub => $self->stub, |
62
|
|
|
|
|
|
|
ilsm => $self->ilsm, |
63
|
|
|
|
|
|
|
}; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
return $make_args; |
66
|
|
|
|
|
|
|
}; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub after_build { |
69
|
|
|
|
|
|
|
my ($self, $hash) = @_; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
my $meta = $self->{inline_meta}; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
my $files_added = Inline::Module->add_to_distdir( |
74
|
|
|
|
|
|
|
$hash->{build_root}->stringify, |
75
|
|
|
|
|
|
|
$meta->{stub}, |
76
|
|
|
|
|
|
|
Inline::Module->included_modules($meta), |
77
|
|
|
|
|
|
|
); |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
# The following will make sure that Dist::Zilla knows about the written |
80
|
|
|
|
|
|
|
# files so that it can add them to the tarball. |
81
|
|
|
|
|
|
|
$self->add_file( Dist::Zilla::File::OnDisk->new( name => $_ ) ) |
82
|
|
|
|
|
|
|
for @$files_added; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
1; |