some more README tweaks
[bioperl-live.git] / maintenance / authors.pl
blobd3e66eada245b1752236f26a3242d096a5df05aa
1 #!/usr/bin/perl
3 =head1 NAME
5 authors.pl - check modules and scripts for authors not in AUTHORS file
7 =head1 SYNOPSIS
9 B<authors.pl> [B<-d|--dir> path ] [B<-v|--verbose>] B<-a|--authorsfile>
10 [B<-?|-h|--help>]
12 =head1 DESCRIPTION
14 Checks Plain Old Documentation (POD) of all bioperl live modules for
15 AUTHORS and CONTRIBUTORS tags and prints out any emails missing from
16 the AUTHORS file
18 =cut
20 use Data::Dumper;
21 use File::Find;
22 use Getopt::Long;
23 use strict;
25 sub findauthors;
28 # command line options
31 my ($verbose, $dir, $authorsfile, $help) = (0, undef, "../AUTHORS", undef);
32 GetOptions(
33 'v|verbose' => \$verbose,
34 'dir:s' => \$dir,
35 'authorsfile:s' => \$authorsfile,
36 'h|help|?' => sub{ exec('perldoc',$0); exit(0) }
40 # global variables
43 # known authors from the AUTHORS file are read into
44 # the hash which is initialized with known synonymes
45 our %AUTHORS = map {$_=>1} qw{
46 birney@sanger.ac.uk
47 jinsana@gmx.net
48 Insana@ebi.ac.uk
49 fugui@worf.fugu-sg.org
50 cjm@fruitfly.bdgp.berkeley.edu
51 elia@tll.org.sg
52 heikki-at-bioperl-dot-org
53 bioinformatics@dieselwurks.com
54 bioinformatics1@dieselwurks.com
55 bioperl-l@bio.perl.org
56 paul@systemsbiology.org
57 gattiker@isb-sib.ch
58 elia@fugu-sg.org
59 jason@cgt.mc.duke.edu
60 jason@chg.mc.duke.edu
61 jason@open-bio.org
62 hilmar.lapp@pharma.novartis.com
63 richard.adams@ed.ac.uk
64 dblock@gene.pbi.nrc.ca
65 ak@ebi.ac.uk
66 day@cshl.org
67 bala@tll.org.sg
68 mrp@sanger.ac.uk
69 m.w.e.j.fiers@plant.wag-ur.nl
70 cmzmasek@yahoo.com
71 fuguteam@fugu-sg.org
72 shawnh@gmx.net
74 our %NEWAUTHORS; # new authors
75 our %FIND_OPTIONS = ( wanted => \&findauthors, no_chdir => 1 );
78 # Directories to check
79 my @dirs = qw( ../Bio/ ../scripts . );
81 #print Dumper \%AUTHORS;
84 # Read the AUTHORS file
88 open (F, $authorsfile) || die "can't open file $authorsfile: $!";
91 while (<F>) {
92 my ($email) = /([\.\w_-]+ at [\.\w_-]+)/;
93 next unless $email;
94 #print $email, "\n";
95 $email =~ s/ at /@/;
96 $AUTHORS{$email} = 1;
98 close F;
102 # run
105 if ($dir) {
106 find \%FIND_OPTIONS, $dir;
107 } else {
108 find \%FIND_OPTIONS, @dirs;
112 # results
114 print Dumper \%NEWAUTHORS;
119 ### end main
124 # this is where the action is
126 sub findauthors {
127 return unless /\.PLS$/ or /\.p[ml]$/ ;
128 return unless -e $_;
129 print "$_\n" if $verbose;
130 my $filename = $_;
131 #local $/=undef;
132 open F, $_ || die "Could not open file $_";
133 while (<F>) {
134 #print;
135 last if /=head1 +AUTHOR/;
137 my $authorblock;
138 while (<F>) {
139 last if /=head/ and not /CONTRIBUTORS/;
140 $authorblock .= $_;
142 return unless $authorblock;
143 while ( $authorblock =~ /([\.\w_-]+@[\.a-z_-]+)/g) {
144 #my $email = $1;
145 #$email =~ //
146 next if $AUTHORS{$1};
147 #print "$filename\t$1\n";
149 push @{$NEWAUTHORS{$1}}, $filename;
156 =head1 OPTIONS
158 =over 3
160 =item B<-d | --dir> path
162 Overides the default directories to check by one directory 'path' and
163 all its subdirectories.
165 =item B<-a | --authorsfile>
167 path from working directory the AUTHORS file.
169 Redundant as this information could be had from --dir option butI am
170 feeling too lazy to change the code.
172 =cut
174 sub blankline {
175 return unless /\.PLS$/ or /\.p[ml]$/ ;
176 return unless -e $_;
177 my $file = $_;
178 open (F, $_) or warn "can't open file $_: $!" && return;
179 local $/="";
180 while (<F>) {
181 print "$file: +|$1|\n" if /[ \t]\n(=[a-z][^\n]+$)/m and $verbose;
182 print "$file: ++|$1|\n" if /\w\n(=[a-z][^\n]+$)/m and $verbose;
183 print "$file:|$1|+\n" if /(^=[a-z][^\n]+)\n[\t ]/m;
184 #print "$file:|$1|++\n" if /(^=[^\n]+)\n\w/m;
186 close F;
189 __END__
191 =item B<-v | --verbose>
193 Show the progress through files during the POD checking.
195 =item B<-? | -h | --help>
197 This help text.
199 =back
201 =head1 FEEDBACK
203 =head2 Mailing Lists
205 User feedback is an integral part of the evolution of this and other
206 Bioperl modules. Send your comments and suggestions preferably to
207 the Bioperl mailing list. Your participation is much appreciated.
209 bioperl-l@bioperl.org - General discussion
210 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
212 =head2 Reporting Bugs
214 Report bugs to the Bioperl bug tracking system to help us keep track
215 of the bugs and their resolution. Bug reports can be submitted via the
216 web:
218 https://redmine.open-bio.org/projects/bioperl/
220 =head1 AUTHOR - Heikki Lehvaslaiho
222 Email heikki-at-bioperl-dot-org
224 =cut
227 # find . -name '*.pm' -print | xargs perl -e '$/=""; while (<>) {$n = $1 if /^package\s+([\w:]+)/; print "$n:|$1|" if /(\s\s^=[^\n]+$)/m ; }' ;
229 # find . -name '*.pm' -print | xargs perl -e '$/=""; while (<>) {$n = $1 if /^package\s+([\w:]+)/; print "$n:|$1|\n" if /(^=[^\n]+\n[\t ])/m ; }' ;