[Rt-commit] r5456 - in Test-Chimps-Anna: . branches trunk
trunk/Test-Chimps-Anna trunk/lib trunk/lib/Test
trunk/lib/Test/Chimps trunk/t
zev at bestpractical.com
zev at bestpractical.com
Fri Jun 23 18:17:58 EDT 2006
Author: zev
Date: Fri Jun 23 18:17:57 2006
New Revision: 5456
Added:
Test-Chimps-Anna/branches/
Test-Chimps-Anna/trunk/
Test-Chimps-Anna/trunk/Changes
Test-Chimps-Anna/trunk/MANIFEST
Test-Chimps-Anna/trunk/Makefile.PL
Test-Chimps-Anna/trunk/README
Test-Chimps-Anna/trunk/Test-Chimps-Anna/
Test-Chimps-Anna/trunk/Test-Chimps-Anna/.cvsignore
Test-Chimps-Anna/trunk/bin/
Test-Chimps-Anna/trunk/bin/anna.pl (contents, props changed)
Test-Chimps-Anna/trunk/lib/
Test-Chimps-Anna/trunk/lib/Test/
Test-Chimps-Anna/trunk/lib/Test/Chimps/
Test-Chimps-Anna/trunk/lib/Test/Chimps/Anna.pm
Test-Chimps-Anna/trunk/t/
Test-Chimps-Anna/trunk/t/00-load.t
Test-Chimps-Anna/trunk/t/boilerplate.t
Test-Chimps-Anna/trunk/t/pod-coverage.t
Test-Chimps-Anna/trunk/t/pod.t
Modified:
Test-Chimps-Anna/ (props changed)
Log:
r9740 at galvatron: zev | 2006-06-23 18:17:51 -0400
initial commit of Anna
Added: Test-Chimps-Anna/trunk/Changes
==============================================================================
--- (empty file)
+++ Test-Chimps-Anna/trunk/Changes Fri Jun 23 18:17:57 2006
@@ -0,0 +1,5 @@
+Revision history for Test-Chimps-Anna
+
+0.01 Date/time
+ First version, released on an unsuspecting world.
+
Added: Test-Chimps-Anna/trunk/MANIFEST
==============================================================================
--- (empty file)
+++ Test-Chimps-Anna/trunk/MANIFEST Fri Jun 23 18:17:57 2006
@@ -0,0 +1,10 @@
+Changes
+MANIFEST
+META.yml # Will be created by "make dist"
+Makefile.PL
+README
+lib/Test/Chimps/Anna.pm
+t/00-load.t
+t/boilerplate.t
+t/pod-coverage.t
+t/pod.t
Added: Test-Chimps-Anna/trunk/Makefile.PL
==============================================================================
--- (empty file)
+++ Test-Chimps-Anna/trunk/Makefile.PL Fri Jun 23 18:17:57 2006
@@ -0,0 +1,16 @@
+use strict;
+use warnings;
+use ExtUtils::MakeMaker;
+
+WriteMakefile(
+ NAME => 'Test::Chimps::Anna',
+ AUTHOR => 'Zev Benjamin <zev at cpan.org>',
+ VERSION_FROM => 'lib/Test/Chimps/Anna.pm',
+ ABSTRACT_FROM => 'lib/Test/Chimps/Anna.pm',
+ PL_FILES => {},
+ PREREQ_PM => {
+ 'Test::More' => 0,
+ },
+ dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
+ clean => { FILES => 'Test-Chimps-Anna-*' },
+);
Added: Test-Chimps-Anna/trunk/README
==============================================================================
--- (empty file)
+++ Test-Chimps-Anna/trunk/README Fri Jun 23 18:17:57 2006
@@ -0,0 +1,49 @@
+Test-Chimps-Anna
+
+The README is used to introduce the module and provide instructions on
+how to install the module, any machine dependencies it may have (for
+example C compilers and installed libraries) and any other information
+that should be provided before the module is installed.
+
+A README file is required for CPAN modules since CPAN extracts the README
+file from a module distribution so that people browsing the archive
+can use it get an idea of the modules uses. It is usually a good idea
+to provide version information here so that people can decide whether
+fixes for the module are worth downloading.
+
+INSTALLATION
+
+To install this module, run the following commands:
+
+ perl Makefile.PL
+ make
+ make test
+ make install
+
+
+SUPPORT AND DOCUMENTATION
+
+After installing, you can find documentation for this module with the perldoc command.
+
+ perldoc Test::Chimps::Anna
+
+You can also look for information at:
+
+ Search CPAN
+ http://search.cpan.org/dist/Test-Chimps-Anna
+
+ CPAN Request Tracker:
+ http://rt.cpan.org/NoAuth/Bugs.html?Dist=Test-Chimps-Anna
+
+ AnnoCPAN, annotated CPAN documentation:
+ http://annocpan.org/dist/Test-Chimps-Anna
+
+ CPAN Ratings:
+ http://cpanratings.perl.org/d/Test-Chimps-Anna
+
+COPYRIGHT AND LICENCE
+
+Copyright (C) 2006 Zev Benjamin
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
Added: Test-Chimps-Anna/trunk/Test-Chimps-Anna/.cvsignore
==============================================================================
--- (empty file)
+++ Test-Chimps-Anna/trunk/Test-Chimps-Anna/.cvsignore Fri Jun 23 18:17:57 2006
@@ -0,0 +1,10 @@
+blib*
+Makefile
+Makefile.old
+Build
+_build*
+pm_to_blib*
+*.tar.gz
+.lwpcookies
+Test-Chimps-Anna-*
+cover_db
Added: Test-Chimps-Anna/trunk/bin/anna.pl
==============================================================================
--- (empty file)
+++ Test-Chimps-Anna/trunk/bin/anna.pl Fri Jun 23 18:17:57 2006
@@ -0,0 +1,19 @@
+#!/usr/bin/env perl
+
+use lib '/home/zev/bps/Test-Chimps-Anna/trunk/lib';
+
+use Test::Chimps::Anna;
+
+my $anna = Test::Chimps::Anna->new(
+ server => "irc.perl.org",
+ port => "6667",
+ channels => ["#bps"],
+
+ nick => "anna",
+ username => "nice_girl",
+ name => "Anna",
+ report_dir => '/var/www/bps-smokes/reports',
+ server_script => 'http://smoke.bestpractical.com/cgi-bin/report_server.pl'
+ );
+
+$anna->run;
Added: Test-Chimps-Anna/trunk/lib/Test/Chimps/Anna.pm
==============================================================================
--- (empty file)
+++ Test-Chimps-Anna/trunk/lib/Test/Chimps/Anna.pm Fri Jun 23 18:17:57 2006
@@ -0,0 +1,175 @@
+package Test::Chimps::Anna;
+
+use warnings;
+use strict;
+
+use Carp;
+use IO::Dir;
+use File::Spec;
+use YAML::Syck;
+use Test::Chimps::Report;
+
+use base 'Bot::BasicBot';
+
+=head1 NAME
+
+Test::Chimps::Anna - The great new Test::Chimps::Anna!
+
+=head1 VERSION
+
+Version 0.01
+
+=cut
+
+our $VERSION = '0.01';
+
+=head1 SYNOPSIS
+
+Quick summary of what the module does.
+
+Perhaps a little code snippet.
+
+ use Test::Chimps::Anna;
+
+ my $foo = Test::Chimps::Anna->new();
+ ...
+
+=cut
+
+sub new {
+ my $class = shift;
+ my $self = $class->SUPER::new(@_);
+ my %args = @_;
+ if (! exists $args{report_dir}) {
+ croak "You must specify a report directory!";
+ }
+ $self->{report_dir} = $args{report_dir};
+ $self->{files_seen} = {};
+ $self->{first_run} = 1;
+ $self = bless $self, $class;
+ $self->_scan_reports;
+ return $self;
+}
+
+sub report_dir {
+ my $self = shift;
+ return $self->{report_dir};
+}
+
+sub _files_seen {
+ my $self = shift;
+ return $self->{files_seen};
+}
+
+sub tick {
+ my $self = shift;
+
+ if ($self->{first_run}) {
+ $self->_say_to_all("I'm going to ban so hard");
+ $self->{first_run} = 0;
+ }
+
+ my @reports = $self->_scan_reports;
+
+ foreach my $reportfile (@reports) {
+ my $report = LoadFile($reportfile);
+ my $vars = $report->report_variables;
+ my $model = Test::TAP::Model::Visual->new_with_struct($report->model_structure);
+ if ($model->total_failed || $model->total_unexpectedly_succeeded) {
+ $reportfile =~ m{/([a-f0-9]+)\.yml$};
+ my $id = $1;
+ my $msg =
+ "Smoke report for $vars->{project} r$vars->{revision} submitted: "
+ . sprintf( "%.2f", $model->total_ratio * 100 ) . "\%, "
+ . $model->total_seen . " total, "
+ . $model->total_ok . " ok, "
+ . $model->total_failed . " failed, "
+ . $model->total_todo . " todo, "
+ . $model->total_skipped . " skipped, "
+ . $model->total_unexpectedly_succeeded . " unexpectedly succeeded. "
+ . $self->{server_script} . "?id=$id";
+
+ $self->_say_to_all($msg);
+ }
+ }
+
+ return 5;
+}
+
+sub _say_to_all {
+ my $self = shift;
+ my $msg = shift;
+
+ $self->say(channel => $_, body => $msg)
+ for (@{$self->{channels}});
+}
+
+sub _scan_reports {
+ my $self = shift;
+
+ my $dir = $self->{report_dir};
+ my %new = ();
+
+ my $d = IO::Dir->new($dir)
+ or die "Could not open report directory: $dir: $!";
+ while (defined(my $entry = $d->read)) {
+ if (! exists $self->_files_seen->{$entry}) {
+ $new{File::Spec->catfile($dir, $entry)}++;
+ $self->{files_seen}->{$entry}++;
+ }
+ }
+ return keys %new;
+}
+
+=head1 AUTHOR
+
+Zev Benjamin, C<< <zev at cpan.org> >>
+
+=head1 BUGS
+
+Please report any bugs or feature requests to
+C<bug-test-chimps-anna at rt.cpan.org>, or through the web interface at
+L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Chimps-Anna>.
+I will be notified, and then you'll automatically be notified of progress on
+your bug as I make changes.
+
+=head1 SUPPORT
+
+You can find documentation for this module with the perldoc command.
+
+ perldoc Test::Chimps::Anna
+
+You can also look for information at:
+
+=over 4
+
+=item * AnnoCPAN: Annotated CPAN documentation
+
+L<http://annocpan.org/dist/Test-Chimps-Anna>
+
+=item * CPAN Ratings
+
+L<http://cpanratings.perl.org/d/Test-Chimps-Anna>
+
+=item * RT: CPAN's request tracker
+
+L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Test-Chimps-Anna>
+
+=item * Search CPAN
+
+L<http://search.cpan.org/dist/Test-Chimps-Anna>
+
+=back
+
+=head1 ACKNOWLEDGEMENTS
+
+=head1 COPYRIGHT & LICENSE
+
+Copyright 2006 Zev Benjamin, all rights reserved.
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+=cut
+
+1; # End of Test::Chimps::Anna
Added: Test-Chimps-Anna/trunk/t/00-load.t
==============================================================================
--- (empty file)
+++ Test-Chimps-Anna/trunk/t/00-load.t Fri Jun 23 18:17:57 2006
@@ -0,0 +1,9 @@
+#!perl -T
+
+use Test::More tests => 1;
+
+BEGIN {
+ use_ok( 'Test::Chimps::Anna' );
+}
+
+diag( "Testing Test::Chimps::Anna $Test::Chimps::Anna::VERSION, Perl $], $^X" );
Added: Test-Chimps-Anna/trunk/t/boilerplate.t
==============================================================================
--- (empty file)
+++ Test-Chimps-Anna/trunk/t/boilerplate.t Fri Jun 23 18:17:57 2006
@@ -0,0 +1,48 @@
+#!perl -T
+
+use strict;
+use warnings;
+use Test::More tests => 3;
+
+sub not_in_file_ok {
+ my ($filename, %regex) = @_;
+ open my $fh, "<", $filename
+ or die "couldn't open $filename for reading: $!";
+
+ my %violated;
+
+ while (my $line = <$fh>) {
+ while (my ($desc, $regex) = each %regex) {
+ if ($line =~ $regex) {
+ push @{$violated{$desc}||=[]}, $.;
+ }
+ }
+ }
+
+ if (%violated) {
+ fail("$filename contains boilerplate text");
+ diag "$_ appears on lines @{$violated{$_}}" for keys %violated;
+ } else {
+ pass("$filename contains no boilerplate text");
+ }
+}
+
+not_in_file_ok(README =>
+ "The README is used..." => qr/The README is used/,
+ "'version information here'" => qr/to provide version information/,
+);
+
+not_in_file_ok(Changes =>
+ "placeholder date/time" => qr(Date/time)
+);
+
+sub module_boilerplate_ok {
+ my ($module) = @_;
+ not_in_file_ok($module =>
+ 'the great new $MODULENAME' => qr/ - The great new /,
+ 'boilerplate description' => qr/Quick summary of what the module/,
+ 'stub function definition' => qr/function[12]/,
+ );
+}
+
+module_boilerplate_ok('lib/Test/Chimps/Anna.pm');
Added: Test-Chimps-Anna/trunk/t/pod-coverage.t
==============================================================================
--- (empty file)
+++ Test-Chimps-Anna/trunk/t/pod-coverage.t Fri Jun 23 18:17:57 2006
@@ -0,0 +1,6 @@
+#!perl -T
+
+use Test::More;
+eval "use Test::Pod::Coverage 1.04";
+plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@;
+all_pod_coverage_ok();
Added: Test-Chimps-Anna/trunk/t/pod.t
==============================================================================
--- (empty file)
+++ Test-Chimps-Anna/trunk/t/pod.t Fri Jun 23 18:17:57 2006
@@ -0,0 +1,6 @@
+#!perl -T
+
+use Test::More;
+eval "use Test::Pod 1.14";
+plan skip_all => "Test::Pod 1.14 required for testing POD" if $@;
+all_pod_files_ok();
More information about the Rt-commit
mailing list