line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::InlineModule; |
2
|
|
|
|
|
|
|
our $VERSION = '0.07'; |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
1478
|
use Inline::Module(); |
|
1
|
|
|
|
|
2331
|
|
|
1
|
|
|
|
|
16
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
200
|
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
|
|
|
|
|
|
|
has bundle => ( |
35
|
|
|
|
|
|
|
is => 'ro', |
36
|
|
|
|
|
|
|
default => sub { 1 }, |
37
|
|
|
|
|
|
|
); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub _build_stub { |
40
|
|
|
|
|
|
|
my ($self) = @_; |
41
|
|
|
|
|
|
|
return [ map "${_}::Inline", @{$self->module} ]; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# Lets us pass the options more than once: |
45
|
|
|
|
|
|
|
sub mvp_multivalue_args { qw(module stub ilsm) } |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# Add lines to use Inline::Module to Makefile.PL |
48
|
|
|
|
|
|
|
around _build_header => sub { |
49
|
|
|
|
|
|
|
return <<'...'; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
use lib 'inc'; |
52
|
|
|
|
|
|
|
use Inline::Module; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
... |
55
|
|
|
|
|
|
|
}; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
# Add list of modules to the postamble arguments. |
58
|
|
|
|
|
|
|
around _build_WriteMakefile_args => sub { |
59
|
|
|
|
|
|
|
my $orig = shift; |
60
|
|
|
|
|
|
|
my $self = shift; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
my $make_args = $self->$orig(@_); |
63
|
|
|
|
|
|
|
$self->{inline_meta} = |
64
|
|
|
|
|
|
|
$make_args->{postamble}{inline} = { |
65
|
|
|
|
|
|
|
module => $self->module, |
66
|
|
|
|
|
|
|
stub => $self->stub, |
67
|
|
|
|
|
|
|
ilsm => $self->ilsm, |
68
|
|
|
|
|
|
|
bundle => $self->bundle, |
69
|
|
|
|
|
|
|
}; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
return $make_args; |
72
|
|
|
|
|
|
|
}; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub after_build { |
75
|
|
|
|
|
|
|
my ($self, $hash) = @_; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
my $meta = $self->{inline_meta}; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
my $files_added = Inline::Module->add_to_distdir( |
80
|
|
|
|
|
|
|
$hash->{build_root}->stringify, |
81
|
|
|
|
|
|
|
$meta->{stub}, |
82
|
|
|
|
|
|
|
Inline::Module->included_modules($meta), |
83
|
|
|
|
|
|
|
); |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
# The following will make sure that Dist::Zilla knows about the written |
86
|
|
|
|
|
|
|
# files so that it can add them to the tarball. |
87
|
|
|
|
|
|
|
$self->add_file( Dist::Zilla::File::OnDisk->new( name => $_ ) ) |
88
|
|
|
|
|
|
|
for @$files_added; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
1; |