visionmedia-growl 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Growl.gemspec +1 -1
- data/History.rdoc +4 -0
- data/lib/growl/growl.rb +4 -2
- data/lib/growl/version.rb +1 -1
- data/spec/growl_spec.rb +6 -0
- metadata +1 -1
data/Growl.gemspec
CHANGED
data/History.rdoc
CHANGED
data/lib/growl/growl.rb
CHANGED
@@ -26,7 +26,7 @@ module Growl
|
|
26
26
|
# Return the version triple of the binary.
|
27
27
|
|
28
28
|
def version
|
29
|
-
`#{BIN} --version`.split[1]
|
29
|
+
@version ||= `#{BIN} --version`.split[1]
|
30
30
|
end
|
31
31
|
|
32
32
|
##
|
@@ -37,9 +37,10 @@ module Growl
|
|
37
37
|
end
|
38
38
|
|
39
39
|
##
|
40
|
-
# Return an instance of Growl::Base.
|
40
|
+
# Return an instance of Growl::Base or nil when not installed.
|
41
41
|
|
42
42
|
def new *args, &block
|
43
|
+
return unless installed?
|
43
44
|
Base.new *args, &block
|
44
45
|
end
|
45
46
|
|
@@ -138,5 +139,6 @@ module Growl
|
|
138
139
|
end
|
139
140
|
|
140
141
|
def Growl options = {}, &block
|
142
|
+
return unless Growl.installed?
|
141
143
|
Growl.new(options, &block).run
|
142
144
|
end
|
data/lib/growl/version.rb
CHANGED
data/spec/growl_spec.rb
CHANGED
@@ -26,6 +26,12 @@ describe Growl do
|
|
26
26
|
it "should accept a hash" do
|
27
27
|
Growl :message => 'Invoked via Growl with hash', :icon => 'jpeg', :title => 'Growl'
|
28
28
|
end
|
29
|
+
|
30
|
+
it "should return nil when not installed" do
|
31
|
+
Growl.stub!(:installed?).and_return(false)
|
32
|
+
Growl.new.should be_nil
|
33
|
+
lambda { Growl :message => 'I should never show :)' }.should_not raise_error
|
34
|
+
end
|
29
35
|
end
|
30
36
|
|
31
37
|
describe "#run" do
|