The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Dist::Zilla::Plugin::ReleaseStatus::FromVersion - Set release status from version number patterns

VERSION

version 0.001

SYNOPSIS

    # in dist.ini
    [ReleaseStatus::FromVersion]
    testing = third_decimal_odd

DESCRIPTION

This module tells Dist::Zilla to set a distribution's release status based on its version number.

There are two attributes: testing and unstable. Each is assigned a string corresponding to a rule to apply to the distribution's version. (See "Status rules")

If the unstable rule is true, the release status will be 'unstable'. Otherwise, if the testing rule is true, the release status will be 'testing'. Otherwise, the release status will be 'stable'.

NOTE: Use of this plugin with version numbers with underscores – whether decimal or tuple – will result in a fatal error. This module replaces underscore heuristics to determine release status and is thus incompatible with such versions.

USAGE

Add [ReleaseStatus::FromVersion] to your dist.ini and set the testing and/or unstable attributes. Keep in mind that unstable has the highest precedence.

Status rules

Default rule

The default rule 'none' is always false.

Decimal version rules

This set of rules apply only to "decimal versions" — versions that that look like integers or floating point numbers. They will be false if applied to a version tuple.

The only decimal rules so far check a particular digit after the decimal point and return true if the digit is odd:

    second_decimal_odd
    third_decimal_odd
    fourth_decimal_odd
    fifth_decimal_odd
    sixth_decimal_odd

For example, here is the 'fourth_decimal_odd' rule applied to two version numbers:

    1.0100 — false
    1.0101 — true

Tuple version rules

This set of rules apply only to "tuple versions", aka "dotted-decimal versions" — versions that that look like "v1", "v1.2", "v1.2.3" and so on. They also apply to versions without the leading-v as long as there are more than two decimal points, e.g. "1.2.3". They will be false if applied to a decimal version.

Tuple versions treat each decimal-separated value as an individual number.

The only tuple rules so far check a particular element of the tuple and return true if the element is odd:

    second_element_odd
    third_element_odd
    fourth_element_odd

For example, here is the 'second_element_odd' rule applied to two version numbers:

    v1.0.3 — false
    v1.1.3 — true

New rules

If you have an idea for a new rule, please look at how the existing rules are implemented and open a Github issue or send a pull-request with your idea.

ATTRIBUTES

testing

Rule for setting status to 'testing'. Must be one of the "Status Rules".

The default is none.

unstable

Rule for setting status to 'unstable'. Must be one of the "Status rules".

This setting takes precedence over testing.

The default is none.

EXAMPLE

Here is a somewhat contrived example demonstrating precedence:

    [ReleaseStatus::FromVersion]

    unstable = second_decimal_odd
    testing  = fourth_decimal_odd

    # results for different possible version

    1.0000 — stable
    1.0100 — unstable
    1.0101 — unstable
    1.0200 — stable
    1.0201 — testing
    1.0202 — stable

SUPPORT

Bugs / Feature Requests

Please report any bugs or feature requests through the issue tracker at https://github.com/dagolden/Dist-Zilla-Plugin-ReleaseStatus-FromVersion/issues. You will be notified automatically of any progress on your issue.

Source Code

This is open source software. The code repository is available for public review and contribution under the terms of the license.

https://github.com/dagolden/Dist-Zilla-Plugin-ReleaseStatus-FromVersion

  git clone https://github.com/dagolden/Dist-Zilla-Plugin-ReleaseStatus-FromVersion.git

AUTHOR

David Golden <dagolden@cpan.org>

CONTRIBUTOR

David Golden <xdg@xdg.me>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2015 by David Golden.

This is free software, licensed under:

  The Apache License, Version 2.0, January 2004