growl_notify 0.0.1 → 0.0.3
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/Guardfile +9 -0
- data/Rakefile +8 -0
- data/Readme.md +6 -3
- data/growl_notify.gemspec +10 -9
- data/lib/growl_notify.rb +25 -3
- data/spec/growl_notify_spec.rb +17 -0
- data/spec/spec_helper.rb +5 -1
- metadata +61 -79
- data/lib/growl_notify/version.rb +0 -3
data/Guardfile
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
# Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
guard 'rspec', :version => 2, :cli => '--color --format doc' do
|
5
|
+
watch(%r{^spec/.+_spec\.rb$})
|
6
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
7
|
+
watch('spec/spec_helper.rb') { "spec" }
|
8
|
+
watch('growl_notify.gemspec') { "spec" }
|
9
|
+
end
|
data/Rakefile
CHANGED
data/Readme.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# GrowlNotify
|
2
2
|
|
3
|
-
This gem is based on the
|
3
|
+
This gem is based on the rb-appscript bindings to applescript
|
4
4
|
|
5
5
|
Benefits over all other growl gems:
|
6
6
|
|
@@ -15,7 +15,7 @@ Benefits over all other growl gems:
|
|
15
15
|
GrowlNotify.config do |config|
|
16
16
|
config.notifications = ["Compass Application", "Someother Notification"]
|
17
17
|
config.default_notifications = ["Compass Application"]
|
18
|
-
config.application_name = "My Application" #this
|
18
|
+
config.application_name = "My Application" #this shows up in the growl applications list in systems settings
|
19
19
|
end
|
20
20
|
|
21
21
|
You can also set a globally scoped icon:
|
@@ -53,8 +53,11 @@ You can also set a globally scoped icon:
|
|
53
53
|
6. application_name - This is set from configs but you can override it
|
54
54
|
7. with_name - must me one of your set default notifications by default its set to the first one
|
55
55
|
|
56
|
+
#### Error Handling
|
57
|
+
|
58
|
+
If the growl application is not installed on the system `GrowlNotify` will throw a `GrowlNotFound` exception.
|
56
59
|
|
57
|
-
##
|
60
|
+
## Author
|
58
61
|
|
59
62
|
GrowlNotify is written by [Scott Davis](http://sdavis.info)
|
60
63
|
|
data/growl_notify.gemspec
CHANGED
@@ -1,19 +1,18 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
$:.push File.expand_path("../lib", __FILE__)
|
3
|
-
require "growl_notify
|
3
|
+
require "growl_notify"
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = "growl_notify"
|
7
7
|
s.version = GrowlNotify::VERSION
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
s.authors = ["Scott Davis"]
|
10
|
-
s.email = ["
|
11
|
-
s.homepage = "https://github.com/
|
12
|
-
s.summary = %q{Growl
|
13
|
-
s.description =
|
14
|
-
|
15
|
-
|
16
|
-
DESC
|
10
|
+
s.email = ["me@sdavis.info"]
|
11
|
+
s.homepage = "https://github.com/scottdavis/growl_notify"
|
12
|
+
s.summary = %q{Growl gem for ruby based on the applescript api}
|
13
|
+
s.description = %q{Growl gem for ruby based on the applescript api}
|
14
|
+
|
15
|
+
s.rubyforge_project = "growl_notify"
|
17
16
|
|
18
17
|
s.files = `git ls-files`.split("\n")
|
19
18
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
@@ -21,6 +20,8 @@ Gem::Specification.new do |s|
|
|
21
20
|
s.require_paths = ["lib"]
|
22
21
|
s.add_dependency 'rb-appscript'
|
23
22
|
s.add_development_dependency 'rspec'
|
24
|
-
s.add_development_dependency '
|
23
|
+
s.add_development_dependency 'guard-rspec'
|
24
|
+
s.add_development_dependency 'mocha'
|
25
|
+
|
25
26
|
|
26
27
|
end
|
data/lib/growl_notify.rb
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
require 'appscript'
|
2
2
|
|
3
3
|
class GrowlNotify
|
4
|
-
|
4
|
+
VERSION = "0.0.3"
|
5
|
+
PRE_1_3_APP = "GrowlHelperApp"
|
6
|
+
POST_1_3_APP = "Growl"
|
7
|
+
class GrowlNotFound < Exception; end
|
5
8
|
class << self
|
6
9
|
include Appscript
|
7
10
|
|
@@ -23,7 +26,26 @@ class GrowlNotify
|
|
23
26
|
end
|
24
27
|
|
25
28
|
def register
|
26
|
-
|
29
|
+
application.register(:all_notifications => @notifications, :as_application => @application_name, :default_notifications => @default_notifications)
|
30
|
+
end
|
31
|
+
|
32
|
+
def application
|
33
|
+
@application = pre1_3_app
|
34
|
+
@application ||= post1_3_app
|
35
|
+
raise GrowlNotFound if @application.nil?
|
36
|
+
@application
|
37
|
+
end
|
38
|
+
|
39
|
+
def pre1_3_app
|
40
|
+
app(PRE_1_3_APP)
|
41
|
+
rescue FindApp::ApplicationNotFoundError
|
42
|
+
nil
|
43
|
+
end
|
44
|
+
|
45
|
+
def post1_3_app
|
46
|
+
app(POST_1_3_APP)
|
47
|
+
rescue FindApp::ApplicationNotFoundError
|
48
|
+
nil
|
27
49
|
end
|
28
50
|
|
29
51
|
def send_notification(options= {})
|
@@ -33,7 +55,7 @@ class GrowlNotify
|
|
33
55
|
if local_icon
|
34
56
|
defaults.merge!(:image_from_location => local_icon)
|
35
57
|
end
|
36
|
-
|
58
|
+
application.notify(defaults.merge(options))
|
37
59
|
end
|
38
60
|
|
39
61
|
def very_low(options={})
|
data/spec/growl_notify_spec.rb
CHANGED
@@ -14,6 +14,23 @@ describe GrowlNotify do
|
|
14
14
|
GrowlNotify.reset!
|
15
15
|
end
|
16
16
|
|
17
|
+
context 'application not found' do
|
18
|
+
before do
|
19
|
+
GrowlNotify.stubs(:pre1_3_app).returns(nil)
|
20
|
+
GrowlNotify.stubs(:post1_3_app).returns(nil)
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should raise correct error" do
|
24
|
+
lambda {
|
25
|
+
GrowlNotify.config do |config|
|
26
|
+
config.notifications = config.default_notifications = ["Compass Application"]
|
27
|
+
config.application_name = config.notifications.first
|
28
|
+
end
|
29
|
+
GrowlNotify.normal(:title => 'GrowlNotify Spec', :description => 'This is my "normal" message').should be_nil
|
30
|
+
}.should raise_error GrowlNotify::GrowlNotFound
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
17
34
|
context 'default' do
|
18
35
|
before do
|
19
36
|
GrowlNotify.config do |config|
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,122 +1,104 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: growl_notify
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 1
|
10
|
-
version: 0.0.1
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Scott Davis
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-10-05 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
22
15
|
name: rb-appscript
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70213464064040 !ruby/object:Gem::Requirement
|
25
17
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
segments:
|
31
|
-
- 0
|
32
|
-
version: "0"
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
33
22
|
type: :runtime
|
34
|
-
|
35
|
-
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70213464064040
|
25
|
+
- !ruby/object:Gem::Dependency
|
36
26
|
name: rspec
|
27
|
+
requirement: &70213464063620 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :development
|
37
34
|
prerelease: false
|
38
|
-
|
35
|
+
version_requirements: *70213464063620
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: guard-rspec
|
38
|
+
requirement: &70213464063200 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
|
-
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
segments:
|
45
|
-
- 0
|
46
|
-
version: "0"
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
47
44
|
type: :development
|
48
|
-
version_requirements: *id002
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: autotest
|
51
45
|
prerelease: false
|
52
|
-
|
46
|
+
version_requirements: *70213464063200
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: mocha
|
49
|
+
requirement: &70213464062780 !ruby/object:Gem::Requirement
|
53
50
|
none: false
|
54
|
-
requirements:
|
55
|
-
- -
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
|
58
|
-
segments:
|
59
|
-
- 0
|
60
|
-
version: "0"
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
61
55
|
type: :development
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70213464062780
|
58
|
+
description: Growl gem for ruby based on the applescript api
|
59
|
+
email:
|
60
|
+
- me@sdavis.info
|
66
61
|
executables: []
|
67
|
-
|
68
62
|
extensions: []
|
69
|
-
|
70
63
|
extra_rdoc_files: []
|
71
|
-
|
72
|
-
files:
|
64
|
+
files:
|
73
65
|
- .gitignore
|
74
66
|
- .rspec
|
75
67
|
- Gemfile
|
68
|
+
- Guardfile
|
76
69
|
- LICENSE.txt
|
77
70
|
- Rakefile
|
78
71
|
- Readme.md
|
79
72
|
- growl_notify.gemspec
|
80
73
|
- lib/growl_notify.rb
|
81
|
-
- lib/growl_notify/version.rb
|
82
74
|
- spec/growl_icon.png
|
83
75
|
- spec/growl_notify_spec.rb
|
84
76
|
- spec/spec_helper.rb
|
85
|
-
|
86
|
-
homepage: https://github.com/jetviper21/growl_notify
|
77
|
+
homepage: https://github.com/scottdavis/growl_notify
|
87
78
|
licenses: []
|
88
|
-
|
89
79
|
post_install_message:
|
90
80
|
rdoc_options: []
|
91
|
-
|
92
|
-
require_paths:
|
81
|
+
require_paths:
|
93
82
|
- lib
|
94
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
95
84
|
none: false
|
96
|
-
requirements:
|
97
|
-
- -
|
98
|
-
- !ruby/object:Gem::Version
|
99
|
-
|
100
|
-
|
101
|
-
- 0
|
102
|
-
version: "0"
|
103
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ! '>='
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
90
|
none: false
|
105
|
-
requirements:
|
106
|
-
- -
|
107
|
-
- !ruby/object:Gem::Version
|
108
|
-
|
109
|
-
segments:
|
110
|
-
- 0
|
111
|
-
version: "0"
|
91
|
+
requirements:
|
92
|
+
- - ! '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
112
95
|
requirements: []
|
113
|
-
|
114
|
-
|
115
|
-
rubygems_version: 1.5.2
|
96
|
+
rubyforge_project: growl_notify
|
97
|
+
rubygems_version: 1.8.10
|
116
98
|
signing_key:
|
117
99
|
specification_version: 3
|
118
|
-
summary: Growl
|
119
|
-
test_files:
|
100
|
+
summary: Growl gem for ruby based on the applescript api
|
101
|
+
test_files:
|
120
102
|
- spec/growl_icon.png
|
121
103
|
- spec/growl_notify_spec.rb
|
122
104
|
- spec/spec_helper.rb
|
data/lib/growl_notify/version.rb
DELETED