sam-rakegrowl 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ Copyright (c) 2010 Sergio Gil
2
+
3
+ Permission is hereby granted, free of charge, to any
4
+ person obtaining a copy of this software and associated
5
+ documentation files (the "Software"), to deal in the
6
+ Software without restriction, including without limitation
7
+ the rights to use, copy, modify, merge, publish,
8
+ distribute, sublicense, and/or sell copies of the
9
+ Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice
13
+ shall be included in all copies or substantial portions of
14
+ the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
17
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
18
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
19
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
20
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
22
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,32 @@
1
+ # rakegrowl
2
+
3
+ Do you recognize this situation? You run a `rake` task (for example, `rake spec`), which you know it's going to take some time (e.g. 3 or 4 minutes). You say _"Great moment to check what's going on on Twitter"_. 10 minutes and 3 tabs with blog posts later, you realize you were actually waiting for a task to finish, a task which finished long before. Bye, bye, productivity!!
4
+
5
+ **rakegrowl** tells you when your rake tasks end via [Growl](http://growl.info/).
6
+
7
+ _Fork:_
8
+ Forked to add support for rake abort and display different growl images based on the rake outcome
9
+
10
+ ## Installation
11
+
12
+ You need to have [Growl](http://growl.info/) and `growlnotify` installed to get the notifications. Anyway, **rakegrowl** is harmless if there is no Growl.
13
+
14
+ To install this fork of **rakegrowl**, you need to run:
15
+
16
+ gem install sam-rakegrowl
17
+
18
+ ## Usage
19
+
20
+ In order to get your notifications, you have to run `rake` this way:
21
+
22
+ $ rake -rubygems -r rakegrowl this:task that:another:task
23
+
24
+ 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
+
26
+ alias rake='rake -rubygems -r rakegrowl'
27
+
28
+ From now on, whenever you run a `rake` task, you'll get a notification when it finishes.
29
+
30
+ ## Copyright & Licensing
31
+
32
+ Copyright (c) 2010 Sergio Gil. MIT license, see LICENSE for details.
data/img/abort.png ADDED
Binary file
data/img/complete.png ADDED
Binary file
data/lib/rakegrowl.rb ADDED
@@ -0,0 +1,52 @@
1
+ module Rakegrowl
2
+
3
+ GEM_PATH = File.expand_path(File.join(File.dirname(__FILE__), '..'))
4
+ COMPLETE_IMG = File.join(GEM_PATH, 'img', 'complete.png')
5
+ ABORT_IMG = File.join(GEM_PATH, 'img', 'abort.png')
6
+
7
+ module Growl
8
+ def self.growlnotify
9
+ `which growlnotify`.chomp
10
+ end
11
+
12
+ def self.exists?
13
+ !growlnotify.empty?
14
+ end
15
+
16
+ def self.notify(title, message, img_name=nil)
17
+ command = "#{growlnotify} -t \"#{title}\" -m \"#{message}\""
18
+ command << " --image \"#{img_name}\"" if img_name
19
+ Kernel.system(command) if exists?
20
+ end
21
+ end
22
+
23
+ def self.enhance_tasks
24
+ if Growl.exists?
25
+ Rake::Task.tasks.each do |task|
26
+ task.enhance do
27
+ Growl.notify "Rake", "Task #{task.name} finished", COMPLETE_IMG if Rake.application.top_level_tasks.include?(task.name)
28
+ end
29
+ end
30
+ end
31
+ end
32
+
33
+ def self.notify_fail(top_level_tasks)
34
+ Growl.notify "Rake", "Task #{top_level_tasks} failed", ABORT_IMG
35
+ end
36
+
37
+ end
38
+
39
+ Rake::Application.class_eval do
40
+ def top_level_with_growl
41
+ Rakegrowl.enhance_tasks
42
+ begin
43
+ top_level_without_growl
44
+ rescue SystemExit
45
+ Rakegrowl.notify_fail(top_level_tasks)
46
+ end
47
+ end
48
+
49
+
50
+ alias_method :top_level_without_growl, :top_level
51
+ alias_method :top_level, :top_level_with_growl
52
+ end
metadata ADDED
@@ -0,0 +1,85 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sam-rakegrowl
3
+ version: !ruby/object:Gem::Version
4
+ hash: 31
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 2
9
+ - 4
10
+ version: 0.2.4
11
+ platform: ruby
12
+ authors:
13
+ - "Sergio Gil P\xC3\xA9rez de la Manga - forked Sam Cavenagh"
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-10-13 00:00:00 +11:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: rspec
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :development
34
+ version_requirements: *id001
35
+ description:
36
+ email: sgilperez@gmail.com - forked cavenaghweb@hotmail.com
37
+ executables: []
38
+
39
+ extensions: []
40
+
41
+ extra_rdoc_files:
42
+ - README.md
43
+ files:
44
+ - LICENSE
45
+ - README.md
46
+ - lib/rakegrowl.rb
47
+ - img/abort.png
48
+ - img/complete.png
49
+ has_rdoc: true
50
+ homepage: http://github.com/o-sam-o/rakegrowl
51
+ licenses: []
52
+
53
+ post_install_message:
54
+ rdoc_options:
55
+ - --main
56
+ - README.md
57
+ require_paths:
58
+ - lib
59
+ required_ruby_version: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ hash: 3
65
+ segments:
66
+ - 0
67
+ version: "0"
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ hash: 3
74
+ segments:
75
+ - 0
76
+ version: "0"
77
+ requirements: []
78
+
79
+ rubyforge_project:
80
+ rubygems_version: 1.3.7
81
+ signing_key:
82
+ specification_version: 3
83
+ summary: Get Growled when your long running rake tasks finish
84
+ test_files: []
85
+