Module::Release - Automate software releases
use Module::Release; my $release = Module::Release->new( %params ); # call methods to automate your release process $release->check_cvs; ...
Module::Release automates your software release process. It started as a script that automated my release process, so it has bits to talk to PAUSE (CPAN) and SourceForge, and to use Makefile.PL and CVS. Other people have extended this in other modules under the same namespace so you can use Module::Build, svn, and many other things.
Module::Release
Makefile.PL
CVS
Module::Build
svn
The methods represent a step in the release process. Some of them check a condition (e.g. all tests pass) and die if that doesn't work. Module::Release doesn't let you continue if something is wrong. Once you have checked everything, use the upload features to send your files to the right places.
The included release script is a good starting place. Don't be afraid to edit it for your own purposes.
release
Module::Release looks at several sources for configuration information.
Module::Release looks at Config to get the values it needs for certain operations.
Config
The name of the program to run for the make steps
make
Use this value as the perl interpreter, otherwise use the value in $^X.
$^X
Do you want debugging output? Set this to a true value
Your SourceForge password. If you don't set this and you want to upload to SourceForge, you should be prompted for it. Failing that, the module tries to upload anonymously but cannot claim the file for you.
Your CPAN password. If you don't set this and you want to upload to PAUSE, you should be prompted for it. Failing that, the module tries to upload anonymously but cannot claim the file for you.
.releaserc
Module::Release looks for either .releaserc or releaserc in the current working directory. It reads that with ConfigReader::Simple to get these values:
releaserc
ConfigReader::Simple
The subclass of Module::Release that you want to use. This allows you to specify the subclass via a .releaserc file; otherwise you wouldn't be able to use the release script because the Module::Release class name is hard-coded there.
The name of the file to run as Makefile.PL. The default is "Makefile.PL", but you can set it to "Build.PL" to use a Module::Build-based system.
"Makefile.PL"
"Build.PL"
The name of the file created by makefile_PL above. The default is "Makefile", but you can set it to "Build" for Module::Build-based systems.
makefile_PL
"Makefile"
"Build"
Your PAUSE user id.
Your SourceForge account (i.e. login) name.
Set this to a true value to enable passive FTP.
A whitespace separated list of modules for Test::Prereq to ignore.
Test::Prereq
If you don't like what any of these methods do, override them in a subclass.
Create the bare bones Module::Release object so you can read the configuration file. If you can read the configuration file, check for the release_subclass directive. If the release_subclass is there, new calls the subclass's new and returns the result. Otehrwise, this new calls init to set up the object.
release_subclass
new
init
If you make a subclass, you're responsible for everything, including reading the configuration and adding it to your object.
Set up the Module::Release object. By default, it expects something using MakeMaker, but if it sees a Build.PL it configures itself for Module::Build.
The values in the configuration file override any settings here, so if you have both a Makefile.PL and a Build.PL then you can override the Module::Build preference by setting the makefile_PL and make configuration values.
EXPERIMENTAL!!
Load MODULE through require (so no importing), without caring what it does. My intent is that MODULE adds methods to the Module::Release namespace so a release object can see it. This should probably be some sort of delegation.
Added in 1.21
Returns a list of the loaded mixins
Returns true if the mixin class is loaded
Get the configuration object. By default this is a ConfigReader::Simple object;
Get a web user agent that follows the LWP::UserAgent API. The first time you call this it also sets up the web client by calling setup_web_client.
setup_web_client
Create a web user agent and store it in the object. Get a reference to it by saving the result or calling get_web_user_agent. If you call this method again, it replaces the internal web user agent (and anything you've done to it since you first set it up). It passes any arguments to the constructor of the user agent class.
get_web_user_agent
It calls web_user_agent_name to set the initial agent name, and sets up an empty, in-memory cookie jar.
web_user_agent_name
The package name to use to build a web user agent object.
The user agent name to use with web requests. Let's just call that Mozilla for now.
Mozilla
Returns or sets the name of the local distribution file. You can use the literal argument undef to clear the value.
undef
Returns the name of the file on the remote side. You can use the literal argument undef to clear the value.
Set the current path for the perl binary that Module::Release should use for general tasks. This is not related to the list of perls used to test multiple binaries unless you use one of those binaries to set a new value.
If PATH looks like a perl binary, set_perl uses it as the new setting for perl and returns the previous value.
set_perl
Added in 1.21.
Returns the current path for the perl binary that Module::Release should use for general tasks. This is not related to the list of perls used to test multiple binaries.
Return the list of perl binaries Module::Release will use to test the distribution.
Add a perl binary to the list of perls to use for testing. If PATH is not executable or cannot run print $], this method returns nothing and does not add PATH. Otherwise, it returns true. If the same path was already in the list, it returns true but does not create a duplicate.
print $]
Delete PATH from the list of perls used for testing
Reset the list of perl interpreters to just the one running release.
If quiet is off, return the value of output_fh. If output_fh is not set, return STDOUT. If quiet is on, return the value of null_fh.
Return the null filehandle. So far that's something set up in new and I haven't provided a way to set it. Any subclass can make their null_fh return whatever they like.
null_fh
Get the value of queit mode (true or false).
Turn on quiet mode
Turn off quiet mode
Get the value of the debugging flag (true or false).
Turn on debugging
Turn off debugging
If debugging is on, return the value of debug_fh. If debug_fh is not set, return STDERR. If debugging is off, return the value of null_fh.
Run `make realclean`
Run `make distclean`
Runs `perl Makefile.PL 2>&1`.
This step ensures that we start off fresh and pick up any changes in Makefile.PL.
Run a plain old `make`.
Run `make test`. If any tests fail, it dies.
Run `make dist`. As a side effect determines the distribution name if not set on the command line.
Run `make disttest`. If the tests fail, it dies.
This was the old name for the method, but was inconsistent with other method names. It still works, but is deprecated and will give a warning.
Return the distribution version ( set in dist() )
# XXX make this configurable
Run `make manifest` and report anything it finds. If it gives output, die. You should check MANIFEST to ensure it has the things it needs. If files that shouldn't show up do, put them in MANIFEST.SKIP.
MANIFEST
Since `make manifest` takes care of things for you, you might just have to re-run your release script.
Return the name of the manifes file, probably MANIFEST.
This is the old name for manifest_name. It still works but is deprecated.
Return the filenames in the manifest file as a list.
Note: these methods were formerly "cvs", but are now "vcs" for Version Control System.
This is a placeholder method which should be implemented in a mixin module. Try installing Module::Release::CVS, Module::Release::SVN, or Module::Release::Git and then loading them in your script. The default release script does this for you by checking for the special directories for those source systems.
Previous to version 1.24, these methods were implemented in this module to support CVS. They are now in Module::Release::CVS as a separate module.
Set the modification times of each file in FILES to the current time. It tries to open the file for writing and immediately closing it, as well as using utime. It checks that the access and modification times were updated.
Returns the number of files which it successfully touched.
Runs touch on all of the files in MANIFEST.
Get passwords for CPAN.
Read and parse the README file. This is pretty specific, so you may well want to overload it.
Read and parse the Changes file. This is pretty specific, so you may well want to overload it.
Run a command in the shell.
Returns true if the command ran successfully, and false otherwise. Use this function in any other method that calls run to figure out what to do when a command doesn't work. You may want to handle that yourself.
Get an environment variable or prompt for it
Send the LIST to whatever is in output_fh, or to STDOUT. If you set output_fh to a null filehandle, output goes nowhere.
Use this for a string representing a line in the output. Since it's a method you can override it if you like.
Send the LIST to whatever is in debug_fh, or to STDERR. If you aren't debugging, debug_fh should return a null filehandle.
* What happened to my Changes munging?
Ken Williams turned my initial release(1) script into the present module form.
Andy Lester handled the maintenance while I was on my Big Camping Trip. He applied patches from many authors.
Andreas König suggested changes to make it work better with PAUSE.
Chris Nandor helped with figuring out the broken SourceForge stuff.
H.Merijn Brand has contributed many patches and features.
This source is in Github:
git://github.com/briandfoy/module-release.git
brian d foy, <bdfoy@cpan.org>
<bdfoy@cpan.org>
Copyright (c) 2002-2011 brian d foy. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
1 POD Error
The following errors were encountered while parsing the POD:
Non-ASCII character seen before =encoding in 'König'. Assuming UTF-8
To install Module::Release, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Module::Release
CPAN shell
perl -MCPAN -e shell install Module::Release
For more information on module installation, please visit the detailed CPAN module installation guide.