uniform_notifier 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,20 +1,20 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- uniform_notifier (0.0.1)
4
+ uniform_notifier (1.0.1)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
8
8
  specs:
9
9
  diff-lcs (1.1.2)
10
- rspec (2.1.0)
11
- rspec-core (~> 2.1.0)
12
- rspec-expectations (~> 2.1.0)
13
- rspec-mocks (~> 2.1.0)
14
- rspec-core (2.1.0)
15
- rspec-expectations (2.1.0)
10
+ rspec (2.3.0)
11
+ rspec-core (~> 2.3.0)
12
+ rspec-expectations (~> 2.3.0)
13
+ rspec-mocks (~> 2.3.0)
14
+ rspec-core (2.3.0)
15
+ rspec-expectations (2.3.0)
16
16
  diff-lcs (~> 1.1.2)
17
- rspec-mocks (2.1.0)
17
+ rspec-mocks (2.3.0)
18
18
  ruby-growl (3.0)
19
19
  xmpp4r (0.5)
20
20
 
@@ -22,7 +22,7 @@ PLATFORMS
22
22
  ruby
23
23
 
24
24
  DEPENDENCIES
25
- rspec
26
- ruby-growl
25
+ rspec (= 2.3.0)
26
+ ruby-growl (= 3.0)
27
27
  uniform_notifier!
28
- xmpp4r
28
+ xmpp4r (= 0.5)
data/README.md CHANGED
@@ -6,32 +6,34 @@ uniform_notifier is extracted from [bullet][0], it gives you the ability to send
6
6
  Install
7
7
  -------
8
8
 
9
- 1. install directly
9
+ ### install directly
10
10
 
11
11
  gem install uniform_notifier
12
12
 
13
- if you want to notify by growl or xmpp, you should install them first
13
+ if you want to notify by growl or xmpp, you should install them first
14
14
 
15
15
  gem install ruby-growl
16
16
  gem install xmpp4r
17
17
 
18
- 2. add it into Gemfile (Bundler)
18
+ ### add it into Gemfile (Bundler)
19
19
 
20
20
  gem "uniform_notifier"
21
21
 
22
- you should add ruby-growl and xmpp4r gem if you want.
22
+ you should add ruby-growl and xmpp4r gem if you want.
23
23
 
24
24
  Usage
25
25
  -----
26
26
 
27
- There are two types of notifications, one is <code>inline_notify</code>, for javascript alert and javascript console notifiers, which returns a string and will be combined, the other is <code>out_of_channel_notify</code>, for rails logger, customized logger, growl and xmpp, which doesn't return anything, just send the message to the notifiers.
27
+ There are two types of notifications,
28
+ one is <code>inline_notify</code>, for javascript alert and javascript console notifiers, which returns a string and will be combined,
29
+ the other is <code>out_of_channel_notify</code>, for rails logger, customized logger, growl and xmpp, which doesn't return anything, just send the message to the notifiers.
28
30
 
29
31
  By default, all notifiers are disabled, you should enable them first.
30
32
 
31
33
  # javascript alert
32
34
  UniformNotifier.alert = true
33
35
 
34
- # javascript console
36
+ # javascript console (Safari/Webkit browsers or Firefox w/Firebug installed)
35
37
  UniformNotifier.console = true
36
38
 
37
39
  # rails logger
@@ -48,15 +50,17 @@ By default, all notifiers are disabled, you should enable them first.
48
50
  UniformNotifier.growl = { :password => 'growl password' }
49
51
 
50
52
  # xmpp
51
- UniformNotifier.xmpp = { :account => 'bullets_account@jabber.org',
52
- :password => 'bullets_password_for_jabber',
53
- :receiver => 'your_account@jabber.org',
53
+ UniformNotifier.xmpp = { :account => 'sender_account@jabber.org',
54
+ :password => 'password_for_jabber',
55
+ :receiver => 'recipient_account@jabber.org',
54
56
  :show_online_status => true }
55
57
 
56
58
  After that, you can enjoy the notifiers, that's cool!
57
59
 
58
60
  # the notify message will be notified to rails logger, customized logger, growl or xmpp.
59
- UniformNotifier.active_notfiiers.out_of_channel_notify(notify_message)
61
+ UniformNotifier.active_notifiers.each do |notifier|
62
+ notifier.out_of_channel_notify(args.join("\n"))
63
+ end
60
64
 
61
65
  # the notify message will be wrapped by <script type="text/javascript">...</script>,
62
66
  # you should append the javascript_str at the bottom of http response body.
@@ -67,5 +71,33 @@ After that, you can enjoy the notifiers, that's cool!
67
71
  end
68
72
  javascript_str = responses.join("\n")
69
73
 
74
+ Growl Support
75
+ -------------
76
+
77
+ To get Growl support up-and-running, follow the steps below:
78
+
79
+ * Install the ruby-growl gem: <code>gem install ruby-growl</code>
80
+ * Open the Growl preference pane in Systems Preferences
81
+ * Click the "Network" tab
82
+ * Make sure both "Listen for incoming notifications" and "Allow remote application registration" are checked. *Note*: If you set a password, you will need to set <code>UniformNotifier.growl_password = { :password => 'growl password' }</code> in the config file.
83
+ * Restart Growl ("General" tab -> Stop Growl -> Start Growl)
84
+ * Boot up your application. UniformNotifier will automatically send a Growl notification when Growl is turned on. If you do not see it when your application loads, make sure it is enabled in your initializer and double-check the steps above.
85
+
86
+ ### Ruby 1.9 issue
87
+
88
+ ruby-growl gem has an issue about md5 in ruby 1.9, if you use growl and ruby 1.9, check this [gist][1]
89
+
90
+ XMPP/Jabber Support
91
+ -------------------
92
+
93
+ To get XMPP support up-and-running, follow the steps below:
94
+
95
+ * Install the xmpp4r gem: <code>gem install xmpp4r</code>
96
+ * Make both the sender and the recipient account add each other as contacts.
97
+ This will require you to manually log into both accounts, add each other
98
+ as contact and confirm each others contact request.
99
+ * Boot up your application. UniformNotifier will automatically send an XMPP notification when XMPP is turned on.
100
+
70
101
 
71
- [0]: https://github.com/flyerhzm/bullet
102
+ [0]: https://github.com/flyerhzm/bullet
103
+ [1]: https://gist.github.com/300184
data/Rakefile CHANGED
@@ -1,2 +1,25 @@
1
1
  require 'bundler'
2
2
  Bundler::GemHelper.install_tasks
3
+
4
+ require "rake"
5
+ require "rake/rdoctask"
6
+ require "rspec"
7
+ require "rspec/core/rake_task"
8
+
9
+ Rspec::Core::RakeTask.new(:spec) do |spec|
10
+ spec.pattern = "spec/**/*_spec.rb"
11
+ end
12
+
13
+ Rspec::Core::RakeTask.new('spec:progress') do |spec|
14
+ spec.rspec_opts = %w(--format progress)
15
+ spec.pattern = "spec/**/*_spec.rb"
16
+ end
17
+
18
+ Rake::RDocTask.new do |rdoc|
19
+ rdoc.rdoc_dir = "rdoc"
20
+ rdoc.title = "uniform_notifier #{UniformNotifier::VERSION}"
21
+ rdoc.rdoc_files.include("README*")
22
+ rdoc.rdoc_files.include("lib/**/*.rb")
23
+ end
24
+
25
+ task :default => :spec
@@ -12,8 +12,9 @@ module UniformNotifier
12
12
  end
13
13
 
14
14
  def self.setup_connection( growl )
15
+ return unless growl
15
16
  require 'ruby-growl'
16
- @password = growl == true ? nil : growl[:password]
17
+ @password = growl.instance_of?(Hash) ? growl[:password] : nil
17
18
  @growl = connect
18
19
 
19
20
  notify 'Uniform Notifier Growl has been turned on'
@@ -35,4 +36,4 @@ module UniformNotifier
35
36
  @growl.notify( 'uniform_notifier', 'Uniform Notifier', message )
36
37
  end
37
38
  end
38
- end
39
+ end
@@ -1,3 +1,3 @@
1
1
  module UniformNotifier
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -14,6 +14,8 @@ module UniformNotifier
14
14
  end
15
15
 
16
16
  def self.setup_connection( xmpp_information )
17
+ return unless xmpp_information
18
+
17
19
  require 'xmpp4r'
18
20
 
19
21
  @receiver = xmpp_information[:receiver]
@@ -47,4 +49,4 @@ module UniformNotifier
47
49
  Jabber::Presence.new.set_status( "Uniform Notifier started on #{Time.now}" )
48
50
  end
49
51
  end
50
- end
52
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,6 @@
1
1
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
2
2
 
3
3
  require "uniform_notifier"
4
+ require "ruby-growl"
5
+ require "xmpp4r"
4
6
  require "rspec"
@@ -1,5 +1,4 @@
1
1
  require 'spec_helper'
2
- require 'ruby-growl'
3
2
 
4
3
  describe UniformNotifier::Growl do
5
4
 
@@ -1,5 +1,4 @@
1
1
  require 'spec_helper'
2
- require 'xmpp4r'
3
2
 
4
3
  describe UniformNotifier::Xmpp do
5
4
  it "should not notify xmpp" do
@@ -14,9 +14,9 @@ Gem::Specification.new do |s|
14
14
 
15
15
  s.rubyforge_project = "uniform_notifier"
16
16
 
17
- s.add_development_dependency "rspec"
18
- s.add_development_dependency "ruby-growl"
19
- s.add_development_dependency "xmpp4r"
17
+ s.add_development_dependency "ruby-growl", "3.0"
18
+ s.add_development_dependency "xmpp4r", "0.5"
19
+ s.add_development_dependency "rspec", "2.3.0"
20
20
 
21
21
  s.files = `git ls-files`.split("\n")
22
22
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uniform_notifier
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 0
10
- version: 1.0.0
9
+ - 1
10
+ version: 1.0.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Richard Huang
@@ -15,49 +15,53 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-19 00:00:00 +08:00
18
+ date: 2010-12-15 00:00:00 +08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
- name: rspec
22
+ name: ruby-growl
23
23
  prerelease: false
24
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - ">="
27
+ - - "="
28
28
  - !ruby/object:Gem::Version
29
- hash: 3
29
+ hash: 7
30
30
  segments:
31
+ - 3
31
32
  - 0
32
- version: "0"
33
+ version: "3.0"
33
34
  type: :development
34
35
  version_requirements: *id001
35
36
  - !ruby/object:Gem::Dependency
36
- name: ruby-growl
37
+ name: xmpp4r
37
38
  prerelease: false
38
39
  requirement: &id002 !ruby/object:Gem::Requirement
39
40
  none: false
40
41
  requirements:
41
- - - ">="
42
+ - - "="
42
43
  - !ruby/object:Gem::Version
43
- hash: 3
44
+ hash: 1
44
45
  segments:
45
46
  - 0
46
- version: "0"
47
+ - 5
48
+ version: "0.5"
47
49
  type: :development
48
50
  version_requirements: *id002
49
51
  - !ruby/object:Gem::Dependency
50
- name: xmpp4r
52
+ name: rspec
51
53
  prerelease: false
52
54
  requirement: &id003 !ruby/object:Gem::Requirement
53
55
  none: false
54
56
  requirements:
55
- - - ">="
57
+ - - "="
56
58
  - !ruby/object:Gem::Version
57
59
  hash: 3
58
60
  segments:
61
+ - 2
62
+ - 3
59
63
  - 0
60
- version: "0"
64
+ version: 2.3.0
61
65
  type: :development
62
66
  version_requirements: *id003
63
67
  description: uniform notifier for rails logger, customized logger, javascript alert, javascript console, growl and xmpp