rb-notifu 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md ADDED
@@ -0,0 +1,44 @@
1
+ # rb-notifu
2
+
3
+ Notification system for windows. Trying to be Growl.
4
+ Ruby wrapper around notifu (http://www.paralint.com/projects/notifu/index.html)
5
+
6
+ There are three possible alternatives to Growl on windows:
7
+
8
+ - Tray notification
9
+ - IUserNotification http://msdn.microsoft.com/en-us/library/bb774424(v=vs.85).aspx
10
+ - Notifu http://www.paralint.com/projects/notifu/index.html
11
+ - Growl for Windows http://www.growlforwindows.com/gfw/
12
+ - Snarl http://www.fullphat.net/
13
+
14
+ ## Example
15
+
16
+ ```ruby
17
+ require 'rb-notifu'
18
+
19
+ RbNotifu::show({
20
+ :message => "test",
21
+ :type => :warn
22
+ })
23
+ ```
24
+
25
+ ## Available options
26
+
27
+ ```
28
+ :type The type of message to display values are:
29
+ info The message is an informational message
30
+ warn The message is an warning message
31
+ error The message is an error message
32
+ :display The number of milliseconds to display (omit or 0 for infinit)
33
+ :title The title (or prompt) of the ballon
34
+ :message The message text
35
+ :icon Specify an icon to use ("parent" uses the icon of the parent process)
36
+ :baloon Enable ballon tips in the registry (for this user only)
37
+ :nosound Do not play a sound when the tooltip is displayed
38
+ :noquiet Show the tooltip even if the user is in the quiet period that follows his very first login (Windows 7 and up)
39
+ :xp Use IUserNotification interface event when IUserNotification2 is available
40
+ ```
41
+
42
+ ## TODO
43
+
44
+ - Use FFI instead of embedded executable file
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
data/bin/notifu.exe ADDED
Binary file
data/bin/notifu64.exe ADDED
Binary file
data/lib/rb-notifu.rb ADDED
@@ -0,0 +1,61 @@
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
+ #:type The type of message to display values are:
31
+ # info The message is an informational message
32
+ # warn The message is an warning message
33
+ # error The message is an error message
34
+ #:display The number of milliseconds to display (omit or 0 for infinit)
35
+ #:title The title (or prompt) of the ballon
36
+ #:message The message text
37
+ #:icon Specify an icon to use ("parent" uses the icon of the parent process)
38
+ #:baloon Enable ballon tips in the registry (for this user only)
39
+ #:nosound Do not play a sound when the tooltip is displayed
40
+ #:noquiet Show the tooltip even if the user is in the quiet period that follows his very first login (Windows 7 and up)
41
+ #:xp Use IUserNotification interface event when IUserNotification2 is available
42
+ def self.show(options = {})
43
+ flags = ""
44
+ @option_default.each do |key, value|
45
+ flag = options.key?(key) ? options[key] : value
46
+ if flag
47
+ flags += "/" + @option_to_flag[key] + " " + self.escape(flag) + " "
48
+ end
49
+ end
50
+ system "#{@executable} #{flags}"
51
+ end
52
+
53
+ def self.escape(value)
54
+ if value
55
+ return '"' + value.to_s.gsub('"','\"') + '"'
56
+ else
57
+ return ''
58
+ end
59
+ end
60
+
61
+ end
@@ -0,0 +1,3 @@
1
+ module RbNotifu
2
+ VERSION = "0.0.1"
3
+ end
data/rb-notifu.gemspec ADDED
@@ -0,0 +1,29 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "rb-notifu/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "rb-notifu"
7
+ s.version = RbNotifu::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["stereobooster"]
10
+ s.email = ["stereobooster@gmail.com"]
11
+ s.homepage = "http://github.com/stereobooster/rb-notifu"
12
+ s.summary = %q{Notification system for windows. Trying to be Growl}
13
+ s.description = %q{Notification system for windows. Trying to be Growl. Ruby wrapper around notifu (http://www.paralint.com/projects/notifu/index.html)}
14
+ s.date = %q{2011-05-20}
15
+
16
+ s.rubyforge_project = "rb-notifu"
17
+
18
+ s.files = [
19
+ "README.md",
20
+ "Rakefile",
21
+ "lib/rb-notifu.rb",
22
+ "lib/rb-notifu/version.rb",
23
+ "rb-notifu.gemspec",
24
+ "bin/notifu.exe",
25
+ "bin/notifu64.exe"
26
+ ]
27
+ #s.executables = ["notifu.exe", "notifu64.exe"]
28
+ s.require_paths = ["lib"]
29
+ end
metadata ADDED
@@ -0,0 +1,55 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rb-notifu
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - stereobooster
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-05-20 00:00:00.000000000 +03:00
13
+ default_executable:
14
+ dependencies: []
15
+ description: Notification system for windows. Trying to be Growl. Ruby wrapper around
16
+ notifu (http://www.paralint.com/projects/notifu/index.html)
17
+ email:
18
+ - stereobooster@gmail.com
19
+ executables: []
20
+ extensions: []
21
+ extra_rdoc_files: []
22
+ files:
23
+ - README.md
24
+ - Rakefile
25
+ - lib/rb-notifu.rb
26
+ - lib/rb-notifu/version.rb
27
+ - rb-notifu.gemspec
28
+ - bin/notifu.exe
29
+ - bin/notifu64.exe
30
+ has_rdoc: true
31
+ homepage: http://github.com/stereobooster/rb-notifu
32
+ licenses: []
33
+ post_install_message:
34
+ rdoc_options: []
35
+ require_paths:
36
+ - lib
37
+ required_ruby_version: !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ! '>='
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ required_rubygems_version: !ruby/object:Gem::Requirement
44
+ none: false
45
+ requirements:
46
+ - - ! '>='
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ requirements: []
50
+ rubyforge_project: rb-notifu
51
+ rubygems_version: 1.5.2
52
+ signing_key:
53
+ specification_version: 3
54
+ summary: Notification system for windows. Trying to be Growl
55
+ test_files: []