From: Peter Rabbitson Date: Mon, 22 Sep 2014 10:35:38 +0000 (+0200) Subject: Deal with authorship properly, in a future-sustainable fashion X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3440100bc0455cf0e7ccbba03754a29ad26ec6d1;p=dbsrgits%2FDBIx-Class-Historic.git Deal with authorship properly, in a future-sustainable fashion This module is arguably one of the most successful collaborative projects on CPAN. Make it known to the world by introducing a clear canonical source of authorship metadata. I have been holding off jumping on the "contributors from git" bandwagon because of multiple issues - Not every contribution results in a direct, attributtable commit - We already had an extensive contributor list, much larger than the shortlog - Loss of ircnicks (a fine tradition started in 266bdcc3) So this commit does the proverbial bullet-biting and introduces *proper* handling of all the ins and outs, including author-mode (CI as well) tests for proper attribution. As a side-effect we break a lot of the footer links, to be fixed in next commit. Btw as I write this `195 contributors made this library what it is today`... Mind. Blown. --- diff --git a/.mailmap b/.mailmap index 866b3cc..2164555 100644 --- a/.mailmap +++ b/.mailmap @@ -5,13 +5,16 @@ # https://www.kernel.org/pub/software/scm/git/docs/git-shortlog.html#_mapping_authors Alexander Hartmaier +Alexander Kuznetsov Amiri Barksdale Andrew Rodland Arthur Axel "fREW" Schmidt -Brendan Byrd -Brendan Byrd -Brendan Byrd +Ash Berlin +Brendan Byrd +Brendan Byrd +Brendan Byrd Brian Phillips +Christian Walde Jess Robinson Dagfinn Ilmari Mannsåker David Kamholz @@ -21,17 +24,22 @@ David Schmidt Devin Austin Duncan Garland Felix Antonius Wilhelm Ostmann +Fitz Elliott Gerda Shank Gianni Ceccarelli Gordon Irving Hakim Cassimally +Jason M. Mills Jonathan Chu Jose Luis Martinez Matt Phillips Norbert Csongrádi Peter Rabbitson Roman Filippov +Ronald J Kimball Samuel Kaufman Tim Bunce Toby Corkindale +Tommy Butler +Ton Voon Wallace Reis diff --git a/AUTHORS b/AUTHORS index d3352f0..b0f74ed 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,303 +1,211 @@ -abraxxa: Alexander Hartmaier +# +# The list of the awesome folks behind DBIx::Class +# +# This utf8-encoded file lists every code author and idea contributor +# in alphabetical order +# +# Entry format (all elements optional, order is mandatory): +# (ircnick:) (name) () +# +# +# *** EVEN THOUGH FIELDS ARE OPTIONAL, COMMITTERS ARE QUITE *** +# *** STRONGLY URGED TO KEEP THIS LIST AS COMPLETE AS POSSIBLE *** +# +# *** IN OTHER WORDS - DO NOT BE LAZY *** +# +abraxxa: Alexander Hartmaier acca: Alexander Kuznetsov - aherzog: Adam Herzog - Alexander Keusch - alexrj: Alessandro Ranellucci - -alnewkirk: Al Newkirk - -amiri: Amiri Barksdale - +alnewkirk: Al Newkirk +amiri: Amiri Barksdale amoore: Andrew Moore - Andrew Mehta - andrewalker: Andre Walker - andyg: Andy Grundman - -ank: Andres Kievsky - +ank: Andres Kievsky arc: Aaron Crane - arcanez: Justin Hunter - ash: Ash Berlin - bert: Norbert Csongrádi - bfwg: Colin Newell - blblack: Brandon L. Black - bluefeet: Aran Deltac - -bphillips: Brian Phillips - boghead: Bryan Beeley - +bphillips: Brian Phillips brd: Brad Davis - +Brian Kirkbride bricas: Brian Cassidy - brunov: Bruno Vecchi - caelum: Rafael Kitover - caldrin: Maik Hentsche - -castaway: Jess Robinson - -claco: Christopher H. Laco - -clkao: CL Kao - -Ctrl-o L - -da5id: David Jack Olrik - +castaway: Jess Robinson +chorny: Alexandr Ciornii +claco: Christopher H. Laco +clkao: CL Kao +Ctrl-O http://ctrlo.com/ +da5id: David Jack Olrik +dams: Damien Krotkine +dandv: Dan Dascalescu dariusj: Darius Jokilehto - -davewood: David Schmidt - +davewood: David Schmidt daxim: Lars Dɪᴇᴄᴋᴏᴡ 迪拉斯 - +dduncan: Darren Duncan debolaz: Anders Nor Berle - dew: Dan Thomas - dim0xff: Dmitry Latin - dkubb: Dan Kubb - dnm: Justin Wheeler - dpetrov: Dimitar Petrov - +dsteinbrunner: David Steinbrunner duncan_dmg: Duncan Garland - dwc: Daniel Westermann-Clark - dyfrgi: Michael Leuchtenburg - edenc: Eden Cardim - -Eligo L - +Eligo http://eligo.co.uk/ ether: Karen Etheridge - +evdb: Edmund von der Burg +faxm0dem: Fabien Wernli felliott: Fitz Elliott - freetime: Bill Moseley - frew: Arthur Axel "fREW" Schmidt - +gbjk: Gareth Kirwan +Getty: Torsten Raudssus goraxe: Gordon Irving - gphat: Cory G Watson - -Grant Street Group L - +Grant Street Group http://www.grantstreet.com/ groditi: Guillermo Roditi - +gshank: Gerda Shank guacamole: Fred Steinberg - Haarg: Graham Knop - -hobbs: Andrew Rodland - +hobbs: Andrew Rodland +Ian Wells idn: Ian Norton - -ilmari: Dagfinn Ilmari MannsEker - +ilmari: Dagfinn Ilmari Mannsåker initself: Mike Baas - ironcamel: Naveed Massjouni - -jawnsy: Jonathan Yu - jasonmay: Jason May - +jawnsy: Jonathan Yu jegade: Jens Gassmann - jeneric: Eric A. Miller - -jesper: Jesper Krogh - +jesper: Jesper Krogh +Jesse Sheidlower jgoulah: John Goulah - jguenther: Justin Guenther - jhannah: Jay Hannah - jmac: Jason McIntosh - +jmmills: Jason M. Mills jnapiorkowski: John Napiorkowski - -jon: Jon Schutz - Joe Carlson - +jon: Jon Schutz +Jordan Metzmeier jshirley: J. Shirley - kaare: Kaare Rasmussen - -konobi: Scott McWhirter - +kd: Kieren Diment +konobi: Scott McWhirter +lejeunerenard: Sean Zellmer littlesavage: Alexey Illarionov - lukes: Luke Saunders - marcus: Marcus Ramberg - +mateu: Mateu X. Hunter +Matt LeBlanc +Matt Sickler mattlaw: Matt Lawrence - mattp: Matt Phillips - mdk: Mark Keating - -mna: Maya - +melo: Pedro Melo +metaperl: Terrence Brannon michaelr: Michael Reddick - milki: Jonathan Chu - minty: Murray Walker - mithaldu: Christian Walde - mjemmeson: Michael Jemmeson - +mna: Maya +mo: Moritz Onken +moltar: Roman Filippov +moritz: Moritz Lenz mrf: Mike Francis - +mst: Matt S. Trout mstratman: Mark A. Stratman - -ned: Neil de Carteret - +ned: Neil de Carteret nigel: Nigel Metheringham - ningu: David Kamholz - Nniuq: Ron "Quinn" Straight" - norbi: Norbert Buchmuller - +nothingmuch: Yuval Kogman nuba: Nuba Princigalli - Numa: Dan Sully - oalders: Olaf Alders - +Olly Betts +osfameron: Hakim Cassimally ovid: Curtis "Ovid" Poe - -oyse: Eystein Torget - -paulm: Paul Makepeace - -penguin: K J Cheetham - +oyse: Øystein Torget +paulm: Paul Makepeace +penguin: K J Cheetham perigrin: Chris Prather - -peter: Peter Collingbourne - Peter Siklósi - -Peter Valdemar MErch - +Peter Valdemar Mørch +peter: Peter Collingbourne phaylon: Robert Sedlacek - plu: Johannes Plunien - -pplu: Jose Luis Martinez - Possum: Daniel LeWarne - -quicksilver: Jules Bean - +pplu: Jose Luis Martinez +quicksilver: Jules Bean +racke: Stefan Hornburg rafl: Florian Ragwitz - rainboxx: Matthias Dietrich - -Relequestual: Ben Hutton - rbo: Robert Bohne - rbuels: Robert Buels - rdj: Ryan D Johnson - +Relequestual: Ben Hutton +renormalist: Steffen Schwigon ribasushi: Peter Rabbitson - rjbs: Ricardo Signes - -robkinyon: Rob Kinyon - +Robert Krimen Robert Olson - -moltar: Roman Filippov - +robkinyon: Rob Kinyon +Roman Ardern-Corris +ruoso: Daniel Ruoso Sadrak: Felix Antonius Wilhelm Ostmann - sc_: Just Another Perl Hacker - +schwern: Michael G Schwern +Scott R. Godin scotty: Scotty Allen - semifor: Marc Mims - -SineSwiper: Brendan Byrd - +Simon Elliott +SineSwiper: Brendan Byrd skaufman: Samuel Kaufman - solomon: Jared Johnson - spb: Stephen Bennett - Squeeks - +srezic: Slaven Rezic sszabo: Stephan Szabo - Stephen Peters - +stonecolddevin: Devin Austin talexb: Alex Beamish - tamias: Ronald J Kimball - TBSliver: Tom Bloor - teejay : Aaron Trevena - theorbtwo: James Mastros - +Thomas Kratz +timbunce: Tim Bunce Todd Lipcon - -Tom Hukins - -tonvoon: Ton Voon - +Tom Hukins +tommy: Tommy Butler +tonvoon: Ton Voon triode: Pete Gamache - typester: Daisuke Murase - +uree: Oriol Soriano +uwe: Uwe Voelker victori: Victor Igumnov - -wdh: Will Hawes - +wdh: Will Hawes wesm: Wes Malone - willert: Sebastian Willert - +wintermute: Toby Corkindale wreis: Wallace Reis - xenoterracide: Caleb Cushing - -uree: Oriol Soriano - yrlnry: Mark Jason Dominus - zamolxes: Bogdan Lucaciu - Zefram: Andrew Main diff --git a/MANIFEST.SKIP b/MANIFEST.SKIP index 5e2f3f3..bc654e4 100644 --- a/MANIFEST.SKIP +++ b/MANIFEST.SKIP @@ -1,4 +1,4 @@ -^(?!script/|examples/|lib/|inc/|t/|xt/|Makefile\.PL$|maint/|README$|MANIFEST$|Changes$|META\.(?:yml|json)$) +^(?!script/|examples/|lib/|inc/|t/|xt/|Makefile\.PL$|maint/|README$|MANIFEST$|Changes$|AUTHORS$|META\.(?:yml|json)$) # Avoid version control files. \bRCS\b diff --git a/Makefile.PL b/Makefile.PL index 20d0404..ad540f1 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -206,7 +206,12 @@ for my $mod (sort keys %final_req) { # IFF we are running interactively auto_install(); -WriteAll(); +{ + # M::I understands unicode in meta but does not write with the right + # layers - fhtagn!!! + local $SIG{__WARN__} = sub { warn $_[0] unless $_[0] =~ /Wide character in print/ }; + WriteAll(); +} exit 0; diff --git a/lib/DBIx/Class.pm b/lib/DBIx/Class.pm index 2508368..b2bcb12 100644 --- a/lib/DBIx/Class.pm +++ b/lib/DBIx/Class.pm @@ -283,323 +283,26 @@ accessible at the following locations: =back -=head1 AUTHOR +=head1 AUTHORS -mst: Matt S. Trout +Even though a large portion of the source I to be written by just a +handful of people, this library continues to remain a collaborative effort - +perhaps one of the most successful such projects on L. +It is important to remember that ideas do not always result in a direct code +contribution, but deserve acknowledgement just the same. Time and time again +the seemingly most insignificant questions and suggestions have been shown +to catalyze monumental improvements in consistency, accuracy and performance. -(I mostly consider myself "project founder" these days but the AUTHOR heading -is traditional :) +=for comment this line is replaced with the author list at dist-building time -=head1 CONTRIBUTORS - -abraxxa: Alexander Hartmaier - -acca: Alexander Kuznetsov - -aherzog: Adam Herzog - -Alexander Keusch - -alexrj: Alessandro Ranellucci - -alnewkirk: Al Newkirk - -amiri: Amiri Barksdale - -amoore: Andrew Moore - -Andrew Mehta - -andrewalker: Andre Walker - -andyg: Andy Grundman - -ank: Andres Kievsky - -arc: Aaron Crane - -arcanez: Justin Hunter - -ash: Ash Berlin - -bert: Norbert Csongrádi - -bfwg: Colin Newell - -blblack: Brandon L. Black - -bluefeet: Aran Deltac - -bphillips: Brian Phillips - -boghead: Bryan Beeley - -brd: Brad Davis - -bricas: Brian Cassidy - -brunov: Bruno Vecchi - -caelum: Rafael Kitover - -caldrin: Maik Hentsche - -castaway: Jess Robinson - -claco: Christopher H. Laco - -clkao: CL Kao - -Ctrl-o L - -da5id: David Jack Olrik - -dariusj: Darius Jokilehto - -davewood: David Schmidt - -daxim: Lars Dɪᴇᴄᴋᴏᴡ 迪拉斯 - -debolaz: Anders Nor Berle - -dew: Dan Thomas - -dim0xff: Dmitry Latin - -dkubb: Dan Kubb - -dnm: Justin Wheeler - -dpetrov: Dimitar Petrov - -duncan_dmg: Duncan Garland - -dwc: Daniel Westermann-Clark - -dyfrgi: Michael Leuchtenburg - -edenc: Eden Cardim - -Eligo L - -ether: Karen Etheridge - -felliott: Fitz Elliott - -freetime: Bill Moseley - -frew: Arthur Axel "fREW" Schmidt - -goraxe: Gordon Irving - -gphat: Cory G Watson - -Grant Street Group L - -groditi: Guillermo Roditi - -guacamole: Fred Steinberg - -Haarg: Graham Knop - -hobbs: Andrew Rodland - -idn: Ian Norton - -ilmari: Dagfinn Ilmari MannsEker - -initself: Mike Baas - -ironcamel: Naveed Massjouni - -jawnsy: Jonathan Yu - -jasonmay: Jason May - -jegade: Jens Gassmann - -jeneric: Eric A. Miller - -jesper: Jesper Krogh - -jgoulah: John Goulah - -jguenther: Justin Guenther - -jhannah: Jay Hannah - -jmac: Jason McIntosh - -jnapiorkowski: John Napiorkowski - -jon: Jon Schutz - -Joe Carlson - -jshirley: J. Shirley - -kaare: Kaare Rasmussen - -konobi: Scott McWhirter - -littlesavage: Alexey Illarionov - -lukes: Luke Saunders - -marcus: Marcus Ramberg - -mattlaw: Matt Lawrence - -mattp: Matt Phillips - -mdk: Mark Keating - -mna: Maya - -michaelr: Michael Reddick - -milki: Jonathan Chu - -minty: Murray Walker - -mithaldu: Christian Walde - -mjemmeson: Michael Jemmeson - -mrf: Mike Francis - -mstratman: Mark A. Stratman - -ned: Neil de Carteret - -nigel: Nigel Metheringham - -ningu: David Kamholz - -Nniuq: Ron "Quinn" Straight" - -norbi: Norbert Buchmuller - -nuba: Nuba Princigalli - -Numa: Dan Sully - -oalders: Olaf Alders - -ovid: Curtis "Ovid" Poe - -oyse: Eystein Torget - -paulm: Paul Makepeace - -penguin: K J Cheetham - -perigrin: Chris Prather - -peter: Peter Collingbourne - -Peter Siklósi - -Peter Valdemar MErch - -phaylon: Robert Sedlacek - -plu: Johannes Plunien - -pplu: Jose Luis Martinez - -Possum: Daniel LeWarne - -quicksilver: Jules Bean - -rafl: Florian Ragwitz - -rainboxx: Matthias Dietrich - -Relequestual: Ben Hutton - -rbo: Robert Bohne - -rbuels: Robert Buels - -rdj: Ryan D Johnson - -ribasushi: Peter Rabbitson - -rjbs: Ricardo Signes - -robkinyon: Rob Kinyon - -Robert Olson - -moltar: Roman Filippov - -Sadrak: Felix Antonius Wilhelm Ostmann - -sc_: Just Another Perl Hacker - -scotty: Scotty Allen - -semifor: Marc Mims - -SineSwiper: Brendan Byrd - -skaufman: Samuel Kaufman - -solomon: Jared Johnson - -spb: Stephen Bennett - -Squeeks - -sszabo: Stephan Szabo - -Stephen Peters - -talexb: Alex Beamish - -tamias: Ronald J Kimball - -TBSliver: Tom Bloor - -teejay : Aaron Trevena - -theorbtwo: James Mastros - -Todd Lipcon - -Tom Hukins - -tonvoon: Ton Voon - -triode: Pete Gamache - -typester: Daisuke Murase - -victori: Victor Igumnov - -wdh: Will Hawes - -wesm: Wes Malone - -willert: Sebastian Willert - -wreis: Wallace Reis - -xenoterracide: Caleb Cushing - -uree: Oriol Soriano - -yrlnry: Mark Jason Dominus - -zamolxes: Bogdan Lucaciu - -Zefram: Andrew Main +The canonical source of authors and their details is the F file at +the root of this distribution (or repository). The canonical source of +per-line authorship is the L history +itself. =head1 COPYRIGHT -Copyright (c) 2005 - 2011 the DBIx::Class L and L -as listed above. +Copyright (c) 2005 the DBIx::Class L as listed above. =head1 LICENSE diff --git a/lib/DBIx/Class/Manual/Features.pod b/lib/DBIx/Class/Manual/Features.pod index 523e927..b288ad2 100644 --- a/lib/DBIx/Class/Manual/Features.pod +++ b/lib/DBIx/Class/Manual/Features.pod @@ -6,9 +6,9 @@ DBIx::Class::Manual::Features - A boatload of DBIx::Class features with links to =head2 Large Community -Currently there are 88 people listed as contributors to DBIC. That ranges -from documentation help, to test help, to added features, to entire database -support. +There are L listed in +F. That ranges from documentation help, to test help, to added +features, to entire database support. =head2 Active Community diff --git a/maint/Makefile.PL.inc/12_authordeps.pl b/maint/Makefile.PL.inc/12_authordeps.pl index 152a390..3e3caa3 100644 --- a/maint/Makefile.PL.inc/12_authordeps.pl +++ b/maint/Makefile.PL.inc/12_authordeps.pl @@ -91,6 +91,9 @@ END { if (keys %removed_build_requires) { print "Regenerating META with author requires excluded\n"; + # M::I understands unicode in meta but does not write with the right + # layers - fhtagn!!! + local $SIG{__WARN__} = sub { warn $_[0] unless $_[0] =~ /Wide character in print/ }; Meta->write; } diff --git a/maint/Makefile.PL.inc/21_set_meta.pl b/maint/Makefile.PL.inc/21_set_meta.pl index e489860..845728e 100644 --- a/maint/Makefile.PL.inc/21_set_meta.pl +++ b/maint/Makefile.PL.inc/21_set_meta.pl @@ -1,7 +1,26 @@ -# authorshipz -author 'mst: Matt S. Trout '; +# principal author list is kinda mandated by spec, luckily is rather static +author 'mst: Matt S Trout (project founder - original idea, architecture and implementation)'; +author 'castaway: Jess Robinson (lions share of the reference documentation and manuals)'; +author 'ribasushi: Peter Rabbitson (present day maintenance and controlled evolution)'; + +# pause sanity Meta->{values}{x_authority} = 'cpan:RIBASUSHI'; +# populate x_contributors +# a direct dump of the sort is ok - xt/authors.t guarantees source sanity +Meta->{values}{x_contributors} = [ do { + # according to #p5p this is how one safely reads random unicode + # this set of boilerplate is insane... wasn't perl unicode-king...? + no warnings 'once'; + require Encode; + require PerlIO::encoding; + local $PerlIO::encoding::fallback = Encode::FB_CROAK(); + + open (my $fh, '<:encoding(UTF-8)', 'AUTHORS') or die "Unable to open AUTHORS - can't happen: $!\n"; + map { chomp; ( (! $_ or $_ =~ /^\s*\#/) ? () : $_ ) } <$fh>; + +}]; + # legalese license 'perl'; resources 'license' => 'http://dev.perl.org/licenses/'; diff --git a/maint/Makefile.PL.inc/53_autogen_pod.pl b/maint/Makefile.PL.inc/53_autogen_pod.pl index fb222ee..ff72fd9 100644 --- a/maint/Makefile.PL.inc/53_autogen_pod.pl +++ b/maint/Makefile.PL.inc/53_autogen_pod.pl @@ -93,6 +93,32 @@ EOP } +# generate the DBIx/Class.pod only during distdir +{ + my $dist_pod_fn = File::Spec->catfile($pod_dir, qw(lib DBIx Class.pod)); + + postamble <<"EOP"; + +clonedir_generate_files : dbic_distdir_gen_dbic_pod + +dbic_distdir_gen_dbic_pod : + +\tperldoc -u lib/DBIx/Class.pm > $dist_pod_fn +\t@{[ $mm_proto->oneliner( + "s!^.*?this line is replaced with the author list.*! qq{List of the awesome contributors who made DBIC v$ver possible\n\n} . qx(\$^X -Ilib maint/gen_pod_authors)!me", + [qw( -0777 -p -i )] +) ]} $dist_pod_fn + +create_distdir : dbic_distdir_defang_authors + +# Remove the maintainer-only warning (be nice ;) +dbic_distdir_defang_authors : +\t@{[ $mm_proto->oneliner('s/ ^ \s* \# \s* \*\*\* .+ \n ( ^ \s* \# \s*? \n )? //xmg', [qw( -0777 -p -i )] ) ]} \$(DISTVNAME)/AUTHORS + +EOP +} + + # on some OSes generated files may have an incorrect \n - fix it # so that the xt tests pass on a fresh checkout (also shipping a # dist with CRLFs is beyond obnoxious) diff --git a/maint/Makefile.PL.inc/52_autogen_README.pl b/maint/Makefile.PL.inc/54_autogen_README.pl similarity index 86% rename from maint/Makefile.PL.inc/52_autogen_README.pl rename to maint/Makefile.PL.inc/54_autogen_README.pl index 0f4a38c..cadb401 100644 --- a/maint/Makefile.PL.inc/52_autogen_README.pl +++ b/maint/Makefile.PL.inc/54_autogen_README.pl @@ -13,9 +13,9 @@ postamble <<"EOP"; clonedir_generate_files : dbic_clonedir_gen_readme -dbic_clonedir_gen_readme : +dbic_clonedir_gen_readme : dbic_distdir_gen_dbic_pod \t@{[ $mm_proto->oneliner('mkpath', ['-MExtUtils::Command']) ]} $dir -\tpod2text lib/DBIx/Class.pm > $fn +\tpod2text $dir/lib/DBIx/Class.pod > $fn EOP diff --git a/maint/gen_pod_authors b/maint/gen_pod_authors new file mode 100755 index 0000000..0bfa32c --- /dev/null +++ b/maint/gen_pod_authors @@ -0,0 +1,24 @@ +#!/usr/bin/env perl + +use warnings; +use strict; + +# we will be outputting *ENCODED* utf8, hence the raw open below +# the file is already sanity-checked by xt/authors.t +my @known_authors = do { + open (my $fh, '<:raw', 'AUTHORS') or die "Unable to open AUTHORS - can't happen: $!\n"; + map { chomp; ( ( ! $_ or $_ =~ /^\s*\#/ ) ? () : $_ ) } <$fh>; +} or die "Known AUTHORS file seems empty... can't happen..."; + +$_ =~ s!( \b https? :// [^\s\>]+ )!L<$1|$1>!x + for @known_authors; + +print join "\n\n", + '=encoding utf8', + '=over', + @known_authors, + '=back', + '', +; + +1; diff --git a/xt/authors.t b/xt/authors.t new file mode 100644 index 0000000..5eb533b --- /dev/null +++ b/xt/authors.t @@ -0,0 +1,77 @@ +use warnings; +use strict; + +use Test::More; +use Config; +use File::Spec; + +my @known_authors = do { + # according to #p5p this is how one safely reads random unicode + # this set of boilerplate is insane... wasn't perl unicode-king...? + no warnings 'once'; + require Encode; + require PerlIO::encoding; + local $PerlIO::encoding::fallback = Encode::FB_CROAK(); + + open (my $fh, '<:encoding(UTF-8)', 'AUTHORS') or die "Unable to open AUTHORS - can't happen: $!\n"; + map { chomp; ( ( ! $_ or $_ =~ /^\s*\#/ ) ? () : $_ ) } <$fh>; + +} or die "Known AUTHORS file seems empty... can't happen..."; + +is_deeply ( + [ grep { /^\s/ } @known_authors ], + [], + "No entries with leading space", +); + +is_deeply ( + \@known_authors, + [ sort { lc $a cmp lc $b } @known_authors ], + 'Author list is case-insensitively sorted' +); + +my $email_re = qr/( \< [^\<\>]+ \> ) $/x; + +my (%known_authors, $count); +for (@known_authors) { + my ($name_email) = m/ ^ (?: [^\:]+ \: \s )? (.+) /x; + my ($email) = $name_email =~ $email_re; + + if ( + $known_authors{$name_email}++ + or + ( $email and $known_authors{$email}++ ) + ) { + fail "Duplicate found: $name_email"; + } + else { + $count++; + } +} + +# do not announce anything under travis - we are watching for STDERR silence +diag "\n\n$count contributors made this library what it is today\n\n" + unless ($ENV{TRAVIS}||'') eq 'true'; + +# augh taint mode +if (length $ENV{PATH}) { + ( $ENV{PATH} ) = join ( $Config{path_sep}, + map { length($_) ? File::Spec->rel2abs($_) : () } + split /\Q$Config{path_sep}/, $ENV{PATH} + ) =~ /\A(.+)\z/; +} + +# this may fail - not every system has git +if (my @git_authors = map + { my ($gitname) = m/^ \s* \d+ \s* (.+?) \s* $/mx; utf8::decode($gitname); $gitname } + qx( git shortlog -e -s ) +) { + for (@git_authors) { + my ($eml) = $_ =~ $email_re; + + fail "Commit author '$_' (from git) not reflected in AUTHORS, perhaps a missing .mailmap entry?" + unless $known_authors{$eml}; + } +} + +done_testing;