Module::Release - Automate software releases
my $release = Module::Release->new( %params );
# call methods to automate your release process
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.
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.
Module::Release looks at several sources for configuration information.
Module::Release looks at Config to get the values it needs for certain operations.
The name of the program to run for the make steps
Use this value as the perl interpreter, otherwise use the value in $^X.
Do you want debugging output? Set this to a true value
Your CPAN password. If you don't set this and you want to upload to PAUSE, you should be prompted for it.
Module::Release looks for either .releaserc or releaserc in the current working directory. It reads that with ConfigReader::Simple to get these values:
Your PAUSE user id.
Your PAUSE password, but don't use this. Put it in the environment variable.
A whitespace separated list of modules for Test::Prereq to ignore. But, don't use Test::Prereq. It was not a good idea.
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.
If this is set to "Build.PL", this his will also cause Module::Build::Prereqs to use Test::Prereqs::Build instead of Test::Prereqs.
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.
release tries to guess the module name from the distro name, but if you don't like that, set the module name in the config file.
If you don't like what any of these methods do, override them in a subclass.
Create the Module::Release object. It reads the configuration and initializes everything.
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.
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;
Returns or sets the name of the local distribution file. You can use the literal argument undef to clear the value.
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.
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.
Delete PATH from the list of perls used for testing
Reset the list of perl interpreters to just the one running release.
Return the value of input_fh.
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.
Get the value of quiet 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
Returns the module name. This either takes it from the config file or tries to guess it from the distro name.
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.
Since `make manifest` takes care of things for you, you might just have to re-run your release script.
Return the name of the manifest 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.
Should I upload to PAUSE? If cpan_user and cpan_pass are set, go for it.
Get passwords for CPAN.
Read and parse the Changes file. This is pretty specific, so you may well want to overload it.
Show recent contributors before creating/extending Changes.
This output relies upon the method get_recent_contributors() having been implemented in the relevant mixin for your version control system.
Return a string representing the current date and time (in UTC) in the CPAN::Changes::Spec format so that it can be added directly to the Changes file.
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.
Read a line from whatever is in input_fh and return it.
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
brian d foy, <email@example.com>
Copyright © 2007-2023, brian d foy <firstname.lastname@example.org>. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the Artistic License 2.0.
To install Module::Release, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.