Dist::Zilla::Plugin::ReleaseStatus::FromVersion - Set release status from version number patterns
version 0.001
# in dist.ini [ReleaseStatus::FromVersion] testing = third_decimal_odd
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")
testing
unstable
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.
Add [ReleaseStatus::FromVersion] to your dist.ini and set the testing and/or unstable attributes. Keep in mind that unstable has the highest precedence.
[ReleaseStatus::FromVersion]
The default rule 'none' is always false.
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
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
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.
Rule for setting status to 'testing'. Must be one of the "Status Rules".
The default is none.
none
Rule for setting status to 'unstable'. Must be one of the "Status rules".
This setting takes precedence over testing.
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
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.
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
David Golden <dagolden@cpan.org>
David Golden <xdg@xdg.me>
This software is Copyright (c) 2015 by David Golden.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004
To install Dist::Zilla::Plugin::ReleaseStatus::FromVersion, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Dist::Zilla::Plugin::ReleaseStatus::FromVersion
CPAN shell
perl -MCPAN -e shell install Dist::Zilla::Plugin::ReleaseStatus::FromVersion
For more information on module installation, please visit the detailed CPAN module installation guide.