File Coverage

Makefile.PL
Criterion Covered Total %
statement 14 14 100.0
branch 1 2 50.0
condition n/a
subroutine 5 5 100.0
pod n/a
total 20 21 95.2


line stmt bran cond sub pod time code
1 1     1   238587 use strict;
  1         2  
  1         33  
2 1     1   5 use warnings;
  1         1  
  1         60  
3              
4 1     1   380 use ExtUtils::MM ();
  1         91550  
  1         54  
5 1     1   698 use File::Spec::Functions qw( catfile );
  1         628  
  1         411  
6              
7             my $git_base_url = 'https://codeberg.org/XSven';
8              
9             my $distname = 'Version-Semantic';
10             # Transitions: unstable => testing => stable
11             my $release_status = 'stable';
12             # PRE_RELEASE_NUMBER is set by CI/CD pipeline
13             my $pre_release_extension = $release_status eq 'stable' ? undef : 'TRIAL' . ( $ENV{ PRE_RELEASE_NUMBER } // 1 );
14              
15             my @main_module_namespace = split /-/, $distname;
16             my $main_module = join '::', @main_module_namespace;
17             my $main_module_file = catfile( 'lib', @main_module_namespace ) . '.pm';
18             my $main_module_podfile = catfile( 'lib', @main_module_namespace ) . '.pod';
19             # We are not using
20             # VERSION_FROM => $main_module_file
21             # because we have to set the main module version in META_MERGE/provides too
22             my $main_module_version = MM->parse_version( $main_module_file );
23              
24             my %att = (
25             NAME => $main_module,
26             AUTHOR => 'Sven Willenbuecher ',
27             VERSION => $main_module_version,
28             ABSTRACT_FROM => $main_module_podfile,
29             # Another valid license string is "restricted"
30             # https://metacpan.org/pod/CPAN::Meta::Spec#license
31             LICENSE => 'perl_5',
32             MIN_PERL_VERSION => '5.010000',
33             DISTNAME => $distname,
34             DISTVNAME => join( '-', $distname, $main_module_version, $pre_release_extension // () )
35             , # Related to the below release_status metadata field
36             EXE_FILES => [ glob( join( ' ', map { catfile( $_, '*' ) } qw( bin script ) ) ) ],
37             META_MERGE => {
38             'meta-spec' => { version => 2 },
39             release_status => $release_status,
40             provides => {
41             $main_module => {
42             file => $main_module_file,
43             version => $main_module_version
44             }
45             },
46             resources => {
47             repository => {
48             type => 'git',
49             url => "$git_base_url/$distname.git",
50             web => "$git_base_url/$distname"
51             },
52             bugtracker => {
53             web => "$git_base_url/$distname/issues"
54             }
55             }
56             },
57             # Check ExtUtils::MakeMaker Changes
58             NORECURS => 1,
59             NO_PERLLOCAL => 1,
60             clean => { FILES => "$distname*" },
61             dist => { TARFLAGS => 'cf', COMPRESS => 'gzip -9f', SUFFIX => 'gz' },
62             realclean => { FILES => 'cover_db local' },
63             test => { RECURSIVE_TEST_FILES => 1 }
64             );
65              
66             if ( caller() ) {
67             *WriteMakefile = sub {
68 1     1   4 my %args = @_;
69 1 50       50 @ARGV ? [ @args{ @ARGV } ] : \%args
70             }
71             } else {
72             require ExtUtils::MakeMaker::CPANfile;
73             ExtUtils::MakeMaker::CPANfile->import
74             }
75             WriteMakefile( %att )