Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kentnl/dist-zilla-plugin-autoversion-relative

Time-Relative versioning
https://github.com/kentnl/dist-zilla-plugin-autoversion-relative

Last synced: 4 days ago
JSON representation

Time-Relative versioning

Awesome Lists containing this project

README

        

# NAME

Dist::Zilla::Plugin::AutoVersion::Relative - Time-Relative versioning

# VERSION

version 1.001002

# SYNOPSIS

Like all things, time is relative.
This plugin is to allow you to auto-increment versions based on a relative time point.

It doesn't do it all for you, you can choose, its mostly like [The `AutoVersion` Plugin](https://metacpan.org/pod/Dist::Zilla::Plugin::AutoVersion)
except there's a few more user-visible entities, and a few more visible options.

# CONFIGURATION

To configure this, you specify the date that the version is to be
relative to.

## Serving Suggestion

[AutoVersion::Relative]
major = 1
minor = 1
year = 2009 ; when we did our last major rev
month = 08 ; " "
day = 23 ; " "
hour = 05 ; " "
minute = 30 ; " "
second = 00 ; If you're that picky.

time_zone = Pacific/Auckland ; You really want to set this.

; 1.0110012
format = {{$major}}.{{sprintf('%02d%04d%02d', $minor, days, hours }}

For the list of tuneables and how to use them, see
["ATTRIBUTES"](#attributes) and ["DATE ATTRIBUTES"](#date-attributes)

# FORMATTING

There are a handful of things we inject into the template for you

# Just to give you an idea, you don't really want to be using this though.
{{ $major }}.{{ $minor }}{{ days }}{{ hours }}{{ $relative->seconds }}

See ["FORMAT FIELDS"](#format-fields) for the available fields and their use.

# WARNING

If you don't specify Y/M/D, it will default to Jan 01, 2000 , because I
couldn't think of a more sane default. But you're setting that anyway, because
if you don't,you be cargo cultin' the bad way

# ATTRIBUTES

## major

## major = 1

## minor

## minor = 1

## format

## format = {{ sprintf('%d.%02d%04d%02d', $major, $minor, days, hours) }}

See ["FORMATING"](#formating)

# DATE ATTRIBUTES

## year

## year = 2000

## month

## month = 1

## day

## day = 1

## minute

## minute = 0

## second

## second = 0

## time\_zone

You want this.

Formatting is like, "Pacific/Auckland" , or merely "+1200" format.

# FORMAT FIELDS

## $major

The value set for major

## $minor

The value set for minor

## $relative

A [`DateTime::Duration`](https://metacpan.org/pod/DateTime::Duration) object

## cldr

## cldr($ARG)

CLDR for the current time. See ["format\_cldr" in DateTime](https://metacpan.org/pod/DateTime#format_cldr)

## days

See ["days\_accurate"](#days_accurate)

Used to use the algorithm as used in ["days\_square"](#days_square) but uses the algorithm in ["days\_accurate"](#days_accurate) since 0.03000000

## days\_square

An approximation of the number of days passed since milestone.

Note that for this approximation, it is assumed all months are 31 days long, and years as such,
have 372 days.

This is a legacy way of computing dates, superseded by days\_accurate since 0.03000000

## days\_accurate

The number of days passed since the milestone.

## hours

The remainder number of hours elapsed.

# METHODS

## provide\_version

returns the formatted version string to satisfy the roles.

# ATTRIBUTE METHODS

## has\_time\_zone <- predicate('time\_zone')

# PRIVATE ATTRIBUTES

## \_release\_time

## \_release\_time DateTime\[ro\]

## \_current\_time

## \_current\_time DateTime\[ro\]

## relative

## relative Duration\[ro\]

# PRIVATE BUILDERS

## \_build\_\_release\_time

## \_build\_\_current\_time

## \_build\_relative

# AUTHOR

Kent Fredric

# COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by Kent Fredric .

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.