Skip to content

Commit

Permalink
fixed format and grammer of notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
miyagawa committed Feb 28, 2010
1 parent e26ec06 commit c1ebf3d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
14 changes: 9 additions & 5 deletions lib/App/cpanminus/script.pm
Expand Up @@ -917,18 +917,22 @@ sub build_stuff {
my $local = $self->{local_versions}{$module};
my $reinstall = $local && $local eq $meta->{version};

my $how = $reinstall ? "$meta->{version} reinstalled"
: $local ? "$meta->{version} installed (upgraded from $local)"
: "$meta->{version} newly installed" ;
$self->diag("OK\n+ $module $how successfully.\n");
my $distname = $meta->{name} ? "$meta->{name}-$meta->{version}" : $module;
my $how = $reinstall ? "reinstalled $distname"
: $local ? "installed $distname (upgraded from $local)"
: "installed $distname" ;
my $msg = "Successfully $how";
$self->diag("OK\n$msg\n");
$self->run_hooks(install_success => {
module => $module, build_dir => $dir, meta => $meta,
local => $local, reinstall => $reinstall, depth => $depth,
message => $msg, dist => $distname
});
return 1;
} else {
my $msg = "Building $module failed";
$self->diag("FAIL\n! Installing $module failed. See $self->{log} for details.\n");
$self->run_hooks(build_failure => { module => $module, build_dir => $dir, meta => $meta });
$self->run_hooks(build_failure => { module => $module, build_dir => $dir, meta => $meta, message => $msg });
return;
}
}
Expand Down
16 changes: 6 additions & 10 deletions plugins/growl
Expand Up @@ -14,25 +14,21 @@ hook init => sub {

hook install_success => sub {
my $args = shift;
growl_it($args, "Successfully installed %s", 'ToolbarInfo');
growl_it($args, 'ToolbarInfo');
};

hook build_failure => sub {
my $args = shift;
growl_it($args, "Building %s failed.", 'AlertStopIcon', 1);
growl_it($args, 'AlertStopIcon', 1);
};

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

return unless $growlnotify;

my $dist = "$args->{meta}->{name}-$args->{meta}->{version}";
$dist = $args->{module} if $dist eq '-';
my $msg = sprintf $template, $dist;

my $sticky = $is_sticky ? "-s" : "";
$args->{app}->run("$growlnotify -n cpanminus $sticky -m " . $args->{app}->shell_quote($msg) .
" " . $args->{app}->shell_quote($dist) .
" --image /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/$icon.icns");
$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" );
};

0 comments on commit c1ebf3d

Please sign in to comment.