[Bps-public-commit] smokingit branch, slack, updated. 6489966d40c2893aa39117e0f33d1a393ff14214
Alex Vandiver
alexmv at bestpractical.com
Tue Dec 9 15:39:32 EST 2014
The branch, slack has been updated
via 6489966d40c2893aa39117e0f33d1a393ff14214 (commit)
from 92ecb92197a286683d68c98f40ace891ac289163 (commit)
Summary of changes:
lib/Smokingit/Slack.pm | 15 +++++++++++++++
1 file changed, 15 insertions(+)
- Log -----------------------------------------------------------------
commit 6489966d40c2893aa39117e0f33d1a393ff14214
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Tue Dec 9 15:39:29 2014 -0500
Resolve channel name to id
diff --git a/lib/Smokingit/Slack.pm b/lib/Smokingit/Slack.pm
index 528850d..fb3795a 100644
--- a/lib/Smokingit/Slack.pm
+++ b/lib/Smokingit/Slack.pm
@@ -18,6 +18,11 @@ has 'slack_properties' => (
isa => 'HashRef',
default => sub { {} },
);
+has 'channels' => (
+ is => 'rw',
+ isa => 'HashRef',
+ default => sub { {} },
+);
has 'connection' => (
is => 'rw',
@@ -70,6 +75,10 @@ sub run {
$self->name( $data->{self}{name} );
$self->slack_properties( $data->{self} );
+ my %channels;
+ $channels{$_->{id}} = $_ for @{ $data->{channels} };
+ $self->channels( \%channels );
+
my $client = AnyEvent::WebSocket::Client->new;
Jifty->log->info( "Connecting to ".$data->{url} );
$client->connect( $data->{url} )->cb( sub {
@@ -384,6 +393,12 @@ sub test_progress {
my $message = $self->do_analyze($smoke);
return unless $message;
+ my $channel = Jifty->config->app('slack')->{channel};
+ unless ($channel =~ /^C/) {
+ ($channel) = map {$_->{id}}
+ grep {$_->{name} eq $channel}
+ values %{ $self->channels };
+ }
$self->send_to( Jifty->config->app('slack')->{channel} => $message );
};
warn "$@" if $@;
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list