ADAMK-Release
view release on metacpan or search on metacpan
lib/ADAMK/Release.pm view on Meta::CPAN
# Test with RELEASE_TESTING and root permissions.
# This catches bad test script assumptions in modules related
# to files and permissions (File::Remove, File::Flat etc).
SCOPE: {
local $ENV{RELEASE_TESTING} = 1;
$self->sudo(
qw{ perl Makefile.PL },
'Error while creating Makefile',
);
$self->sudo(
$self->bin_make,
"disttest",
'disttest failed',
);
# Clean up leftover root files and rebuild from scratch
$self->build_realclean;
$self->build_makefile;
$self->build_makefile_manifest;
# Run the test suite one last time to make sure we
# didn't break anything.
$self->sudo(
$self->bin_make,
"disttest",
'disttest failed',
);
# Clean up the leftover root files again
$self->build_realclean;
}
}
# Create the Makefile and MANIFEST
$self->build_makefile;
$self->build_makefile_manifest;
# Build the tardist
$self->shell(
$self->bin_make,
"tardist",
'Error making distribution tarball',
);
return;
}
sub build_makefile {
my $self = shift;
# Execute Makefile.PL with the current environment's perl
$self->shell(
qw{ perl Makefile.PL },
'Error while creating Makefile',
);
# Add the build-system-specific elements to the META.yml
my $meta = YAML::Tiny->read( $self->dist_meta_yml );
return unless defined $meta;
# Add the resources
my $save = 0;
unless ( $meta->[0]->{resources} ) {
$meta->[0]->{resources} = {};
$save = 1;
}
unless ( $meta->[0]->{resources}->{repository} ) {
$meta->[0]->{resources}->{repository} = $self->dist_resource_repository;
$save = 1;
}
if ( $save ) {
$meta->write( $self->dist_meta_yml );
}
return;
}
sub build_makefile_manifest {
my $self = shift;
$self->shell(
$self->bin_make,
"manifest",
"Error while creating the MANIFEST",
);
}
sub build_realclean {
my $self = shift;
# Clean up the distribution (always with root)
$self->sudo(
$self->bin_make,
"realclean",
'sudo make clean failed',
);
$self->remove( $self->dist_manifest );
}
sub build_perl {
my $self = shift;
# Create the Build file
$self->shell(
qw{ perl Build.PL },
'Error while creating Makefile',
);
# Create the MANIFEST file
$self->shell(
"./Build",
"manifest",
'Error while creating the MANIFEST',
);
unless ( $self->no_test ) {
# Test the distribution normally
$self->shell(
qw{ ./Build disttest },
'disttest failed',
);
}
# Build the tardist
$self->shell(
qw{ ./Build dist },
'Error making distribution tarball',
);
return;
}
sub upload {
my $self = shift;
my $pauseid = $self->prompt("PAUSEID:");
unless (_STRING($pauseid) and $pauseid =~ /^[A-Z]{3,}$/) {
$self->error("Missing or invalid PAUSEID");
}
my $password = $self->password("Password:");
unless (_STRING($password) and $password =~ /^\S{5,}$/) {
$self->error("Missing or invalid CPAN password");
}
# Execute the upload to CPAN
CPAN::Uploader->upload_file( $self->dist_tardist, {
user => $pauseid,
password => $password,
});
}
######################################################################
# Content and Scanning Methods
# Get the main github repository url for this release
sub dist_resource_repository {
my $self = shift;
return join( '',
"https://github.com/",
$self->github->username,
$self->github->repository,
'.git',
);
}
sub makefile_pl {
my $self = shift;
unless ( defined $self->{makefile_pl} ) {
my $file = $self->dist_makefile_pl;
return undef unless -f $file;
$self->{makefile_pl} = File::Slurp::read_file($file);
}
return $self->{makefile_pl};
}
sub build_pl {
my $self = shift;
unless ( defined $self->{build_pl} ) {
my $file = $self->dist_build_pl;
return undef unless -f $file;
$self->{build_pl} = File::Slurp::read_file($file);
}
return $self->{build_pl};
}
sub module_doc {
my $self = shift;
unless ( exists $self->{module_doc} ) {
if ( -f $self->module_pod ) {
$self->{module_doc} = $self->module_pod;
} else {
$self->{module_doc} = $self->module_pm;
}
}
return $self->{module_doc};
}
sub module_version {
my $self = shift;
unless ( $self->{module_version} ) {
my $file = $self->module_pm;
my $version = Module::Extract::VERSION->parse_version_safely($file);
unless ( $version and $version ne 'undef' ) {
return undef;
}
$self->{module_version} = $version;
}
return $self->{module_version};
}
sub find_ppport {
File::Find::Rule->name('*.xs')->file->grep(qr/\bppport\.h\b/);
}
sub find_files {
( run in 1.533 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )