ADAMK-Release
view release on metacpan or search on metacpan
lib/ADAMK/Release.pm view on Meta::CPAN
use File::Find::Rule 0.32 ();
use File::Flat 1.04 ();
use File::ShareDir 1.03 ();
use File::LocalizeNewlines 1.12 ();
use GitHub::Extract 0.02 ();
use IO::Prompt::Tiny 0.002 ();
use Module::Extract::VERSION 1.01 ();
use Params::Util 1.00 ':ALL';
use Term::ReadKey 2.14 ();
use YAML::Tiny 1.51 ();
our $VERSION = '0.02';
use constant TOOLS => qw{
cat
chmod
make
touch
sudo
bash
};
use Object::Tiny 1.01 qw{
module
github
verbose
release
no_rt
no_changes
no_copyright
no_test
}, map { "bin_$_" } TOOLS;
######################################################################
# Constructor
sub new {
my $self = shift->SUPER::new(@_);
# Check module
unless ( _CLASS($self->module) ) {
$self->error("Missing or invalid module");
}
# Inflate and check the github object
if ( Params::Util::_HASH($self->github) ) {
$self->{github} = GitHub::Extract->new( %{$self->github} );
}
unless ( Params::Util::_INSTANCE($self->github, 'GitHub::Extract')) {
$self->error("Missing or invalid GitHub specification");
}
# Release options
$self->{release} = !!$self->{release};
# Find all of the command line tools
foreach my $tool ( TOOLS ) {
$self->{ "bin_" . $tool } = $self->which($tool);
}
return $self;
}
######################################################################
# Command Methods
sub run {
my $self = shift;
# Export from GitHub and change to the directory
my $pushd = $self->github->pushd;
unless ( $pushd ) {
$self->error(
"Failed to download and extract %s: %s",
$self->github->url,
$self->github->error,
);
}
# This is total bulldozer coding, there is no reason whatsoever why
# this stuff should be in seperate methods except that it provides
# a little cleaner logical breakup, and maybe I want to subclass this
# someday or something.
$self->validate;
$self->assemble;
$self->build;
# Release the distribution
$self->upload if $self->release;
return;
}
sub validate {
my $self = shift;
unless ( $self->dist_version ) {
$self->error("Failed to find version number in main module");
}
unless ( $self->makefile_pl or $self->build_pl ) {
$self->error("Failed to find Makefile.PL or Build.PL");
}
return;
}
sub assemble {
my $self = shift;
# Create MANIFEST.SKIP
if ( -f $self->dist_manifest_add ) {
$self->shell(
( run in 0.859 second using v1.01-cache-2.11-cpan-d8267643d1d )