Permalink
Browse files

added cpan/backpan 100 files to CPAN Stats page creation

  • Loading branch information...
1 parent d294d7a commit 714a86e19b24ac4849a5db98202699daf4f56f84 @barbie committed May 18, 2014
Showing with 34 additions and 3 deletions.
  1. +2 −0 Changes
  2. +2 −2 bin/getmailrc.pl
  3. +30 −1 lib/CPAN/Testers/WWW/Statistics/Pages.pm
View
@@ -1,6 +1,8 @@
Revision history for CPAN-Testers-WWW-Statistics
================================================
+ - added cpan/backpan 100 files to CPAN Stats page creation.
+
1.11 2014-05-11
- build performance data in isolation.
View
@@ -74,7 +74,7 @@ =head1 COPYRIGHT AND LICENSE
Copyright (C) 2008-2013 Barbie for Miss Barbell Productions.
- This module is free software; you can redistribute it and/or
- modify it under the same terms as Perl itself.
+ This distribution is free software; you can redistribute it and/or
+ modify it under the Artistic Licence v2.
=cut
@@ -943,6 +943,34 @@ sub _report_cpan {
}
$self->_writepage('statscpan',\%tvars);
+
+
+ $self->{parent}->_log("building cpan/backpan 100s");
+
+ $self->_count_mailrc();
+ my $directory = $self->{parent}->directory;
+ my $results = "$directory/stats";
+ mkpath($results);
+
+ # calculate CPAN 100 data
+ my @rows = $self->{parent}->{CPANSTATS}->get_query('hash',"SELECT t.author,t.count FROM (SELECT author,count(distinct dist) AS count FROM uploads WHERE type!='backpan' GROUP BY author ORDER BY count DESC LIMIT 100) AS t WHERE t.count >= 100");
+ my $fh = IO::File->new(">$results/cpan100.csv");
+ printf $fh "# DATE: %s\n", DateTime->now->datetime;
+ print $fh "#Pause,Count,Name\n";
+ for my $row (@rows) {
+ printf $fh "%s,%d,%s\n", $row->{author}, $row->{count}, $self->{alias}{$row->{author}}||'???';
+ }
+ $fh->close;
+
+ # calculate BACKCPAN 100 data
+ my @rows = $self->{parent}->{CPANSTATS}->get_query('hash',"SELECT t.author,t.count FROM (SELECT author,count(distinct dist) AS count FROM uploads GROUP BY author ORDER BY count DESC LIMIT 100) AS t WHERE t.count >= 100");
+ my $fh = IO::File->new(">$results/backpan100.csv");
+ printf $fh "# DATE: %s\n", DateTime->now->datetime;
+ print $fh "#Pause,Count,Name\n";
+ for my $row (@rows) {
+ printf $fh "%s,%d,%s\n", $row->{author}, $row->{count}, $self->{alias}{$row->{author}}||'???';
+ }
+ $fh->close;
}
sub _update_noreports {
@@ -1945,7 +1973,8 @@ sub _count_mailrc {
my $fh = IO::File->new($mailrc,'r') or die "Cannot read file [$mailrc]: $!\n";
while(<$fh>) {
- next unless(/^alias\s*\w/);
+ next unless(/^alias\s*(\w+)\s+"([\s\w]+)\s+<[^>]+>"/);
+ $self->{alias}{$1} = $2;
$count++;
}
$fh->close;

0 comments on commit 714a86e

Please sign in to comment.