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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{growl}
5
- s.version = "0.0.4"
5
+ s.version = "0.0.5"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["TJ Holowaychuk"]
data/History.rdoc CHANGED
@@ -1,4 +1,8 @@
1
1
 
2
+ === 0.0.5 / 2009-04-08
3
+
4
+ * Now returning nil when trying to instantiate Growl when not installed
5
+
2
6
  === 0.0.4 / 2009-04-08
3
7
 
4
8
  * We dont want visionmedia-Growl, shesh :p, fixed to lowercase
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
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Growl
3
- VERSION = '0.0.4'
3
+ VERSION = '0.0.5'
4
4
  end
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: visionmedia-growl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - TJ Holowaychuk