line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::ModuleIncluder; |
2
|
|
|
|
|
|
|
$Dist::Zilla::Plugin::ModuleIncluder::VERSION = '0.007'; |
3
|
|
|
|
|
|
|
# vim: ts=4 sts=0 sw=0 noet |
4
|
4
|
|
|
4
|
|
7491782
|
use version; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
29
|
|
5
|
4
|
|
|
4
|
|
241
|
use Moose; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
21
|
|
6
|
4
|
|
|
4
|
|
18091
|
use MooseX::Types::Moose qw/ArrayRef Bool/; |
|
4
|
|
|
|
|
16
|
|
|
4
|
|
|
|
|
43
|
|
7
|
4
|
|
|
4
|
|
12611
|
use MooseX::Types::Perl 'VersionObject'; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
27
|
|
8
|
4
|
|
|
4
|
|
7633
|
use MooseX::Types::Stringlike 'Stringlike'; |
|
4
|
|
|
|
|
116549
|
|
|
4
|
|
|
|
|
1479
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
with qw/Dist::Zilla::Role::ModuleIncluder Dist::Zilla::Role::FileGatherer/; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
has module => ( |
13
|
|
|
|
|
|
|
isa => ArrayRef[Stringlike], |
14
|
|
|
|
|
|
|
traits => ['Array'], |
15
|
|
|
|
|
|
|
handles => { |
16
|
|
|
|
|
|
|
modules => 'elements', |
17
|
|
|
|
|
|
|
}, |
18
|
|
|
|
|
|
|
required => 1, |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
has blacklist => ( |
22
|
|
|
|
|
|
|
isa => ArrayRef[Stringlike], |
23
|
|
|
|
|
|
|
traits => ['Array'], |
24
|
|
|
|
|
|
|
handles => { |
25
|
|
|
|
|
|
|
blacklisted_modules => 'elements', |
26
|
|
|
|
|
|
|
}, |
27
|
|
|
|
|
|
|
default => sub { [] }, |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
has background_perl => ( |
31
|
|
|
|
|
|
|
is => 'ro', |
32
|
|
|
|
|
|
|
isa => VersionObject, |
33
|
|
|
|
|
|
|
default => sub { version->new('5.008001') }, |
34
|
|
|
|
|
|
|
coerce => 1, |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
has only_deps => ( |
38
|
|
|
|
|
|
|
is => 'ro', |
39
|
|
|
|
|
|
|
isa => Bool, |
40
|
|
|
|
|
|
|
default => 0, |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
around dump_config => sub |
44
|
|
|
|
|
|
|
{ |
45
|
|
|
|
|
|
|
my ($orig, $self) = @_; |
46
|
|
|
|
|
|
|
my $config = $self->$orig; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
my $data = { |
49
|
|
|
|
|
|
|
blessed($self) ne __PACKAGE__ ? ( version => __PACKAGE__->VERSION || '<self>' ) : (), |
50
|
|
|
|
|
|
|
module => [ $self->modules ], |
51
|
|
|
|
|
|
|
blacklist => [ $self->blacklisted_modules ], |
52
|
|
|
|
|
|
|
background_perl => $self->background_perl->stringify, |
53
|
|
|
|
|
|
|
only_deps => ($self->only_deps ? 1 : 0), |
54
|
|
|
|
|
|
|
}; |
55
|
|
|
|
|
|
|
$config->{+__PACKAGE__} = $data; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
return $config; |
58
|
|
|
|
|
|
|
}; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub gather_files { |
61
|
4
|
|
|
4
|
0
|
176428
|
my ($self, $arg) = @_; |
62
|
4
|
|
|
|
|
153
|
$self->include_modules({ map { ($_ => $self->only_deps ) } $self->modules }, $self->background_perl, { blacklist => [ $self->blacklisted_modules ] }); |
|
4
|
|
|
|
|
163
|
|
63
|
4
|
|
|
|
|
1634
|
return; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub mvp_multivalue_args { |
67
|
4
|
|
|
4
|
0
|
640
|
return qw/module blacklist/; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
71
|
|
|
|
|
|
|
|
72
|
4
|
|
|
4
|
|
5274
|
no Moose; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
25
|
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
1; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
#ABSTRACT: explicitly include modules into a distribution |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
__END__ |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=pod |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=encoding UTF-8 |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 NAME |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Dist::Zilla::Plugin::ModuleIncluder - explicitly include modules into a distribution |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 VERSION |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
version 0.007 |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 SYNOPSIS |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
In dist.ini: |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
[ModuleIncluder] |
97
|
|
|
|
|
|
|
module = Foo |
98
|
|
|
|
|
|
|
module = Bar |
99
|
|
|
|
|
|
|
background_perl = 5.008001 #default value |
100
|
|
|
|
|
|
|
only_deps = 0 #default |
101
|
|
|
|
|
|
|
include_dependencies = 1 #default |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 DESCRIPTION |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
This module allows you to explicitly include a module and its dependencies in C<inc/>. At least one module must be given. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=over 4 |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=item * module |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Add a module to be included. This option can be given more than once. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=item * background_perl |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Set the background perl version. If the (appropriate version of the) module was present in that release of perl, it will be omitted from C<inc>. It defaults to 5.8.1. |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=item * only_deps |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Do not include the specified modules, only their dependencies. Note that it still includes the module if something else depends on it. |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=item * blacklist |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
The name of a module to never include. This option can be given more than once. |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=back |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=for Pod::Coverage gather_files |
128
|
|
|
|
|
|
|
mvp_multivalue_args |
129
|
|
|
|
|
|
|
=end |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head1 AUTHOR |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Leon Timmermans <leont@cpan.org> |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
This software is copyright (c) 2011 by Leon Timmermans. |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
140
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=cut |