Module-Release

 view release on metacpan or  search on metacpan

script/release  view on Meta::CPAN

push @ARGV, @extra_opts;

my %opts;
GetOptions(
    'v|version'            => sub { say "$0 version $script_version"; exit },
    'h|help|usage|?'       => sub { usage(0) },

    'a|automated-testing!' => \$opts{a},
    'c|changes=s'          => \$opts{c},
    'C|skip-changes!'      => \$opts{C},
    'd|skip-debug!'        => \$opts{d},
    'D|skip-dist!'         => \$opts{D},
    'j|jobs:0'             => \$opts{j},
    'k|skip-kwalitee!'     => \$opts{k},
    'm|skip-manifest!'     => \$opts{'m'},
    'p|skip-prereq!'       => \$opts{p},
    't|test-only|dry-run!' => \$opts{t},
    'T|skip-tests!'        => \$opts{T},
    'V|skip-version!'      => \$opts{V},
    ) or usage(1);

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

sub usage {
	my $err = shift and select STDERR;
	print <<"USE";

Use: release -acCdDhkmptTvV [-j[N]] [ LOCAL_FILE [ REMOTE_FILE ] ]

Will upload current release LOCAL_FILE, naming it REMOTE_FILE.  Will
get LOCAL_FILE and REMOTE_FILE automatically (using same name for
both) if not supplied.

	-a   Set AUTOMATED_TESTING to true
	-c   Changes entry as a string on the command line
	-C   Skip Changes file (useful for re-running botched releases)
	-d   Print extra debugging information
	-D   Skip building the dist
	-h   This help
	-jN  Enable parallel tests
	-k   Skip kwalitee check
	-m   Skip the MANIFEST check
	-p   Skip the prereqs check
	-t   Just make and test distribution, don't tag/upload
	-T   Skip tests
	-v   Print the script version number and exit
	-V   Skip the version check

The program works in the current directory, and looks for a .releaserc
or releaserc file and the environment for its preferences.  See
`perldoc $0`, for more information.

USE

	exit 2;
	}

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# get the release object
my %params;
$params{local}  = shift @ARGV if @ARGV;

if( @ARGV ) {
	$params{remote} = shift @ARGV;
	}
elsif( $params{local} ) {
	$params{remote} = $params{local};
	}

$params{debug} = 1 if( $opts{d} );

my $release = $class->new( %params );

$release->_debug( "release $script_version, using $class "
	.  $class->VERSION . "\n" );

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# load whatever will handle source control
{
my @vcs = (
	[ '.git'       => "Module::Release::Git" ],
	[ '.gitignore' => "Module::Release::Git" ],
	[ '.svn'       => "Module::Release::SVN" ],
	[ 'CVS'        => "Module::Release::CVS" ],
	);

foreach my $vcs ( @vcs ) {
	next unless -e $vcs->[0];
	my $module = $vcs->[1];
	$release->_debug( "I see an $vcs->[0] directory, so I'm loading $module\n" );
	$release->load_mixin( $module );
	$release->_die( "Could not load $module: $@\n" ) if $@;
	last;
	}
}

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Are we on the right branch? I've made mistakes where I released
# from an experimental branch, and I don't want to do that again.
if( $release->can('is_allowed_branch') ) {  # New in Module::Release::Git 1.016
	$release->_print("============ Checking for allowed branch\n");
	my $branch = $release->vcs_branch;
	unless( $release->is_allowed_branch ) {
		$release->_die( "Configuration blocks release from branch <$branch>\n" );
		}
	$release->_print( "Branch <$branch> is allowed to release\n" );
	}

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Will we upload to PAUSE?
if( $release->config->cpan_user ) { # not a dry run
	$release->load_mixin( 'Module::Release::PAUSE' );
	}

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Are we checking prereqs?
$release->load_mixin( 'Module::Release::Prereq' );

my $skip_prereqs = $opts{p} // $release->config->skip_prereqs;
my $skip_dist    = $opts{D} // $release->config->skip_dist;
my $required     =             $release->config->required // "";



( run in 1.889 second using v1.01-cache-2.11-cpan-437f7b0c052 )