The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

STEVEB::Dist::Mgr - My distribution release cycle toolkit

DESCRIPTION

SYNOPSIS

use STEVEB::Dist::Mgr qw(:all)

my $results = bump_version('2.02');

my $file_versions = get_version_info();

EXPORT_OK

We do not automatically import anything into your namespace, you must request functionality explicitly. Available functions are:

# Makefile.PL functions

add_bugtracker
add_repository

# Module file functions

bump_version
get_version_info

NOTE: You can auto import everything at once by specifying the :all tag.

FUNCTIONS

add_bugtracker

Adds bugtracker information to the Makefile.PL file. If the required META_MERGE section doesn't exist, we'll create it.

Currently, only Github is supported.

Parameters:

$author

Mandatory, String: The Github username of the software author. For example, mine is stevieb9.

$repository

Mandatory, String: The name of the repository. For example, the repository name for this distribution is steveb-dist-mgr.

$makefile

Optional, String: The path and name of the Makefile.PL file to use. We default to ./Makefile.PL.

Returns: 0 upon success.

add_repository

Adds repository information to the Makefile.PL file. If the required META_MERGE section doesn't exist, we'll create it.

Currently, only Github is supported.

Parameters:

$author

Mandatory, String: The Github username of the software author. For example, mine is stevieb9.

$repository

Mandatory, String: The name of the repository. For example, the repository name for this distribution is steveb-dist-mgr.

$makefile

Optional, String: The path and name of the Makefile.PL file to use. We default to ./Makefile.PL.

Returns: 0 upon success.

bump_version

Finds and updates the version number of a Perl module file, or all Perl module files in a directory structure.

Parameters:

$version

Mandatory, String: The new version to update to.

Dry run mode

The $version parameter can be prepended with an optional dash (-), and if so, we'll operate in "dry-run" mode, where we'll return the results, but won't have written to any files. Eg: bump_version('-1.01').

$fs_entry

Optional, String: The directory or file to operate on. If a directory is sent in, we'll iterate over all files in all directories recursively.

Default: lib/

Returns: An HoH:

$VAR1 = {
    't/data/work/Two.pm' => {
        'dry_run'   => 0,
        'from'      => '2.66',
        'to'        => '2.67',
        'content'   => '' # Module file code (snipped for brevity)
    },
    't/data/work/One.pm' => {
        'dry_run'   => 0,
        'from'      => '2.66',
        'to'        => '2.67',
        'content'   => '' # Module file code (snipped for brevity)
    },
};

get_version_info

Fetches the file version information of Perl module files. Can operate on a single file, or iterate over a directory structure.

Parameters:

$fs_entry

Optional, String: The directory or file to operate on. If a directory is sent in, we'll iterate over all files in all directories recursively.

Default: lib/

Returns: Hash reference:

$VAR1 = {
    't/data/orig/One.pm'    => '2.66'
    't/data/orig/Two.pm'    => '2.66',
    't/data/orig/Three.pm'  => '2.66',
    't/data/orig/Bad.pm'    => undef,   # $VERSION can't be parsed
    't/data/orig/No.pm'     => undef,   # No $VERSION defined
};

AUTHOR

Steve Bertrand, <steveb at cpan.org>

LICENSE AND COPYRIGHT

Copyright 2020 Steve Bertrand.

This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at:

http://www.perlfoundation.org/artistic_license_2_0

AUTHOR

Steve Bertrand, <steveb at cpan.org>

LICENSE AND COPYRIGHT

Copyright 2020 Steve Bertrand.

This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at:

http://www.perlfoundation.org/artistic_license_2_0