Skip to content
This repository
tag: 0.99_33
Fetching contributors…

Cannot retrieve contributors at this time

file 34 lines (26 sloc) 0.902 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
name 'growl';
description 'Growl notifications';
author 'Tatsuhiko Miyagawa';

api_version 0.1;

my $growlnotify;

hook init => sub {
    my $args = shift;
    $growlnotify = $args->{app}->which("growlnotify")
        or $args->{app}->diag("! Couldn't find growlnotify. growl plugin is disabled.\n");
};

hook install_success => sub {
    my $args = shift;
    growl_it($args, 'ToolbarInfo');
};

hook build_failure => sub {
    my $args = shift;
    growl_it($args, 'AlertStopIcon', 1);
};

sub growl_it {
    my($args, $icon, $is_sticky) = @_;

    return unless $growlnotify;

    my $sticky = $is_sticky ? "-s" : "";
    $args->{app}->run("$growlnotify -n cpanminus $sticky -m " . $args->{app}->shell_quote($args->{message}) .
                      " " . $args->{dist} .
                      " --image /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/$icon.icns" );
};
Something went wrong with that request. Please try again.