notifier 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- notifier (0.2.0)
4
+ notifier (0.2.1)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
data/lib/notifier.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require "open3"
2
+ require "rbconfig"
2
3
 
3
4
  module Notifier
4
5
  autoload :Growl, "notifier/growl"
@@ -46,6 +47,10 @@ module Notifier
46
47
  notifier && notifier.supported? ? notifier : nil
47
48
  end
48
49
 
50
+ def os?(regex)
51
+ RUBY_PLATFORM =~ regex || RbConfig::CONFIG["host_os"] =~ regex
52
+ end
53
+
49
54
  private
50
55
  def classify(string)
51
56
  string.gsub(/_(.)/sm) { "#{$1.upcase}" }.gsub(/^(.)/) { "#{$1.upcase}" }
data/lib/notifier/gntp.rb CHANGED
@@ -13,9 +13,9 @@ module Notifier
13
13
 
14
14
  def notify(options)
15
15
  ::GNTP.notify(
16
- :title => options[:title],
17
- :text => options[:message],
18
- :icon => options[:image]
16
+ :title => options[:title],
17
+ :text => options[:message],
18
+ :icon => options[:image]
19
19
  )
20
20
  end
21
21
  end
@@ -6,7 +6,7 @@ module Notifier
6
6
  FILE = File.expand_path("~/.test_notifier-growl")
7
7
 
8
8
  def supported?
9
- RUBY_PLATFORM =~ /darwin/ && `which growlnotify` && $? == 0
9
+ Notifier.os?(/darwin/) && `which growlnotify` && $? == 0
10
10
  end
11
11
 
12
12
  def notify(options)
@@ -3,7 +3,7 @@ module Notifier
3
3
  extend self
4
4
 
5
5
  def supported?
6
- RUBY_PLATFORM =~ /(linux|freebsd)/ && `which kdialog > /dev/null` && $? == 0
6
+ Notifier.os?(/(linux|freebsd)/) && `which kdialog > /dev/null` && $? == 0
7
7
  end
8
8
 
9
9
  def notify(options)
@@ -3,7 +3,7 @@ module Notifier
3
3
  extend self
4
4
 
5
5
  def supported?
6
- RUBY_PLATFORM =~ /(linux|freebsd)/ && `ps -Al | grep dcop` && $? == 0
6
+ Notifier.os?(/(linux|freebsd)/) && `ps -Al | grep dcop` && $? == 0
7
7
  end
8
8
 
9
9
  def notify(options)
@@ -3,7 +3,7 @@ module Notifier
3
3
  extend self
4
4
 
5
5
  def supported?
6
- RUBY_PLATFORM =~ /(linux|freebsd)/ && `which notify-send > /dev/null` && $? == 0
6
+ Notifier.os?(/(linux|freebsd)/) && `which notify-send > /dev/null` && $? == 0
7
7
  end
8
8
 
9
9
  def notify(options)
@@ -3,7 +3,7 @@ module Notifier
3
3
  extend self
4
4
 
5
5
  def supported?
6
- RUBY_PLATFORM =~ /(linux|freebsd)/ && `which osd_cat > /dev/null` && $? == 0
6
+ Notifier.os?(/(linux|freebsd)/) && `which osd_cat > /dev/null` && $? == 0
7
7
  end
8
8
 
9
9
  def notify(options)
@@ -3,7 +3,7 @@ module Notifier
3
3
  extend self
4
4
 
5
5
  def supported?
6
- return false unless RUBY_PLATFORM =~ /(mswin|mingw)/
6
+ return false unless Notifier.os?(/(mswin|mingw)/)
7
7
 
8
8
  begin
9
9
  require "snarl" unless defined?(::Snarl)
@@ -2,7 +2,7 @@ module Notifier
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 2
5
- PATCH = 0
5
+ PATCH = 1
6
6
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: notifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -100,7 +100,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
100
100
  version: '0'
101
101
  segments:
102
102
  - 0
103
- hash: 2300416509400274521
103
+ hash: -3729581669822386303
104
104
  required_rubygems_version: !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
@@ -109,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
109
  version: '0'
110
110
  segments:
111
111
  - 0
112
- hash: 2300416509400274521
112
+ hash: -3729581669822386303
113
113
  requirements:
114
114
  - Growl, Libnotify, OSD, KDE (Knotify and Kdialog) or Snarl
115
115
  rubyforge_project: