chatterbox 0.3.3 → 0.4.0
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/.gitignore +2 -1
- data/README.markdown +15 -4
- data/Rakefile +14 -10
- data/chatterbox.gemspec +12 -11
- data/examples/chatterbox_example.rb +2 -10
- data/examples/example_helper.rb +2 -2
- data/lib/chatterbox.rb +3 -4
- data/version.yml +2 -2
- metadata +6 -6
data/.gitignore
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
coverage
|
1
|
+
coverage
|
2
|
+
pkg
|
data/README.markdown
CHANGED
@@ -6,11 +6,13 @@ Simple Notifications. Publishing and subscribing to notifications is decoupled
|
|
6
6
|
Installing and Running
|
7
7
|
---------------------------------------
|
8
8
|
|
9
|
-
|
9
|
+
For plain old gem install:
|
10
10
|
|
11
|
-
|
11
|
+
gem install chatterbox "source" => "http://gemcutter.org"
|
12
12
|
|
13
|
-
|
13
|
+
To install within a Rails app, add the following to your environment.rb file:
|
14
|
+
|
15
|
+
config.gem "chatterbox", :source => "http://gemcutter.org"
|
14
16
|
|
15
17
|
Then run:
|
16
18
|
|
@@ -25,15 +27,24 @@ To enable standard Rails exception catching for your controllers, add the follow
|
|
25
27
|
|
26
28
|
Then, wire up a producer
|
27
29
|
|
30
|
+
|
28
31
|
Example 1
|
29
32
|
---------------------------------------
|
30
33
|
|
31
|
-
|
34
|
+
Register the email service to handle messages that get sent to Chatterbox:
|
32
35
|
|
33
36
|
Chatterbox::Publishers.register do |notice|
|
34
37
|
Chatterbox::Email.deliver(notice)
|
35
38
|
end
|
36
39
|
|
40
|
+
Then, wherever you want to send email, do this:
|
41
|
+
|
42
|
+
message = {
|
43
|
+
:config => { :to => "joe@example.com", :from => "donotreply@example.com" },
|
44
|
+
:message => { :summary => "your subject line here" }
|
45
|
+
}
|
46
|
+
Chatterbox.handle_notice(options)
|
47
|
+
|
37
48
|
Example 2
|
38
49
|
---------------------------------------
|
39
50
|
|
data/Rakefile
CHANGED
@@ -5,13 +5,14 @@ begin
|
|
5
5
|
Jeweler::Tasks.new do |gem|
|
6
6
|
gem.name = "chatterbox"
|
7
7
|
gem.summary = %Q{Notifications and messages}
|
8
|
+
gem.description = %W{Send messages. However you want.}
|
8
9
|
gem.email = "rsanheim@gmail.com"
|
9
10
|
gem.homepage = "http://github.com/rsanheim/chatterbox"
|
10
11
|
gem.authors = ["Rob Sanheim"]
|
11
12
|
gem.add_development_dependency "mocha"
|
12
|
-
gem.add_development_dependency "
|
13
|
-
gem.add_development_dependency "
|
14
|
-
gem.add_development_dependency "
|
13
|
+
gem.add_development_dependency "actionpack"
|
14
|
+
gem.add_development_dependency "micronaut"
|
15
|
+
gem.add_development_dependency "micronaut-rails"
|
15
16
|
end
|
16
17
|
Jeweler::GemcutterTasks.new
|
17
18
|
rescue LoadError
|
@@ -32,16 +33,19 @@ end
|
|
32
33
|
|
33
34
|
task :default => :examples
|
34
35
|
|
36
|
+
begin
|
37
|
+
%w{sdoc sdoc-helpers rdiscount}.each { |name| gem name }
|
38
|
+
require 'sdoc_helpers'
|
39
|
+
rescue LoadError => ex
|
40
|
+
puts "sdoc support not enabled:"
|
41
|
+
puts ex.inspect
|
42
|
+
end
|
43
|
+
|
35
44
|
require 'rake/rdoctask'
|
36
45
|
Rake::RDocTask.new do |rdoc|
|
37
|
-
|
38
|
-
version = File.read('VERSION')
|
39
|
-
else
|
40
|
-
version = ""
|
41
|
-
end
|
42
|
-
|
46
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ''
|
43
47
|
rdoc.rdoc_dir = 'rdoc'
|
44
|
-
rdoc.title = "chatterbox
|
48
|
+
rdoc.title = "chatterbox #{version}"
|
45
49
|
rdoc.rdoc_files.include('README*')
|
46
50
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
47
51
|
end
|
data/chatterbox.gemspec
CHANGED
@@ -5,11 +5,12 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{chatterbox}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.4.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Rob Sanheim"]
|
12
|
-
s.date = %q{2009-10-
|
12
|
+
s.date = %q{2009-10-09}
|
13
|
+
s.description = %q{["Send", "messages.", "However", "you", "want."]}
|
13
14
|
s.email = %q{rsanheim@gmail.com}
|
14
15
|
s.extra_rdoc_files = [
|
15
16
|
"LICENSE",
|
@@ -57,19 +58,19 @@ Gem::Specification.new do |s|
|
|
57
58
|
|
58
59
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
59
60
|
s.add_development_dependency(%q<mocha>, [">= 0"])
|
60
|
-
s.add_development_dependency(%q<
|
61
|
-
s.add_development_dependency(%q<
|
62
|
-
s.add_development_dependency(%q<
|
61
|
+
s.add_development_dependency(%q<actionpack>, [">= 0"])
|
62
|
+
s.add_development_dependency(%q<micronaut>, [">= 0"])
|
63
|
+
s.add_development_dependency(%q<micronaut-rails>, [">= 0"])
|
63
64
|
else
|
64
65
|
s.add_dependency(%q<mocha>, [">= 0"])
|
65
|
-
s.add_dependency(%q<
|
66
|
-
s.add_dependency(%q<
|
67
|
-
s.add_dependency(%q<
|
66
|
+
s.add_dependency(%q<actionpack>, [">= 0"])
|
67
|
+
s.add_dependency(%q<micronaut>, [">= 0"])
|
68
|
+
s.add_dependency(%q<micronaut-rails>, [">= 0"])
|
68
69
|
end
|
69
70
|
else
|
70
71
|
s.add_dependency(%q<mocha>, [">= 0"])
|
71
|
-
s.add_dependency(%q<
|
72
|
-
s.add_dependency(%q<
|
73
|
-
s.add_dependency(%q<
|
72
|
+
s.add_dependency(%q<actionpack>, [">= 0"])
|
73
|
+
s.add_dependency(%q<micronaut>, [">= 0"])
|
74
|
+
s.add_dependency(%q<micronaut-rails>, [">= 0"])
|
74
75
|
end
|
75
76
|
end
|
@@ -14,17 +14,9 @@ describe Chatterbox do
|
|
14
14
|
describe "handle_notice" do
|
15
15
|
include Chatterbox
|
16
16
|
|
17
|
-
it "should create Notification and return the notice" do
|
18
|
-
notification = mock(:notice => {:hash => 'of awesomeness'})
|
19
|
-
Chatterbox::Notification.expects(:new).returns(notification)
|
20
|
-
handle_notice("message")
|
21
|
-
end
|
22
|
-
|
23
17
|
it "should publish the notice" do
|
24
|
-
|
25
|
-
Chatterbox
|
26
|
-
expects(:publish_notice).with({:hash => 'of awesomeness'})
|
27
|
-
handle_notice("message")
|
18
|
+
Chatterbox.expects(:publish_notice).with("message")
|
19
|
+
Chatterbox.handle_notice("message")
|
28
20
|
end
|
29
21
|
|
30
22
|
end
|
data/examples/example_helper.rb
CHANGED
@@ -6,9 +6,9 @@ require 'mocha'
|
|
6
6
|
|
7
7
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
8
8
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
9
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'lib'))
|
9
|
+
# $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'lib'))
|
10
10
|
|
11
|
-
require 'chatterbox'
|
11
|
+
require 'lib/chatterbox'
|
12
12
|
|
13
13
|
def not_in_editor?
|
14
14
|
!(ENV.has_key?('TM_MODE') || ENV.has_key?('EMACS') || ENV.has_key?('VIM'))
|
data/lib/chatterbox.rb
CHANGED
@@ -4,12 +4,11 @@ require File.join(File.dirname(__FILE__), *%w[consumers])
|
|
4
4
|
module Chatterbox
|
5
5
|
|
6
6
|
def handle_notice(message)
|
7
|
-
|
8
|
-
publish_notice(notice)
|
7
|
+
publish_notice(message)
|
9
8
|
end
|
10
9
|
|
11
|
-
def publish_notice(
|
12
|
-
Publishers.publishers.each { |p| p.call(
|
10
|
+
def publish_notice(message)
|
11
|
+
Publishers.publishers.each { |p| p.call(message) }
|
13
12
|
end
|
14
13
|
|
15
14
|
def logger
|
data/version.yml
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chatterbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob Sanheim
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-10-
|
12
|
+
date: 2009-10-09 00:00:00 -06:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -23,7 +23,7 @@ dependencies:
|
|
23
23
|
version: "0"
|
24
24
|
version:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
|
-
name:
|
26
|
+
name: actionpack
|
27
27
|
type: :development
|
28
28
|
version_requirement:
|
29
29
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -33,7 +33,7 @@ dependencies:
|
|
33
33
|
version: "0"
|
34
34
|
version:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
|
-
name:
|
36
|
+
name: micronaut
|
37
37
|
type: :development
|
38
38
|
version_requirement:
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: "0"
|
44
44
|
version:
|
45
45
|
- !ruby/object:Gem::Dependency
|
46
|
-
name:
|
46
|
+
name: micronaut-rails
|
47
47
|
type: :development
|
48
48
|
version_requirement:
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -52,7 +52,7 @@ dependencies:
|
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: "0"
|
54
54
|
version:
|
55
|
-
description:
|
55
|
+
description: "[\"Send\", \"messages.\", \"However\", \"you\", \"want.\"]"
|
56
56
|
email: rsanheim@gmail.com
|
57
57
|
executables: []
|
58
58
|
|