The Perl Advent Calendar needs more articles for 2022. Submit your idea today!

NAME

Dist::Zilla::Plugin::CopyrightYearFromGit - Set copyright year from git

VERSION

This document describes version 0.009 of Dist::Zilla::Plugin::CopyrightYearFromGit (from Perl distribution Dist-Zilla-Plugin-CopyrightYearFromGit), released on 2021-08-24.

SYNOPSIS

Suppose the current year is 2021 and you have release git tags for 2019, 2017, 2016. The default setting will make copyright_year to be:

 2021, 2019, 2017, 2016

In dist.ini:

 [CopyrightYearFromGit]
 ; release_tag_regex = ^v    ; optional, default is ^(version|ver|v)\d
 ; author_name_regex = foo   ; optional, default is none (any author name will be included)
 ; author_email_regex = foo  ; optional, default is none (any author email will be included)

 ; min_year = 2017           ; optional, setting this would make copyright_year become: 2021, 2019, 2017.

 ; include_year = 2015
 ; include_year = 2013       ; optional, setting this two lines would make copyright_year become: 2021, 2019, 2017, 2016, 2015, 2013.

 ; exclude_year = 2016
 ; exclude_year = 2017       ; optional, setting this two lines would make copyright_year become: 2021, 2019

 ; continuous_year = 1       ; optional, setting this would make copyright_year become: 2021, 2020, 2019, 2018, 2017, 2016

DESCRIPTION

This plugin will set copyright_year to something like:

 2021, 2019, 2017, 2016

where the years will be retrieved from: 1) the date of git tags that resemble version string (qr/^(version|ver|v)?\d/); 2) the current year. Years that do not see version tags and are not the current year will not be included, unless you set "continuous_year" or "include_year". On the other hand, years that see version tags or the current year can be excluded via "min_year" or "exclude_year".

The included years will be listed in descending order in a comma-separated list. This format is commonly used in books, where the year of each revision/edition is mentioned, e.g.:

 Copyright (c) 2013, 2010, 2008, 2006 by Pearson Education, Inc.

CONFIGURATION

release_tag_regex

String (regex pattern). Specify a custom regular expression for matching git release tags.

An old alias regex is still recognized, but deprecated.

author_name_regex

String (regex pattern). Only consider release commits where author name matches this regex.

author_email_regex

String (regex pattern). Only consider release commits where author email matches this regex.

min_year

Integer. Instruct the plugin to not include years below this year. If min_year is (incorrectly) set to a value larger than the current year, then the current year will be used instead. Note that "include_year" and "exclude_year" override min_year.

include_year

Integer (can be specified multiple times). Force-include one or more years. Note that "exclude_year" overrides include_year.

exclude_year

Integer (can be specified multiple times). Force-exclude one or more years. Note that "continuous_year" overrides exclude_year.

continuous_year

Boolean. If set to true, will make copyright_year a continuous range from the smallest included year to the largest included year, with no gap inside.

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/Dist-Zilla-Plugin-CopyrightYearFromGit.

SOURCE

Source repository is at https://github.com/perlancar/perl-Dist-Zilla-Plugin-CopyrightYearFromGit.

SEE ALSO

AUTHOR

perlancar <perlancar@cpan.org>

CONTRIBUTOR

Stephen Thirlwall <sdt@cpan.org>

CONTRIBUTING

To contribute, you can send patches by email/via RT, or send pull requests on GitHub.

Most of the time, you don't need to build the distribution yourself. You can simply modify the code, then test via:

 % prove -l

If you want to build the distribution (e.g. to try to install it locally on your system), you can install Dist::Zilla, Dist::Zilla::PluginBundle::Author::PERLANCAR, and sometimes one or two other Dist::Zilla plugin and/or Pod::Weaver::Plugin. Any additional steps required beyond that are considered a bug and can be reported to me.

COPYRIGHT AND LICENSE

This software is copyright (c) 2021, 2019, 2017 by perlancar <perlancar@cpan.org>.

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

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Dist-Zilla-Plugin-CopyrightYearFromGit

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.