cinch-memo 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Gemfile.lock +35 -0
- data/LICENSE +20 -0
- data/README.md +2 -2
- data/cinch-memo.gemspec +7 -7
- data/lib/{cinch-memo → cinch/plugins/memo}/base.rb +3 -2
- data/lib/{cinch-memo → cinch/plugins/memo}/store/redis.rb +0 -0
- data/lib/{cinch-memo → cinch/plugins/memo}/version.rb +1 -1
- data/lib/cinch/plugins/memo.rb +11 -0
- data/test/base_test.rb +2 -3
- data/test/teststrap.rb +1 -1
- metadata +23 -15
- data/lib/cinch-memo.rb +0 -10
data/.gitignore
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
cinch-memo (0.1.0)
|
5
|
+
cinch
|
6
|
+
json
|
7
|
+
redis
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: http://rubygems.org/
|
11
|
+
specs:
|
12
|
+
cinch (1.1.1)
|
13
|
+
json (1.5.1)
|
14
|
+
mocha (0.9.10)
|
15
|
+
rake
|
16
|
+
rake (0.8.7)
|
17
|
+
redis (2.1.1)
|
18
|
+
riot (0.12.1)
|
19
|
+
rr
|
20
|
+
term-ansicolor
|
21
|
+
rr (1.0.2)
|
22
|
+
term-ansicolor (1.0.5)
|
23
|
+
timecop (0.3.5)
|
24
|
+
|
25
|
+
PLATFORMS
|
26
|
+
ruby
|
27
|
+
|
28
|
+
DEPENDENCIES
|
29
|
+
cinch
|
30
|
+
cinch-memo!
|
31
|
+
json
|
32
|
+
mocha
|
33
|
+
redis
|
34
|
+
riot (~> 0.12.0)
|
35
|
+
timecop
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (C) 2011 by Arthur Chiu
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
20
|
+
|
data/README.md
CHANGED
@@ -42,7 +42,7 @@ It's simple. follow the guide on cinch or do something like:
|
|
42
42
|
|
43
43
|
# mybot.rb
|
44
44
|
require 'cinch'
|
45
|
-
require 'cinch
|
45
|
+
require 'cinch/plugins/memo'
|
46
46
|
|
47
47
|
Cinch::Plugins::Memo::Base.configure do |c|
|
48
48
|
c.store = :redis # data store
|
@@ -75,4 +75,4 @@ TODO
|
|
75
75
|
* add auto deliver message functionality when you sign on.
|
76
76
|
* add rate limiting ability
|
77
77
|
* add additional backend stores.
|
78
|
-
* add some kind of auth mech
|
78
|
+
* add some kind of auth mech
|
data/cinch-memo.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
$:.push File.expand_path("../lib", __FILE__)
|
3
|
-
require "cinch
|
3
|
+
require "cinch/plugins/memo/version"
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = "cinch-memo"
|
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
s.authors = ["Arthur Chiu"]
|
10
10
|
s.email = ["mr.arthur.chiu@gmail.com"]
|
11
|
-
s.homepage = "
|
11
|
+
s.homepage = "https://github.com/achiu/cinch-memo"
|
12
12
|
s.summary = %q{Memo Plugin for Cinch}
|
13
13
|
s.description = %q{Give your Cinch bot memo functionality!}
|
14
14
|
|
@@ -19,10 +19,10 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
20
|
s.require_paths = ["lib"]
|
21
21
|
|
22
|
-
s.add_dependency 'cinch'
|
22
|
+
s.add_dependency 'cinch', '~>1.1.1'
|
23
23
|
s.add_dependency 'json'
|
24
|
-
s.add_dependency 'redis'
|
25
|
-
s.add_development_dependency 'riot',
|
26
|
-
s.add_development_dependency 'mocha'
|
27
|
-
s.add_development_dependency 'timecop'
|
24
|
+
s.add_dependency 'redis'
|
25
|
+
s.add_development_dependency 'riot', '~>0.12.0'
|
26
|
+
s.add_development_dependency 'mocha', '~>0.9.10'
|
27
|
+
s.add_development_dependency 'timecop', '~>0.3.5'
|
28
28
|
end
|
@@ -6,7 +6,7 @@ module Cinch
|
|
6
6
|
attr_accessor :backend
|
7
7
|
|
8
8
|
class << self
|
9
|
-
attr_accessor :store, :host, :port
|
9
|
+
attr_accessor :store, :host, :port, :db, :collection
|
10
10
|
|
11
11
|
def configure(&block)
|
12
12
|
yield self
|
@@ -18,6 +18,7 @@ module Cinch
|
|
18
18
|
@backend =
|
19
19
|
case self.class.store
|
20
20
|
when :redis then Cinch::Plugins::Memo::Redis.new(self.class.host, self.class.port)
|
21
|
+
when :mongo then Cinch::Plugins::Memo::Mongo.new(self.class.host, self.class.port, :db => self.class.db, :collection => self.class.collection)
|
21
22
|
else
|
22
23
|
self.class.store
|
23
24
|
end
|
@@ -31,7 +32,7 @@ module Cinch
|
|
31
32
|
def listen(m)
|
32
33
|
messages = @backend.retrieve(m.user.nick)
|
33
34
|
if messages || !messages.empty?
|
34
|
-
messages.each { |msg|
|
35
|
+
messages.each { |msg| m.user.send(msg) }
|
35
36
|
end
|
36
37
|
end
|
37
38
|
|
File without changes
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'cinch'
|
2
|
+
|
3
|
+
module Cinch
|
4
|
+
module Plugins
|
5
|
+
module Memo
|
6
|
+
autoload :Base, File.expand_path('../memo/base',__FILE__)
|
7
|
+
autoload :Redis, File.expand_path('../memo/store/redis',__FILE__)
|
8
|
+
# autoload :Mongo, File.expand_path('../memo/store/mongo',__FILE__)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/test/base_test.rb
CHANGED
@@ -84,8 +84,7 @@ context "Base" do
|
|
84
84
|
end
|
85
85
|
context "with messages" do
|
86
86
|
setup do
|
87
|
-
@
|
88
|
-
@base.expects(:User).with('chris').returns(@u)
|
87
|
+
@replier.expects(:send).with('john')
|
89
88
|
@backend.expects(:retrieve).with('chris').returns(['john'])
|
90
89
|
@base.backend = @backend
|
91
90
|
end
|
@@ -95,7 +94,7 @@ context "Base" do
|
|
95
94
|
context "without messages" do
|
96
95
|
setup do
|
97
96
|
@backend.expects(:retrieve).with('chris').returns([])
|
98
|
-
@
|
97
|
+
@replier.expects(:send).with('john').never
|
99
98
|
@base.backend = @backend
|
100
99
|
end
|
101
100
|
asserts("that it doesn't ping them") { @base.listen(@message) }
|
data/test/teststrap.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 1
|
9
|
+
version: 0.1.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Arthur Chiu
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date:
|
17
|
+
date: 2011-01-29 00:00:00 -08:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -23,11 +23,13 @@ dependencies:
|
|
23
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
24
|
none: false
|
25
25
|
requirements:
|
26
|
-
- -
|
26
|
+
- - ~>
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
segments:
|
29
|
-
-
|
30
|
-
|
29
|
+
- 1
|
30
|
+
- 1
|
31
|
+
- 1
|
32
|
+
version: 1.1.1
|
31
33
|
type: :runtime
|
32
34
|
version_requirements: *id001
|
33
35
|
- !ruby/object:Gem::Dependency
|
@@ -77,11 +79,13 @@ dependencies:
|
|
77
79
|
requirement: &id005 !ruby/object:Gem::Requirement
|
78
80
|
none: false
|
79
81
|
requirements:
|
80
|
-
- -
|
82
|
+
- - ~>
|
81
83
|
- !ruby/object:Gem::Version
|
82
84
|
segments:
|
83
85
|
- 0
|
84
|
-
|
86
|
+
- 9
|
87
|
+
- 10
|
88
|
+
version: 0.9.10
|
85
89
|
type: :development
|
86
90
|
version_requirements: *id005
|
87
91
|
- !ruby/object:Gem::Dependency
|
@@ -90,11 +94,13 @@ dependencies:
|
|
90
94
|
requirement: &id006 !ruby/object:Gem::Requirement
|
91
95
|
none: false
|
92
96
|
requirements:
|
93
|
-
- -
|
97
|
+
- - ~>
|
94
98
|
- !ruby/object:Gem::Version
|
95
99
|
segments:
|
96
100
|
- 0
|
97
|
-
|
101
|
+
- 3
|
102
|
+
- 5
|
103
|
+
version: 0.3.5
|
98
104
|
type: :development
|
99
105
|
version_requirements: *id006
|
100
106
|
description: Give your Cinch bot memo functionality!
|
@@ -109,19 +115,21 @@ extra_rdoc_files: []
|
|
109
115
|
files:
|
110
116
|
- .gitignore
|
111
117
|
- Gemfile
|
118
|
+
- Gemfile.lock
|
119
|
+
- LICENSE
|
112
120
|
- README.md
|
113
121
|
- Rakefile
|
114
122
|
- cinch-memo.gemspec
|
115
|
-
- lib/cinch
|
116
|
-
- lib/cinch
|
117
|
-
- lib/cinch
|
118
|
-
- lib/cinch
|
123
|
+
- lib/cinch/plugins/memo.rb
|
124
|
+
- lib/cinch/plugins/memo/base.rb
|
125
|
+
- lib/cinch/plugins/memo/store/redis.rb
|
126
|
+
- lib/cinch/plugins/memo/version.rb
|
119
127
|
- test.watchr
|
120
128
|
- test/base_test.rb
|
121
129
|
- test/store/redis_test.rb
|
122
130
|
- test/teststrap.rb
|
123
131
|
has_rdoc: true
|
124
|
-
homepage:
|
132
|
+
homepage: https://github.com/achiu/cinch-memo
|
125
133
|
licenses: []
|
126
134
|
|
127
135
|
post_install_message:
|