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