real-growl 0.4.2 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/README.md +32 -10
  2. data/Rakefile +3 -1
  3. data/bin/realgrowl +19 -0
  4. data/lib/real_growl.rb +45 -30
  5. metadata +25 -11
data/README.md CHANGED
@@ -1,12 +1,13 @@
1
1
  real-growl
2
+ ==========
2
3
 
3
4
  Description
4
- ===========
5
+ -----------
5
6
 
6
- A Growl notification library that uses native c bindings to interact with GrowlApplicationBridge rather than Growl's network API.
7
+ A Growl notification library that uses native C bindings to interact with GrowlApplicationBridge rather than Growl's network API.
7
8
 
8
9
  Synopsis
9
- ========
10
+ --------
10
11
 
11
12
  ### rg
12
13
 
@@ -16,11 +17,11 @@ Synopsis
16
17
  >> rg("Google", ["Real", "Growl"], :icon => "http://www.google.com/logos/stpatricks_d4gwinner_eo09.gif")
17
18
  => nil
18
19
 
19
- >> Kernel.rg_sticky = false
20
+ >> RealGrowl.sticky = false
20
21
  => false
21
- >> Kernel.rg_priority = 3
22
+ >> RealGrowl.priority = 3
22
23
  => 3
23
- >> Kernel.rg_icon = "/the/path/cool.png"
24
+ >> RealGrowl.icon = "/the/path/cool.png"
24
25
  => "/the/path/cool.png"
25
26
 
26
27
  ### Custom Application
@@ -37,24 +38,45 @@ Synopsis
37
38
  => true
38
39
 
39
40
  TODO
40
- ====
41
+ ----
42
+
41
43
  * Add executable script
42
44
  * Enable growl callbacks
43
45
 
44
46
  Requirements
45
- ============
47
+ ------------
46
48
 
47
49
  * MacOS X 10.5 > ??
48
50
  * Growl Framework - http://growl.info/downloads_developers.php
49
51
 
50
52
  INSTALL
51
- =======
53
+ -------
52
54
 
53
55
  Download and install Growl.framework into either ~/Library/Frameworks or /Library/Frameworks
54
56
  gem install real-growl
55
57
 
58
+ $ # Download latest Growl SDK
59
+ $ # Copy Growl.framework under Frameworks
60
+ $ cp -r /Volumes/Growl\ 1.2.2\ SDK/Frameworks/Growl.framework /Library/Frameworks
61
+
56
62
  INSTALLATION HINTS
57
- ==================
63
+ ------------------
58
64
 
59
65
  Make sure that the Growl.framework is either 32bit or the 64bit depending on the version of MacOS X
60
66
  installed and the kind of machine it is installed on.
67
+
68
+ Executable Usage
69
+ ----------------
70
+
71
+ Uses slop to easily call a Growl notification with options (http://github.com/injekt/slop).
72
+
73
+ ### Run
74
+
75
+ $ realgrowl
76
+ $ realgrowl -t "New alert"
77
+ $ realgrowl -d "A new notification of something!" -t "New alert"
78
+
79
+ Contributors
80
+ -----------
81
+
82
+ * basicxman (Growl Executable)
data/Rakefile CHANGED
@@ -2,13 +2,15 @@ begin
2
2
  require 'jeweler'
3
3
  Jeweler::Tasks.new do |s|
4
4
  s.name = "real-growl"
5
- s.summary = "Growl notification library that uses native c bindings."
5
+ s.summary = "Growl notification library that was built using native c bindings."
6
6
  s.description = "A Growl notification library that uses native c bindings to interact with GrowlApplicationBridge rather than Growl's network API."
7
7
  s.email = "dewind@atomicobject.com"
8
8
  s.authors = ["Justin DeWind"]
9
9
  s.files = FileList["README.rdoc", "lib/**/*.rb", "Rakefile", "ext/**/*.h", "ext/**/*.c", "ext/**/*.m"]
10
10
  s.extensions = ["ext/extconf.rb"]
11
+ s.executables = ["realgrowl"]
11
12
  s.homepage = "http://github.com/dewind/real-growl"
13
+ s.add_dependency "slop"
12
14
  end
13
15
 
14
16
  Jeweler::GemcutterTasks.new
data/bin/realgrowl ADDED
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'real_growl'
5
+ require 'slop'
6
+
7
+ opts = Slop.parse do
8
+ on :s, :sticky, :default => true
9
+ on :t, :title, :optional => true, :default => "Alert"
10
+ on :d, :description, :optional => true, :default => "New Growl notification."
11
+ on :i, :icon, :optional => true, :default => RealGrowl::icon
12
+ on :p, :priority, :optional => true, :default => 0
13
+ end
14
+
15
+ args = {}
16
+ opts.to_hash.each { |k, v| args[k.to_sym] = v }
17
+
18
+ app = RealGrowl::Application.new(args[:title])
19
+ app.notify args
data/lib/real_growl.rb CHANGED
@@ -1,38 +1,53 @@
1
1
  require 'real_growl_api'
2
2
  require 'pp'
3
3
 
4
- module Kernel
5
- class<<self
6
- attr_accessor :rg_sticky, :rg_priority, :rg_icon
7
- end
8
-
9
- def rg(*args)
10
- Kernel.rg_priority ||= 0
11
- Kernel.rg_sticky = true if Kernel.rg_sticky.nil?
12
- icon = Kernel.rg_icon
13
- click = nil
14
-
15
- @__growl_app ||= RealGrowl::Application.new("RealGrowl")
16
-
17
- if args.last.is_a?(Hash) and (args.last[:icon] or args.last[:click])
18
- icon = args.last[:icon]
19
- click = args.last[:click]
20
- args.pop
21
- end
4
+ module RealGrowl
5
+ module ClassMethods
6
+ attr_accessor :sticky, :priority, :icon
22
7
 
23
- if RealGrowl.running?
24
- notifications = args.map { |x| x.pretty_inspect }
25
- notifications.each do |x|
26
- @__growl_app.notify(
27
- :title => 'rg',
28
- :description => x,
29
- :priority => Kernel.rg_priority,
30
- :sticky => Kernel.rg_sticky,
31
- :icon => icon
32
- )
8
+ def growl(*args)
9
+ self.priority ||= 0
10
+ self.sticky = true if self.sticky.nil?
11
+ icon = self.icon
12
+ click = nil
13
+
14
+ @__growl_app ||= RealGrowl::Application.new("RealGrowl")
15
+
16
+ if args.last.is_a?(Hash) and (args.last[:icon] or args.last[:click])
17
+ icon = args.last[:icon]
18
+ click = args.last[:click]
19
+ args.pop
20
+ end
21
+
22
+ if RealGrowl.running?
23
+ notifications = args.map { |x| x.pretty_inspect }
24
+ notifications.each do |x|
25
+ @__growl_app.notify(
26
+ :title => 'rg',
27
+ :description => x,
28
+ :priority => self.priority,
29
+ :sticky => self.sticky,
30
+ :icon => icon
31
+ )
32
+ end
33
33
  end
34
+ nil
34
35
  end
35
-
36
- nil
37
36
  end
37
+
38
+ module InstanceMethods
39
+ def rg(*args)
40
+ RealGrowl::growl(*args)
41
+ end
42
+ end
43
+
44
+ def self.included(receiver)
45
+ receiver.send :include, InstanceMethods
46
+ end
47
+
48
+ extend self::ClassMethods
49
+ end
50
+
51
+ class Object
52
+ include RealGrowl
38
53
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: real-growl
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 4
9
- - 2
10
- version: 0.4.2
8
+ - 5
9
+ - 1
10
+ version: 0.5.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Justin DeWind
@@ -15,14 +15,27 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-22 00:00:00 -04:00
19
- default_executable:
20
- dependencies: []
21
-
18
+ date: 2011-05-30 00:00:00 -04:00
19
+ default_executable: realgrowl
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: slop
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :runtime
34
+ version_requirements: *id001
22
35
  description: A Growl notification library that uses native c bindings to interact with GrowlApplicationBridge rather than Growl's network API.
23
36
  email: dewind@atomicobject.com
24
- executables: []
25
-
37
+ executables:
38
+ - realgrowl
26
39
  extensions:
27
40
  - ext/extconf.rb
28
41
  extra_rdoc_files:
@@ -35,6 +48,7 @@ files:
35
48
  - ext/ruby_delegate.h
36
49
  - lib/real_growl.rb
37
50
  - README.md
51
+ - bin/realgrowl
38
52
  - ext/extconf.rb
39
53
  has_rdoc: true
40
54
  homepage: http://github.com/dewind/real-growl
@@ -69,6 +83,6 @@ rubyforge_project:
69
83
  rubygems_version: 1.5.0
70
84
  signing_key:
71
85
  specification_version: 3
72
- summary: Growl notification library that uses native c bindings.
86
+ summary: Growl notification library that was built using native c bindings.
73
87
  test_files: []
74
88