line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::PPPort; |
2
|
|
|
|
|
|
|
$Dist::Zilla::Plugin::PPPort::VERSION = '0.009'; |
3
|
|
|
|
|
|
|
# vi:noet:sts=2:sw=2:ts=2 |
4
|
1
|
|
|
1
|
|
3546038
|
use Moose; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
9
|
|
5
|
|
|
|
|
|
|
with qw/Dist::Zilla::Role::FileGatherer Dist::Zilla::Role::PrereqSource Dist::Zilla::Role::AfterBuild Dist::Zilla::Role::FilePruner/; |
6
|
1
|
|
|
1
|
|
7770
|
use Moose::Util::TypeConstraints 'enum'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
11
|
|
7
|
1
|
|
|
1
|
|
531
|
use MooseX::Types::Moose 'Int'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
13
|
|
8
|
1
|
|
|
1
|
|
5533
|
use MooseX::Types::Perl qw(StrictVersionStr); |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
7
|
|
9
|
1
|
|
|
1
|
|
3248
|
use MooseX::Types::Stringlike 'Stringlike'; |
|
1
|
|
|
|
|
50100
|
|
|
1
|
|
|
|
|
11
|
|
10
|
1
|
|
|
1
|
|
4418
|
use Devel::PPPort 3.23; |
|
1
|
|
|
|
|
579
|
|
|
1
|
|
|
|
|
41
|
|
11
|
1
|
|
|
1
|
|
7
|
use File::Spec::Functions 'catdir'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
75
|
|
12
|
1
|
|
|
1
|
|
6
|
use File::pushd 'pushd'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
739
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has style => ( |
15
|
|
|
|
|
|
|
is => 'ro', |
16
|
|
|
|
|
|
|
isa => enum(['MakeMaker', 'ModuleBuild']), |
17
|
|
|
|
|
|
|
default => 'MakeMaker', |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has filename => ( |
21
|
|
|
|
|
|
|
is => 'ro', |
22
|
|
|
|
|
|
|
isa => Stringlike, |
23
|
|
|
|
|
|
|
lazy => 1, |
24
|
|
|
|
|
|
|
coerce => 1, |
25
|
|
|
|
|
|
|
default => sub { |
26
|
|
|
|
|
|
|
my $self = shift; |
27
|
|
|
|
|
|
|
if ($self->style eq 'MakeMaker') { |
28
|
|
|
|
|
|
|
return 'ppport.h'; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
elsif ($self->style eq 'ModuleBuild') { |
31
|
|
|
|
|
|
|
my @module_parts = split /-/, $self->zilla->name; |
32
|
|
|
|
|
|
|
return catdir('lib', @module_parts[0 .. $#module_parts - 1], 'ppport.h'); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
else { |
35
|
|
|
|
|
|
|
confess 'Invalid style for XS file generation'; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
has version => ( |
41
|
|
|
|
|
|
|
is => 'ro', |
42
|
|
|
|
|
|
|
isa => StrictVersionStr, |
43
|
|
|
|
|
|
|
default => '3.23', |
44
|
|
|
|
|
|
|
); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
has override => ( |
47
|
|
|
|
|
|
|
is => 'ro', |
48
|
|
|
|
|
|
|
isa => Int, |
49
|
|
|
|
|
|
|
default => 0, |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub gather_files { |
53
|
2
|
|
|
2
|
0
|
162129
|
my $self = shift; |
54
|
2
|
|
|
|
|
79
|
Devel::PPPort->VERSION($self->version); |
55
|
2
|
|
|
|
|
708
|
require Dist::Zilla::File::InMemory; |
56
|
2
|
|
|
|
|
107423
|
$self->add_file(Dist::Zilla::File::InMemory->new( |
57
|
|
|
|
|
|
|
name => $self->filename, |
58
|
|
|
|
|
|
|
content => Devel::PPPort::GetFileContents($self->filename), |
59
|
|
|
|
|
|
|
encoding => 'ascii', |
60
|
|
|
|
|
|
|
)); |
61
|
2
|
|
|
|
|
6066
|
return; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub after_build { |
65
|
2
|
|
|
2
|
0
|
64678
|
my ($self, $args) = @_; |
66
|
2
|
|
|
|
|
8
|
my $build_root = $args->{build_root}; |
67
|
|
|
|
|
|
|
|
68
|
2
|
|
|
|
|
15
|
my $wd = pushd $build_root; |
69
|
|
|
|
|
|
|
|
70
|
2
|
|
|
|
|
425
|
my $filename = $self->filename; |
71
|
|
|
|
|
|
|
|
72
|
2
|
|
100
|
|
|
62
|
my $perl_prereq = $self->zilla->prereqs->cpan_meta_prereqs |
73
|
|
|
|
|
|
|
->merged_requirements([ qw(configure build runtime test) ], ['requires']) |
74
|
|
|
|
|
|
|
->requirements_for_module('perl') || '5.006'; |
75
|
|
|
|
|
|
|
|
76
|
2
|
50
|
|
|
|
1184
|
if ($self->logger->get_debug) { |
77
|
0
|
|
|
|
|
0
|
chomp(my $out = `$^X $filename --compat-version=$perl_prereq`); |
78
|
0
|
0
|
|
|
|
0
|
$self->log_debug($out) if $out; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
else { |
81
|
2
|
|
|
|
|
238128
|
chomp(my $out = `$^X $filename --compat-version=$perl_prereq --quiet`); |
82
|
2
|
50
|
|
|
|
225
|
$self->log_debug($out) if $out; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub register_prereqs { |
87
|
2
|
|
|
2
|
0
|
3856
|
my $self = shift; |
88
|
2
|
|
|
|
|
64
|
$self->zilla->register_prereqs({ phase => 'develop' }, 'Devel::PPPort' => $self->version); |
89
|
2
|
|
|
|
|
1733
|
return; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub prune_files { |
93
|
2
|
|
|
2
|
0
|
2432
|
my $self = shift; |
94
|
2
|
50
|
|
|
|
91
|
return unless $self->override; |
95
|
|
|
|
|
|
|
|
96
|
0
|
|
|
|
|
|
my @files = @{ $self->zilla->files }; |
|
0
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
|
my $filename = $self->filename; |
98
|
0
|
|
|
|
|
|
for my $file (@files) { |
99
|
0
|
0
|
|
|
|
|
if ($file->name eq $filename) { |
100
|
0
|
|
|
|
|
|
$self->zilla->prune_file($file); |
101
|
0
|
|
|
|
|
|
last; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
107
|
|
|
|
|
|
|
|
108
|
1
|
|
|
1
|
|
8
|
no Moose; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
12
|
|
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
1; |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
#ABSTRACT: PPPort for Dist::Zilla |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
__END__ |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=pod |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=encoding UTF-8 |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head1 NAME |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Dist::Zilla::Plugin::PPPort - PPPort for Dist::Zilla |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head1 VERSION |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
version 0.009 |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 SYNOPSIS |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
In your dist.ini |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
[PPPort] |
133
|
|
|
|
|
|
|
filename = ppport.h ;default |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head1 DESCRIPTION |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
This module adds a PPPort file to your distribution. By default it's called C<ppport.h>, but you can name differently. |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head2 style |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
This affects the default value for the C<filename> attribute. It must be either C<MakeMaker> or C<ModuleBuild>, the former being the default. |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=head2 filename |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
The filename of the ppport file. It defaults to F<ppport.h> if C<style> is C<MakeMaker>, and something module specific if C<style> is C<Module::Build>. |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head2 version |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
This describes the minimal version of Devel::PPPort required for this module. It currently defaults to C<3.23>. |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head2 override |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
If this is set to a positive value, the module will prune any preexisting $filename. |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=for Pod::Coverage gather_files |
158
|
|
|
|
|
|
|
register_prereqs |
159
|
|
|
|
|
|
|
after_build |
160
|
|
|
|
|
|
|
prune_files |
161
|
|
|
|
|
|
|
=end |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=head1 AUTHOR |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
Leon Timmermans <leont@cpan.org> |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
This software is copyright (c) 2011 by Leon Timmermans. |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
172
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=cut |