notifier 0.1.3 → 0.1.4

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 CHANGED
@@ -1,4 +1,2 @@
1
- source "http://rubygems.org"
2
-
3
- # Specify your gem's dependencies in notifier.gemspec
1
+ source :rubygems
4
2
  gemspec
data/Gemfile.lock CHANGED
@@ -1,12 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- notifier (0.1.3)
4
+ notifier (0.1.4)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
8
8
  specs:
9
9
  mocha (0.9.12)
10
+ rake (0.9.2.2)
10
11
  test-unit (2.2.0)
11
12
 
12
13
  PLATFORMS
@@ -15,4 +16,5 @@ PLATFORMS
15
16
  DEPENDENCIES
16
17
  mocha
17
18
  notifier!
19
+ rake
18
20
  test-unit
data/README.rdoc CHANGED
@@ -76,6 +76,11 @@ To create a new notifier, just create a module on <tt>Notifier</tt> namespace th
76
76
 
77
77
  * Nando Vieira - http://nandovieira.com.br
78
78
 
79
+ == Contributors
80
+
81
+ * Olek Janiszewski
82
+ * David Miani
83
+
79
84
  == License
80
85
 
81
86
  (The MIT License)
data/lib/notifier.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require "open3"
2
+
1
3
  module Notifier
2
4
  autoload :Growl, "notifier/growl"
3
5
  autoload :Snarl, "notifier/snarl"
@@ -11,16 +11,16 @@ module Notifier
11
11
 
12
12
  def notify(options)
13
13
  register
14
- command = %W[
15
- growlnotify
16
- --name=test_notifier
17
- --image='#{options[:image]}'
18
- --priority=2
19
- --message='#{options[:message]}'
20
- '#{options[:title]}'
21
- ].join(" ")
14
+ command = [
15
+ "growlnotify",
16
+ "--name", "test_notifier",
17
+ "--image", options[:image],
18
+ "--priority", "2",
19
+ "--message", options[:message],
20
+ options[:title]
21
+ ]
22
22
 
23
- Thread.new { `#{command}` }
23
+ Thread.new { system(*command) }
24
24
  end
25
25
 
26
26
  def register
@@ -7,13 +7,13 @@ module Notifier
7
7
  end
8
8
 
9
9
  def notify(options)
10
- command = %W[
11
- kdialog
12
- --title='#{options[:title]}'
13
- --passivepopup='#{options[:message]}' 5
14
- ].join(" ")
10
+ command = [
11
+ "kdialog",
12
+ "--title", options[:title],
13
+ "--passivepopup", options[:message], "5"
14
+ ]
15
15
 
16
- Thread.new { `#{command}` }
16
+ Thread.new { system(*command) }
17
17
  end
18
18
  end
19
19
  end
@@ -7,9 +7,13 @@ module Notifier
7
7
  end
8
8
 
9
9
  def notify(options)
10
- Thread.new do
11
- `dcop knotify default notify eventname \'#{options[:title]}\' \'#{options[:message]}\' '' '' 16 2`
12
- end
10
+ command = [
11
+ "dcop", "knotify", "default", "notify", "eventname",
12
+ options[:title], options[:message],
13
+ "", "", "16", "2"
14
+ ]
15
+
16
+ Thread.new { system(*command) }
13
17
  end
14
18
  end
15
19
  end
@@ -7,9 +7,14 @@ module Notifier
7
7
  end
8
8
 
9
9
  def notify(options)
10
- Thread.new do
11
- `notify-send -i #{options[:image]} "#{options[:title]}" "#{options[:message]}"`
12
- end
10
+ command = [
11
+ "notify-send", "-i",
12
+ options[:image],
13
+ options[:title],
14
+ options[:message]
15
+ ]
16
+
17
+ Thread.new { system(*command) }
13
18
  end
14
19
  end
15
20
  end
@@ -8,21 +8,25 @@ module Notifier
8
8
 
9
9
  def notify(options)
10
10
  color = options.fetch(:color, "white")
11
- message = options[:message].inspect.gsub(/!/, "\\!")
12
- command = %W[
13
- echo #{message} |
14
- osd_cat
15
- --shadow=0
16
- --colour=#{color}
17
- --pos=top
18
- --offset=10
19
- --align=center
20
- --font=-adobe-helvetica-bold-r-normal-*-*-240-*-*-p-*-*-*
21
- --delay=5
22
- --outline=4
23
- ].join(" ")
24
11
 
25
- Thread.new { `#{command}` }
12
+ command = [
13
+ "osd_cat",
14
+ "--shadow", "0",
15
+ "--colour", color,
16
+ "--pos", "top",
17
+ "--offset", "10",
18
+ "--align", "center",
19
+ "--font", "-bitstream-bitstream charter-bold-r-*-*-*-350-*-*-*-*-*-*",
20
+ "--delay", "5",
21
+ "--outline", "4",
22
+ ]
23
+
24
+ Thread.new do
25
+ Open3.popen3(*command) do |stdin, stdout, stderr|
26
+ stdin.puts options[:message]
27
+ stdin.close
28
+ end
29
+ end
26
30
  end
27
31
  end
28
32
  end
@@ -2,7 +2,7 @@ module Notifier
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- PATCH = 3
5
+ PATCH = 4
6
6
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
7
7
  end
8
8
  end
data/notifier.gemspec CHANGED
@@ -21,4 +21,5 @@ Gem::Specification.new do |s|
21
21
 
22
22
  s.add_development_dependency "test-unit"
23
23
  s.add_development_dependency "mocha"
24
+ s.add_development_dependency "rake"
24
25
  end
metadata CHANGED
@@ -1,50 +1,57 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: notifier
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.4
4
5
  prerelease:
5
- version: 0.1.3
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Nando Vieira
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-04-02 00:00:00 -03:00
14
- default_executable:
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
12
+ date: 2011-10-06 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
17
15
  name: test-unit
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70155414188400 !ruby/object:Gem::Requirement
20
17
  none: false
21
- requirements:
22
- - - ">="
23
- - !ruby/object:Gem::Version
24
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
25
22
  type: :development
26
- version_requirements: *id001
27
- - !ruby/object:Gem::Dependency
23
+ prerelease: false
24
+ version_requirements: *70155414188400
25
+ - !ruby/object:Gem::Dependency
28
26
  name: mocha
27
+ requirement: &70155414187420 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
29
34
  prerelease: false
30
- requirement: &id002 !ruby/object:Gem::Requirement
35
+ version_requirements: *70155414187420
36
+ - !ruby/object:Gem::Dependency
37
+ name: rake
38
+ requirement: &70155414186700 !ruby/object:Gem::Requirement
31
39
  none: false
32
- requirements:
33
- - - ">="
34
- - !ruby/object:Gem::Version
35
- version: "0"
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
36
44
  type: :development
37
- version_requirements: *id002
38
- description: Send system notifications on several platforms with a simple and unified API. Currently supports Growl, Libnotify, OSD, KDE (Knotify and Kdialog) and Snarl
39
- email:
45
+ prerelease: false
46
+ version_requirements: *70155414186700
47
+ description: Send system notifications on several platforms with a simple and unified
48
+ API. Currently supports Growl, Libnotify, OSD, KDE (Knotify and Kdialog) and Snarl
49
+ email:
40
50
  - fnando.vieira@gmail.com
41
51
  executables: []
42
-
43
52
  extensions: []
44
-
45
53
  extra_rdoc_files: []
46
-
47
- files:
54
+ files:
48
55
  - .gitignore
49
56
  - Gemfile
50
57
  - Gemfile.lock
@@ -63,34 +70,38 @@ files:
63
70
  - resources/register-growl.scpt
64
71
  - test/notifier_test.rb
65
72
  - test/test_helper.rb
66
- has_rdoc: true
67
73
  homepage: http://rubygems.org/gems/notifier
68
74
  licenses: []
69
-
70
75
  post_install_message:
71
76
  rdoc_options: []
72
-
73
- require_paths:
77
+ require_paths:
74
78
  - lib
75
- required_ruby_version: !ruby/object:Gem::Requirement
79
+ required_ruby_version: !ruby/object:Gem::Requirement
76
80
  none: false
77
- requirements:
78
- - - ">="
79
- - !ruby/object:Gem::Version
80
- version: "0"
81
- required_rubygems_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ! '>='
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ segments:
86
+ - 0
87
+ hash: 226729221616814757
88
+ required_rubygems_version: !ruby/object:Gem::Requirement
82
89
  none: false
83
- requirements:
84
- - - ">="
85
- - !ruby/object:Gem::Version
86
- version: "0"
87
- requirements:
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ segments:
95
+ - 0
96
+ hash: 226729221616814757
97
+ requirements:
88
98
  - Growl, Libnotify, OSD, KDE (Knotify and Kdialog) or Snarl
89
99
  rubyforge_project:
90
- rubygems_version: 1.6.0
100
+ rubygems_version: 1.8.10
91
101
  signing_key:
92
102
  specification_version: 3
93
- summary: Send system notifications on several platforms with a simple and unified API. Currently supports Growl, Libnotify, OSD, KDE (Knotify and Kdialog) and Snarl
94
- test_files:
103
+ summary: Send system notifications on several platforms with a simple and unified
104
+ API. Currently supports Growl, Libnotify, OSD, KDE (Knotify and Kdialog) and Snarl
105
+ test_files:
95
106
  - test/notifier_test.rb
96
107
  - test/test_helper.rb