rb-notifu 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -5
- data/Rakefile +16 -0
- data/lib/rb-notifu.rb +75 -61
- data/lib/rb-notifu/version.rb +1 -1
- data/rb-notifu.gemspec +3 -0
- metadata +24 -2
data/README.md
CHANGED
@@ -16,10 +16,7 @@ There are three possible alternatives to Growl on windows:
|
|
16
16
|
```ruby
|
17
17
|
require 'rb-notifu'
|
18
18
|
|
19
|
-
RbNotifu::show
|
20
|
-
:message => "test",
|
21
|
-
:type => :warn
|
22
|
-
})
|
19
|
+
p RbNotifu::show :message => "test", :type => :warn
|
23
20
|
```
|
24
21
|
|
25
22
|
## Available options
|
@@ -37,8 +34,8 @@ RbNotifu::show({
|
|
37
34
|
:nosound Do not play a sound when the tooltip is displayed
|
38
35
|
:noquiet Show the tooltip even if the user is in the quiet period that follows his very first login (Windows 7 and up)
|
39
36
|
:xp Use IUserNotification interface event when IUserNotification2 is available
|
40
|
-
```
|
41
37
|
|
42
38
|
## TODO
|
43
39
|
|
44
40
|
- Use FFI instead of embedded executable file
|
41
|
+
- While showing message it blocks. Need to add thread and :noblock option
|
data/Rakefile
CHANGED
@@ -1,2 +1,18 @@
|
|
1
1
|
require 'bundler'
|
2
2
|
Bundler::GemHelper.install_tasks
|
3
|
+
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
RSpec::Core::RakeTask.new(:spec)
|
6
|
+
task :default => :spec
|
7
|
+
|
8
|
+
namespace(:spec) do
|
9
|
+
desc "Run all specs on multiple ruby versions (requires pik)"
|
10
|
+
task(:portability) do
|
11
|
+
%w[187 192 161].each do |version|
|
12
|
+
system "cmd /c echo -----------#{version}------------ & " +
|
13
|
+
"pik use #{version} & " +
|
14
|
+
"bundle install & " +
|
15
|
+
"rake spec"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/rb-notifu.rb
CHANGED
@@ -1,61 +1,75 @@
|
|
1
|
-
require 'pathname'
|
2
|
-
module RbNotifu
|
3
|
-
|
4
|
-
@executable = Pathname.new(__FILE__).parent.parent.realpath.to_s + '/bin/notifu.exe'
|
5
|
-
|
6
|
-
@option_to_flag = {
|
7
|
-
:type => "t",
|
8
|
-
:display => "d",
|
9
|
-
:title => "p",
|
10
|
-
:message => "m",
|
11
|
-
:icon => "i",
|
12
|
-
:baloon => "e",
|
13
|
-
:nosound => "q",
|
14
|
-
:noquiet => "w",
|
15
|
-
:xp => "xp"
|
16
|
-
}
|
17
|
-
|
18
|
-
@option_default = {
|
19
|
-
:type => :info,
|
20
|
-
:display => 3000,
|
21
|
-
:title => "rb-notifu",
|
22
|
-
:message => " ",
|
23
|
-
:icon => false,
|
24
|
-
:baloon => false,
|
25
|
-
:nosound => false,
|
26
|
-
:noquiet => false,
|
27
|
-
:xp => false
|
28
|
-
}
|
29
|
-
|
30
|
-
|
31
|
-
#
|
32
|
-
#
|
33
|
-
#
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
end
|
1
|
+
require 'pathname'
|
2
|
+
module RbNotifu
|
3
|
+
|
4
|
+
@executable = Pathname.new(__FILE__).parent.parent.realpath.to_s + '/bin/notifu.exe'
|
5
|
+
|
6
|
+
@option_to_flag = {
|
7
|
+
:type => "t",
|
8
|
+
:display => "d",
|
9
|
+
:title => "p",
|
10
|
+
:message => "m",
|
11
|
+
:icon => "i",
|
12
|
+
:baloon => "e",
|
13
|
+
:nosound => "q",
|
14
|
+
:noquiet => "w",
|
15
|
+
:xp => "xp"
|
16
|
+
}
|
17
|
+
|
18
|
+
@option_default = {
|
19
|
+
:type => :info,
|
20
|
+
:display => 3000,
|
21
|
+
:title => "rb-notifu",
|
22
|
+
:message => " ",
|
23
|
+
:icon => false,
|
24
|
+
:baloon => false,
|
25
|
+
:nosound => false,
|
26
|
+
:noquiet => false,
|
27
|
+
:xp => false
|
28
|
+
}
|
29
|
+
|
30
|
+
#Params:
|
31
|
+
# :type The type of message to display values are:
|
32
|
+
# info The message is an informational message
|
33
|
+
# warn The message is an warning message
|
34
|
+
# error The message is an error message
|
35
|
+
# :display The number of milliseconds to display (omit or 0 for infinit)
|
36
|
+
# :title The title (or prompt) of the ballon
|
37
|
+
# :message The message text
|
38
|
+
# :icon Specify an icon to use ("parent" uses the icon of the parent process)
|
39
|
+
# :baloon Enable ballon tips in the registry (for this user only)
|
40
|
+
# :nosound Do not play a sound when the tooltip is displayed
|
41
|
+
# :noquiet Show the tooltip even if the user is in the quiet period that follows his very first login (Windows 7 and up)
|
42
|
+
# :xp Use IUserNotification interface event when IUserNotification2 is available
|
43
|
+
#
|
44
|
+
#Returns
|
45
|
+
# 0 Registry was succesfully edited. Only returned when /e is used with no other argument.
|
46
|
+
# 1 There was an error in one the argument or some required argument was missing.
|
47
|
+
# 2 The balloon timed out waiting. The user didn't click the close button or the balloon itself.
|
48
|
+
# 3 The user clicked the balloon.
|
49
|
+
# 4 The user closed the balloon using the X in the top right corner.
|
50
|
+
# 5 IUserNotification class object or interface is not supported on this version of Windows.
|
51
|
+
# 6 The user clicked with the right mouse button on the icon, in the system notification area (Vista and later)
|
52
|
+
# 7 The user clicked with the left mouse button on the icon, in the system notification area (Vista and later)
|
53
|
+
# 8 A new instance of Notifu dismissed a running instace
|
54
|
+
# 255 There was some unexpected error.
|
55
|
+
def self.show(options = {})
|
56
|
+
flags = ""
|
57
|
+
@option_default.each do |key, value|
|
58
|
+
flag = options.key?(key) ? options[key] : value
|
59
|
+
if flag
|
60
|
+
flags += "/" + @option_to_flag[key] + " " + self.escape(flag) + " "
|
61
|
+
end
|
62
|
+
end
|
63
|
+
system "#{@executable} #{flags}"
|
64
|
+
return $?.exitstatus
|
65
|
+
end
|
66
|
+
|
67
|
+
def self.escape(value)
|
68
|
+
if value
|
69
|
+
return '"' + value.to_s.gsub('"','\"') + '"'
|
70
|
+
else
|
71
|
+
return ''
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
data/lib/rb-notifu/version.rb
CHANGED
data/rb-notifu.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rb-notifu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,29 @@ bindir: bin
|
|
11
11
|
cert_chain: []
|
12
12
|
date: 2011-05-20 00:00:00.000000000 +03:00
|
13
13
|
default_executable:
|
14
|
-
dependencies:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: bundler
|
17
|
+
requirement: &2981976 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *2981976
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: rspec
|
28
|
+
requirement: &1989096 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *1989096
|
15
37
|
description: Notification system for windows. Trying to be Growl. Ruby wrapper around
|
16
38
|
notifu (http://www.paralint.com/projects/notifu/index.html)
|
17
39
|
email:
|