ADAMK-Release
view release on metacpan or search on metacpan
lib/ADAMK/Release.pm view on Meta::CPAN
}
# Check the Changes file
unless ( $self->no_changes ) {
# Read in the Changes file
unless ( -f $self->dist_changes ) {
$self->error("Distribution does not have a Changes file");
}
unless ( open( CHANGES, $self->dist_changes ) ) {
$self->error("Failed to open Changes file");
}
my @lines = <CHANGES>;
close CHANGES;
unless ( @lines >= 3 ) {
$self->error("Changes file is empty or too small");
}
# The Changes version should be the first thing on the third line
my $current = $lines[2];
my ($version) = split /\s+/, $current;
unless ( $version =~ /[\d\._]{3}/ ) {
$self->error(
"Failed to find current version, or too short, in '%2'",
$current,
);
}
# Does it match the version in the main module
unless ( $version eq $self->dist_version ) {
$self->error(
"Version in Changes file (%s) does not match module version (%s)",
$version,
$self->dist_version,
);
}
}
# Check that the main module documentation Copyright is the current year
unless ( $self->no_copyright ) {
# Read the file
unless ( open( MODULE, $self->module_doc ) ) {
$self->error(
"Failed to open '%s'",
$self->module_doc,
);
}
my @lines = <MODULE>;
close MODULE;
# Look for the current year
my $year = 1900 + (localtime time)[5];
unless ( grep { /copyright/i and /$year/ } @lines ) {
$self->error("Missing Copyright, or does not refer to current year");
}
# Merge the module to a single string
my $merged = join "\n", @lines;
unless ( $self->no_rt ) {
my $dist_name = $self->dist;
unless ( $merged =~ /L\<http\:\/\/rt\.cpan\.org\/.+?=([\w-]+)\>/ ) {
$self->error("Failed to find a link to the public RT queue");
}
unless ( $dist_name eq $1 ) {
$self->error("Expected a public link to $dist_name RT queue, but found a link to the $1 queue");
}
}
}
# Touch all files to correct any potential time skews
foreach my $file ( $self->find_files->in( $self->dist_dir ) ) {
$self->shell(
$self->bin_touch,
$file,
"Error while touching $file to prevent clock skew",
);
}
return;
}
sub build {
my $self = shift;
# Prevent environment variables from outside this script
# infecting the way we build things inside here.
local $ENV{AUTOMATED_TESTING} = '';
local $ENV{RELEASE_TESTING} = '';
# Run either of the build protocols
if ( $self->makefile_pl ) {
$self->build_make;
} elsif ( $self->build_pl ) {
$self->build_perl;
} else {
$self->error("Module does not have a Makefile.PL or Build.PL");
}
# Double check that the build produced a tarball where we expect it to be
unless ( -f $self->dist_tardist ) {
$self->error(
"Failed to create tardist at '%s'",
$self->dist_tardist,
);
}
return;
}
sub build_make {
my $self = shift;
# Create the Makefile and MANIFEST
$self->build_makefile;
$self->build_makefile_manifest;
unless ( $self->no_test ) {
# Test the distribution normally
$self->shell(
$self->bin_make,
'disttest',
'disttest failed',
);
( run in 2.131 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )