rakegrowl 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +9 -9
- data/lib/rakegrowl.rb +34 -5
- metadata +2 -3
- data/lib/growl.rb +0 -19
data/README.md
CHANGED
@@ -6,25 +6,25 @@ Do you recognize this situation? You run a `rake` task (for example, `rake spec`
|
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
9
|
-
You need to have [Growl](http://growl.info/) and `growlnotify` installed to get the notifications.
|
9
|
+
You need to have [Growl](http://growl.info/) and `growlnotify` installed to get the notifications. Anyway, **rakegrowl** is harmless if there is no Growl.
|
10
10
|
|
11
11
|
To install **rakegrowl**, which is packaged as a gem, you need to run:
|
12
12
|
|
13
13
|
sudo gem sources -a http://gemcutter.org # [if you haven't done it already]
|
14
14
|
sudo gem install rakegrowl
|
15
15
|
|
16
|
-
##
|
16
|
+
## Usage
|
17
17
|
|
18
|
-
|
18
|
+
In order to get your notifications, you have to run `rake` this way:
|
19
19
|
|
20
|
-
|
20
|
+
$ rake -rubygems -r rakegrowl this:task that:another:task
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
## Rails
|
22
|
+
You can even setup your system so you can run `rake` as usual and still get your notifications, by adding this into your `.bashrc` file:
|
25
23
|
|
26
|
-
|
24
|
+
alias rake='rake -rubygems -r rakegrowl'
|
25
|
+
|
26
|
+
From now on, whenever you run a `rake` task, you'll get a notification when it finishes.
|
27
27
|
|
28
28
|
## Copyright & Licensing
|
29
29
|
|
30
|
-
Copyright (c)
|
30
|
+
Copyright (c) 2010 Sergio Gil. MIT license, see LICENSE for details.
|
data/lib/rakegrowl.rb
CHANGED
@@ -1,7 +1,36 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
module Rakegrowl
|
2
|
+
|
3
|
+
module Growl
|
4
|
+
def self.growlnotify
|
5
|
+
`which growlnotify`.chomp
|
5
6
|
end
|
7
|
+
|
8
|
+
def self.exists?
|
9
|
+
!growlnotify.empty?
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.notify(title, message)
|
13
|
+
Kernel.system("#{growlnotify} -t \"#{title}\" -m \"#{message}\"") if exists?
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.enhance_tasks
|
18
|
+
if Growl.exists?
|
19
|
+
Rake::Task.tasks.each do |task|
|
20
|
+
task.enhance do
|
21
|
+
Growl.notify "Rake", "Task #{task.name} finished" if Rake.application.top_level_tasks.include?(task.name)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
Rake::Application.class_eval do
|
30
|
+
def top_level_with_growl
|
31
|
+
Rakegrowl.enhance_tasks
|
32
|
+
top_level_without_growl
|
6
33
|
end
|
7
|
-
|
34
|
+
alias_method :top_level_without_growl, :top_level
|
35
|
+
alias_method :top_level, :top_level_with_growl
|
36
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rakegrowl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Sergio Gil P\xC3\xA9rez de la Manga"
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-25 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -33,7 +33,6 @@ extra_rdoc_files:
|
|
33
33
|
files:
|
34
34
|
- LICENSE
|
35
35
|
- README.md
|
36
|
-
- lib/growl.rb
|
37
36
|
- lib/rakegrowl.rb
|
38
37
|
has_rdoc: true
|
39
38
|
homepage: http://github.com/porras/rakegrowl
|
data/lib/growl.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
module Growl
|
2
|
-
|
3
|
-
class << self
|
4
|
-
|
5
|
-
def growlnotify
|
6
|
-
`which growlnotify`.chomp
|
7
|
-
end
|
8
|
-
|
9
|
-
def exists?
|
10
|
-
!growlnotify.empty?
|
11
|
-
end
|
12
|
-
|
13
|
-
def notify(title, message)
|
14
|
-
Kernel.system("#{growlnotify} -t \"#{title}\" -m \"#{message}\"") if exists?
|
15
|
-
end
|
16
|
-
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|