Skip to content

Commit

Permalink
added more report handling and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
barbie committed Apr 4, 2009
1 parent 0fc8f3f commit f28f1e4
Show file tree
Hide file tree
Showing 16 changed files with 309 additions and 99 deletions.
5 changes: 5 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
Revision history for Perl module CPAN::Testers::WWW::Reports::Mailer.

0.15 04/04/2009
- added support for monthly and named day weekly reports.
- added support for individual reports
- added more tests

0.14 29/01/2009
- added author check in case lookup failed.
- fixed preferences bug for new authors.
Expand Down
3 changes: 3 additions & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ MANIFEST
META.yml
README
t/01base.t
t/05setup_db-articles.t
t/05setup_db-cpanprefs.t
t/05setup_db-cpanstats.t
t/20attributes.t
Expand All @@ -23,5 +24,7 @@ t/CTWRM_Testing.pm
t/90podtest.t
t/91podcover.t
t/94metatest.t
t/95changedate.t
templates/mailer.eml
templates/notification.eml
templates/report.eml
7 changes: 5 additions & 2 deletions META.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: CPAN-Testers-WWW-Reports-Mailer
version: 0.14
version: 0.15
abstract: CPAN Testers Reports Mailer
author:
- Barbie <barbie@cpan.org>
Expand All @@ -14,11 +14,14 @@ requires:
Config::IniFiles: 0
Class::Accessor::Chained::Fast: 0
CPAN::Testers::Common::DBUtils: 0.03
Email::Simple: 0
File::Basename: 0
File::Slurp: 0
Getopt::ArgvFile: 0
Getopt::Long: 0
LWP::UserAgent: 0
MIME::Base64: 0
MIME::QuotedPrint: 0
Path::Class: 0
Parse::CPAN::Authors: 0
Template: 0
Expand All @@ -30,7 +33,7 @@ requires:
provides:
CPAN::Testers::WWW::Reports::Mailer:
file: lib/CPAN/Testers/WWW/Reports/Mailer.pm
version: 0.14
version: 0.15

meta-spec:
version: 1.4
Expand Down
3 changes: 3 additions & 0 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ WriteMakefile(
'Config::IniFiles' => 0,
'Class::Accessor::Chained::Fast' => 0,
'CPAN::Testers::Common::DBUtils' => 0.03,
'Email::Simple' => 0,
'File::Basename' => 0,
'File::Slurp' => 0,
'Getopt::ArgvFile' => 0,
'Getopt::Long' => 0,
'LWP::UserAgent' => 0,
'MIME::Base64' => 0,
'MIME::QuotedPrint' => 0,
'Path::Class' => 0,
'Parse::CPAN::Authors' => 0,
'Template' => 0,
Expand Down
6 changes: 2 additions & 4 deletions bin/cpanreps-mailer
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use strict;
$|++;

my $VERSION = '0.05';
my $VERSION = '0.06';

#----------------------------------------------------------------------------

Expand Down Expand Up @@ -35,9 +35,7 @@ use CPAN::Testers::WWW::Reports::Mailer;
# default is debug mode on, thus no mails are sent, need to
# force this to 0 to ensure mails do get sent correctly.

my $mailer = CPAN::Testers::WWW::Reports::Mailer->new(
debug => 1
);
my $mailer = CPAN::Testers::WWW::Reports::Mailer->new();

$mailer->check_reports();
$mailer->check_counts();
Expand Down
35 changes: 32 additions & 3 deletions examples/cpanprefs-mailer.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
date >xx.out
perl bin/cpanstats-mailer --config=data/settings-example.ini >>xx.out 2>xx.err
date >>xx.out
#!/usr/bin/bash

cd /opt/projects/cpantesters/reports-mailer
mkdir -p logs

date_format="%Y/%m/%d %H:%M:%S"
echo `date +"$date_format"` "START" >>logs/xx.out
echo `date +"$date_format"` "START" >>logs/xx.err

# run the daily reports
perl bin/cpanreps-mailer --config=data/preferences-daily.ini --debug >>logs/xx.out 2>>logs/xx.err

# run the named weekly reports
day=`date +"%a"`
perl bin/cpanreps-mailer --config=data/preferences-weekly.ini --mode=$day --debug >>logs/xx.out 2>>logs/xx.err

# run the generic weekly on a Saturday morning
if [ `date +"%w"` -eq 6 ]; then
perl bin/cpanreps-mailer --config=data/preferences-weekly.ini --debug >>logs/xx.out 2>>logs/xx.err
fi

# run the monthly on the first day of the month
if [ `date +"%-d"` -eq 1 ]; then
perl bin/cpanreps-mailer --config=data/preferences.ini --mode=monthly --logfile=logs/monthly-mailer.log --debug >>logs/xx.out 2>>logs/xx.err
fi

# produce the individual reports
perl bin/cpanreps-mailer --config=data/preferences.ini --mode=reports --logfile=logs/reports-mailer.log --debug >>logs/xx.out 2>>logs/xx.err

echo `date +"$date_format"` "STOP" >>logs/xx.out
echo `date +"$date_format"` "STOP" >>logs/xx.err

4 changes: 4 additions & 0 deletions examples/settings-example.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ dbhost=localhost
dbuser=username
dbpass=password

[ARTICLES]
driver=SQLite
database=../db/articles.db

[SETTINGS]
debug=1
logfile=logs/cpanreps.log
Expand Down
Loading

0 comments on commit f28f1e4

Please sign in to comment.