File Coverage

Makefile.PL
Criterion Covered Total %
statement 7 74 9.4
branch 0 48 0.0
condition 0 12 0.0
subroutine 3 8 37.5
pod n/a
total 10 142 7.0


line stmt bran cond sub pod time code
1             # -*- mode: perl; c-basic-offset: 4; indent-tabs-mode: nil; -*-
2              
3 1     1   987 use strict;
  1         2  
  1         30  
4 1     1   663 use ExtUtils::MakeMaker qw(WriteMakefile);
  1         101686  
  1         1077  
5             # See lib/ExtUtils/MakeMaker.pm for details of how to influence
6             # the contents of the Makefile that is written.
7              
8             # Normalize version strings like 6.30_02 to 6.3002,
9             # so that we can do numerical comparisons on it.
10             my $eumm_version = $ExtUtils::MakeMaker::VERSION;
11             $eumm_version =~ s/_//;
12              
13             my $module = 'GitHub::RSS';
14             (my $main_file = "lib/$module.pm" ) =~ s!::!/!g;
15             (my $distbase = $module) =~ s!::!-!g;
16             my $distlink = $distbase;
17              
18             my @tests = map { glob $_ } 't/*.t', 't/*/*.t';
19              
20             my %module = (
21             NAME => $module,
22             AUTHOR => q{Max Maischein <corion@cpan.org>},
23             VERSION_FROM => $main_file,
24             ABSTRACT_FROM => $main_file,
25             META_MERGE => {
26             "meta-spec" => { version => 2 },
27             resources => {
28             repository => {
29             web => "https://github.com/Corion/$distlink",
30             url => "git://github.com/Corion/$distlink.git",
31             type => 'git',
32             },
33             bugtracker => "https://rt.cpan.org/Public/Dist/Display.html?Name=$distbase",
34             license => "https://dev.perl.org/licenses/",
35             },
36             dynamic_config => 0, # we promise to keep META.* up-to-date
37             x_static_install => 1, # we are pure Perl and don't do anything fancy
38             },
39              
40             MIN_PERL_VERSION => '5.010', # I use // in some places
41              
42             'LICENSE'=> 'perl',
43              
44             PL_FILES => {},
45             BUILD_REQUIRES => {
46             'ExtUtils::MakeMaker' => 0,
47             },
48              
49             PREREQ_PM => {
50             'Data::Dumper' => 0,
51             'Filter::signatures' => '0.09',
52             'Carp' => 0,
53             'PerlX::Maybe' => 0,
54             'Moo' => 2,
55             'Net::GitHub' => 0,
56             'DBD::SQLite' => 0,
57             'JSON' => 0,
58             'XML::RSS' => 0,
59             'XML::Feed' => 0,
60             'Text::Markdown' => 0,
61             'HTML::Entities' => 0, # because we (re)render some markdown ourselves
62             'DateTime' => 0,
63             'DateTime::Format::ISO8601' => 0,
64             },
65             TEST_REQUIRES => {
66             },
67              
68             dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
69             clean => { FILES => "$distbase-*" },
70              
71             test => { TESTS => join( ' ', @tests ) },
72             );
73              
74             # This is so that we can do
75             # require 'Makefile.PL'
76             # and then call get_module_info
77              
78 1     1   11  
79             if( ! caller ) {
80             # I should maybe use something like Shipwright...
81             regen_README($main_file);
82             regen_EXAMPLES() if -d 'examples';
83             WriteMakefile1(get_module_info);
84             };
85              
86             1;
87              
88             my %params=@_;
89             my $eumm_version=$ExtUtils::MakeMaker::VERSION;
90 0     0     $eumm_version=eval $eumm_version;
91 0           die "EXTRA_META is deprecated" if exists $params{EXTRA_META};
92 0           die "License not specified" if not exists $params{LICENSE};
93 0 0         if ($params{BUILD_REQUIRES} and $eumm_version < 6.5503) {
94 0 0         #EUMM 6.5502 has problems with BUILD_REQUIRES
95 0 0 0       $params{PREREQ_PM}={ %{$params{PREREQ_PM} || {}} , %{$params{BUILD_REQUIRES}} };
96             delete $params{BUILD_REQUIRES};
97 0 0         }
  0            
  0            
98 0           if ($params{TEST_REQUIRES} and $eumm_version < 6.64) {
99             $params{PREREQ_PM}={ %{$params{PREREQ_PM} || {}} , %{$params{TEST_REQUIRES}} };
100 0 0 0       delete $params{TEST_REQUIRES};
101 0 0         }
  0            
  0            
102 0           delete $params{CONFIGURE_REQUIRES} if $eumm_version < 6.52;
103             delete $params{MIN_PERL_VERSION} if $eumm_version < 6.48;
104 0 0         delete $params{META_MERGE} if $eumm_version < 6.46;
105 0 0         delete $params{META_ADD} if $eumm_version < 6.46;
106 0 0         delete $params{LICENSE} if $eumm_version < 6.31;
107 0 0         delete $params{AUTHOR} if $] < 5.005;
108 0 0         delete $params{ABSTRACT_FROM} if $] < 5.005;
109 0 0         delete $params{BINARY_LOCATION} if $] < 5.005;
110 0 0          
111 0 0         WriteMakefile(%params);
112             }
113 0            
114             # README is the short version that just tells people what this is
115             # and how to install it
116             eval {
117             # Get description
118             my $readme = join "\n",
119 0     0     pod_section($_[0], 'NAME', 'no heading' ),
120             pod_section($_[0], 'DESCRIPTION' ),
121 0           <<INSTALL,
122              
123             INSTALLATION
124              
125             This is a Perl module distribution. It should be installed with whichever
126             tool you use to manage your installation of Perl, e.g. any of
127              
128             cpanm .
129             cpan .
130             cpanp -i .
131              
132             Consult https://www.cpan.org/modules/INSTALL.html for further instruction.
133             Should you wish to install this module manually, the procedure is
134              
135             perl Makefile.PL
136             make
137             make test
138             make install
139              
140             INSTALL
141             pod_section($_[0], 'REPOSITORY'),
142             pod_section($_[0], 'SUPPORT'),
143             pod_section($_[0], 'TALKS'),
144             pod_section($_[0], 'KNOWN ISSUES'),
145             pod_section($_[0], 'BUG TRACKER'),
146             pod_section($_[0], 'CONTRIBUTING'),
147             pod_section($_[0], 'SEE ALSO'),
148             pod_section($_[0], 'AUTHOR'),
149             pod_section($_[0], 'LICENSE' ),
150             pod_section($_[0], 'COPYRIGHT' ),
151             ;
152             update_file( 'README', $readme );
153             };
154             # README.mkdn is the documentation that will be shown as the main
155 0           # page of the repository on Github. Hence we recreate the POD here
156             # as Markdown
157             eval {
158             require Pod::Markdown;
159              
160 0           my $parser = Pod::Markdown->new();
161 0            
162             # Read POD from Module.pm and write to README
163 0           $parser->parse_from_file($_[0]);
164             my $readme_mkdn = <<STATUS . $parser->as_markdown;
165              
166 0           [![Travis Build Status](https://travis-ci.org/Corion/$distlink.svg?branch=master)](https://travis-ci.org/Corion/$distlink)
167 0           [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/Corion/$distlink?branch=master&svg=true)](https://ci.appveyor.com/project/Corion/$distlink)
168              
169             STATUS
170             update_file( 'README.mkdn', $readme_mkdn );
171             };
172             }
173 0            
174             my( $filename, $section, $remove_heading ) = @_;
175             open my $fh, '<', $filename
176             or die "Couldn't read '$filename': $!";
177              
178 0     0     my @section =
179 0 0         grep { /^=head1\s+$section/.../^=/ } <$fh>;
180              
181             # Trim the section
182             if( @section ) {
183 0           pop @section if $section[-1] =~ /^=/;
  0            
184             shift @section if $remove_heading;
185              
186 0 0         pop @section
187 0 0         while @section and $section[-1] =~ /^\s*$/;
188 0 0         shift @section
189             while @section and $section[0] =~ /^\s*$/;
190             };
191 0   0        
192             @section = map { $_ =~ s!^=\w+\s+!!; $_ } @section;
193 0   0       return join "", @section;
194             }
195              
196 0           my $perl = $^X;
  0            
  0            
197 0           if ($perl =~/\s/) {
198             $perl = qq{"$perl"};
199             };
200             (my $example_file = $main_file) =~ s!\.pm$!/Examples.pm!;
201 0     0     my $examples = `$perl -w examples/gen_examples_pod.pl`;
202 0 0         if ($examples) {
203 0           warn "(Re)Creating $example_file\n";
204             $examples =~ s/\r\n/\n/g;
205 0           update_file( $example_file, $examples );
206 0           };
207 0 0         };
208 0            
209 0           my( $filename, $new_content ) = @_;
210 0           my $content;
211             if( -f $filename ) {
212             open my $fh, '<', $filename
213             or die "Couldn't read '$filename': $!";
214             binmode $fh;
215 0     0     local $/;
216 0           $content = <$fh>;
217 0 0         };
218 0 0          
219             if( $content ne $new_content ) {
220 0           if( open my $fh, '>', $filename ) {
221 0           binmode $fh;
222 0           print $fh $new_content;
223             } else {
224             warn "Couldn't (re)write '$filename': $!";
225 0 0         };
226 0 0         };
227 0           }