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

NAME

Dist::Zilla::Plugin::AuthorsFromGit - Add per-file per-year copyright info to each Perl document

VERSION

version 0.006

SYNOPSIS

In dist.ini, set

  copyright_holder = the Foo-Bar team, see the git log
  ; [...]
  [PodWeaver]
  [AuthorsFromGit]

In weaver.ini, set

  [@NoAuthor]

Then a copyright section in each module is created as follows:

  COPYRIGHT AND LICENSE

  This software is copyright (c) 2017 by the Foo-Bar team; in detail:

  Copyright 2014-2015  A. N. Author
            2016       A. N. Author, O. Th. Erautor
            2017       O. Th. Erautor

with names and years extracted from the Git commit log of the specific module.

DESCRIPTION

This Dist::Zilla plugin is intended for large Perl distributions that have been existing for some time, where maintainership has changed over the years, and where different people have contributed to different parts of the code. It provides a means to acknowledge the contribution of different people to different modules, where it is not possible to resonably list them all in the authors field of the entire distribution.

This is also to reflect that, independent of the chosen license terms, anyone who contributes nontrivial code to an open source package retains copyright of the contribution. Some legislatures (e.g. Germany) even provide no way of "transferring" copyright, since it is always bound to the natural person who conceived the code.

USAGE

Here, the usage in conjunction with the PodWeaver plugin is described. It should be possible to use this module without it, but I haven't tested that yet. We also assume that your working directory is a Git clone.

Assuming your distribution is called Foo-Bar, in dist.ini, then set

  copyright_holder = the Foo-Bar team, see the git log
  ; [...]
  [PodWeaver]
  [AuthorsFromGit]

The precise string ", see the git log" at the end of the copyright_holder line is important since it triggers this plugin.

In case you do not have a weaver.ini yet, create one with the content

  [@NoAuthor]

This is identical to the default plugin bundle of Pod-Weaver, just that it will not create a separate AUTHORS section. In case you already have a weaver.ini, make sure it does not generate any AUTHORS section.

During the build process, Dist::Zilla will then run "git log" for each processed module and extract the list of authors of the module for each year. Then a copyright section in the POD of each module is created as follows:

  COPYRIGHT AND LICENSE

  This software is copyright (c) 2017 by the Foo::Bar team; in detail:

  Copyright 2014-2015  A. N. Author
            2016       A. N. Author, O. Th. Erautor
            2017       O. Th. Erautor

CONFIGURATION

Not much.

Excluding commits

In case you want to skip some commits which contain trivial, not copyright-relevant changes ("increase version number", "perltidy"), create a text file named .copyright-exclude in the main distribution directory. It should contain exactly one git commit hash per line, nothing else.

Use with care, and only add your own commits!

KNOWN BUGS

There's something fishy with unicode.

AUTHOR

Andreas K. Huettel <dilfridge@gentoo.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by Andreas K. Huettel.

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