From dddeaba05015d4040ab1aeb502a81e291e9c56a4 Mon Sep 17 00:00:00 2001 From: "Jonathan \"Duke\" Leto" Date: Tue, 18 Jan 2011 15:30:02 -0500 Subject: Refactor jitterbug::Emailer to get rid of some warnings and improve tests --- lib/jitterbug/Emailer.pm | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) (limited to 'lib') diff --git a/lib/jitterbug/Emailer.pm b/lib/jitterbug/Emailer.pm index ab9bedb..60837d6 100644 --- a/lib/jitterbug/Emailer.pm +++ b/lib/jitterbug/Emailer.pm @@ -16,12 +16,29 @@ sub new { return $self; } +sub _make_body { + my ($header, $message, $tap, $footer) = @_; + + no warnings 'uninitialized'; + return <{'task'}; my $buildconf = $self->{'conf'}->{'jitterbug'}{'build_process'}; my $project = $task->project->name; - my $tap_output = $self->{'tap_output'}; + my $tap = $self->{'tap_output'}; my $sha1 = $task->commit->sha256; my $shortsha1 = substr($sha1, 0, 8); my $desc = JSON::decode_json( $task->commit->content ); @@ -29,18 +46,8 @@ sub run { my $message = $desc->{'message'}; my $header = $buildconf->{'on_failure_header'}; my $footer = $buildconf->{'on_failure_footer'}; + my $body = _make_body($header,$message, $tap, $footer); - my $body = <