ellen 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +10 -0
- data/CHANGELOG.md +4 -0
- data/README.md +6 -1
- data/ellen.gemspec +2 -0
- data/images/screenshot.png +0 -0
- data/lib/ellen/action.rb +7 -4
- data/lib/ellen/brains/base.rb +25 -0
- data/lib/ellen/brains/null.rb +8 -0
- data/lib/ellen/handlers/base.rb +2 -2
- data/lib/ellen/handlers/help.rb +5 -3
- data/lib/ellen/handlers/ping.rb +4 -2
- data/lib/ellen/robot.rb +5 -0
- data/lib/ellen/version.rb +1 -1
- data/lib/ellen.rb +2 -0
- data/spec/ellen/robot_spec.rb +19 -0
- data/spec/spec_helper.rb +8 -0
- metadata +36 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 203a4ce23b6169ee603f302c4cf4cb63c34aab9c
|
4
|
+
data.tar.gz: a72e3c466c75837836ea97bc6c27045c01cbf200
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65b6421c0d520df08c9f9b47477dd2fb5e493f6b73c7586a68b260a9397b6c1a180f65e4f45066473e272869e9ca3fb02585d7fc8f54efef18e6d17efb211673
|
7
|
+
data.tar.gz: 0d27c7bad49d35166039e765cfeb61399456b9e31c68d0e08f1d08fcce071b3c412b3ff6fad9e49e3cc7cdb64eedf0b3e1a62a5a3714327a5db49e1f983079f3
|
data/.travis.yml
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
rvm:
|
2
|
+
- 1.9.3
|
3
|
+
- 2.0.0
|
4
|
+
- 2.1.0
|
5
|
+
branches:
|
6
|
+
only:
|
7
|
+
- master
|
8
|
+
env:
|
9
|
+
global:
|
10
|
+
secure: IFNYget7BZa+hDw+q0QZDtwkwwngTz/F96pB9gvE+U5y7UUAk6cI3dPEj0LYxRQZyLLi8R+aQ+MXY5Vw2q3vSQCUc/IGt6N/7O5L+X0ef8BzEiud4sLAGP3kXVgyAg1UtLjtLZcFWlQGvgj590r7X+1CgYHeLsnmXhXBVeBBYag=
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
# Ellen
|
1
|
+
# Ellen [![Build Status](https://travis-ci.org/r7kamura/ellen.png)](https://travis-ci.org/r7kamura/ellen) [![Code Climate](https://codeclimate.com/github/r7kamura/ellen.png)](https://codeclimate.com/github/r7kamura/ellen) [![Code Climate](https://codeclimate.com/github/r7kamura/ellen/coverage.png)](https://codeclimate.com/github/r7kamura/ellen)
|
2
|
+
|
2
3
|
A chatterbot framework, inspired by Hubot.
|
3
4
|
|
4
5
|
## Dependencies
|
@@ -18,6 +19,7 @@ You can create your own handlers to add new behaviors from
|
|
18
19
|
[Ellen::Handlers::Base](https://github.com/r7kamura/ellen/blob/master/lib/ellen/handlers/base.rb) DSL.
|
19
20
|
|
20
21
|
* [Ellen::Handlers::Help](https://github.com/r7kamura/ellen/blob/master/lib/ellen/handlers/help.rb)
|
22
|
+
* [Ellen::Handlers::Ping](https://github.com/r7kamura/ellen/blob/master/lib/ellen/handlers/ping.rb)
|
21
23
|
* [Ellen::Handlers::GoogleImage](https://github.com/r7kamura/ellen-google_image)
|
22
24
|
|
23
25
|
## Bundler
|
@@ -54,3 +56,6 @@ $ heroku scale bot=1
|
|
54
56
|
$ heroku config:set FOO=1 BAR=2 BAZ=3
|
55
57
|
$ git push heroku master
|
56
58
|
```
|
59
|
+
|
60
|
+
## Screenshot
|
61
|
+
![](https://raw.githubusercontent.com/r7kamura/ellen/master/images/screenshot.png)
|
data/ellen.gemspec
CHANGED
@@ -21,7 +21,9 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_dependency "dotenv"
|
22
22
|
spec.add_dependency "mem"
|
23
23
|
spec.add_dependency "slop"
|
24
|
+
spec.add_development_dependency "codeclimate-test-reporter", ">= 0.3.0"
|
24
25
|
spec.add_development_dependency "pry"
|
25
26
|
spec.add_development_dependency "rake"
|
26
27
|
spec.add_development_dependency "rspec", "2.14.1"
|
28
|
+
spec.add_development_dependency "simplecov"
|
27
29
|
end
|
Binary file
|
data/lib/ellen/action.rb
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
module Ellen
|
2
2
|
class Action
|
3
|
-
attr_reader :
|
3
|
+
attr_reader :options, :pattern
|
4
4
|
|
5
|
-
def initialize(pattern, options = {}
|
5
|
+
def initialize(pattern, options = {})
|
6
6
|
@pattern = pattern
|
7
7
|
@options = options
|
8
|
-
@block = block
|
9
8
|
end
|
10
9
|
|
11
10
|
def call(handler, message)
|
12
|
-
handler.
|
11
|
+
handler.send(name, message) if message.match pattern_with(handler.robot.name)
|
13
12
|
end
|
14
13
|
|
15
14
|
def all?
|
@@ -20,6 +19,10 @@ module Ellen
|
|
20
19
|
options[:description] || "(no description)"
|
21
20
|
end
|
22
21
|
|
22
|
+
def name
|
23
|
+
options[:name]
|
24
|
+
end
|
25
|
+
|
23
26
|
private
|
24
27
|
|
25
28
|
def pattern_with(name)
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Ellen
|
2
|
+
module Brains
|
3
|
+
class Base
|
4
|
+
class << self
|
5
|
+
def inherited(child)
|
6
|
+
brain_classes << child
|
7
|
+
end
|
8
|
+
|
9
|
+
def find_class
|
10
|
+
brain_classes.last
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def brain_classes
|
16
|
+
@brain_classes ||= []
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def data
|
21
|
+
@data ||= {}
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/ellen/handlers/base.rb
CHANGED
data/lib/ellen/handlers/help.rb
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
module Ellen
|
2
2
|
module Handlers
|
3
3
|
class Help < Base
|
4
|
-
on /help\z/i, description: "Show this help message"
|
4
|
+
on /help\z/i, name: "help", description: "Show this help message"
|
5
|
+
|
6
|
+
def help(message)
|
5
7
|
lines = Ellen.handlers.map(&:actions).flatten.sort_by(&:all?).map do |action|
|
6
|
-
prefix = "@#{name} " unless action.all?
|
8
|
+
prefix = "@#{robot.name} " unless action.all?
|
7
9
|
line = "%-30s - #{action.description}" % "#{prefix}#{action.pattern.inspect}"
|
8
10
|
line
|
9
11
|
end
|
10
|
-
say lines.join("\n")
|
12
|
+
robot.say lines.join("\n")
|
11
13
|
end
|
12
14
|
end
|
13
15
|
end
|
data/lib/ellen/handlers/ping.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
module Ellen
|
2
2
|
module Handlers
|
3
3
|
class Ping < Base
|
4
|
-
on /ping\z/i, description: "Return PONG to PING"
|
5
|
-
|
4
|
+
on /ping\z/i, name: "ping", description: "Return PONG to PING"
|
5
|
+
|
6
|
+
def ping(message)
|
7
|
+
robot.say message.body[-4..-1].gsub(/i/i, "i" => "o", "I" => "O")
|
6
8
|
end
|
7
9
|
end
|
8
10
|
end
|
data/lib/ellen/robot.rb
CHANGED
data/lib/ellen/version.rb
CHANGED
data/lib/ellen.rb
CHANGED
@@ -34,6 +34,8 @@ require "ellen/action"
|
|
34
34
|
require "ellen/adapter_builder"
|
35
35
|
require "ellen/adapters/base"
|
36
36
|
require "ellen/adapters/shell"
|
37
|
+
require "ellen/brains/base"
|
38
|
+
require "ellen/brains/null"
|
37
39
|
require "ellen/command_builder"
|
38
40
|
require "ellen/commands/base"
|
39
41
|
require "ellen/commands/generate"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Ellen::Robot do
|
4
|
+
let(:instance) do
|
5
|
+
described_class.new(options)
|
6
|
+
end
|
7
|
+
|
8
|
+
let(:options) do
|
9
|
+
{}
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "#brain" do
|
13
|
+
context "without any brain extension gem" do
|
14
|
+
it "returns a Ellen::Brains::Base" do
|
15
|
+
instance.brain.should be_a Ellen::Brains::Base
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ellen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryo Nakamura
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: codeclimate-test-reporter
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.3.0
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.3.0
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: pry
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,6 +136,20 @@ dependencies:
|
|
122
136
|
- - '='
|
123
137
|
- !ruby/object:Gem::Version
|
124
138
|
version: 2.14.1
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: simplecov
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
125
153
|
description:
|
126
154
|
email:
|
127
155
|
- r7kamura@gmail.com
|
@@ -131,6 +159,7 @@ extensions: []
|
|
131
159
|
extra_rdoc_files: []
|
132
160
|
files:
|
133
161
|
- ".gitignore"
|
162
|
+
- ".travis.yml"
|
134
163
|
- CHANGELOG.md
|
135
164
|
- Gemfile
|
136
165
|
- LICENSE.txt
|
@@ -138,11 +167,14 @@ files:
|
|
138
167
|
- Rakefile
|
139
168
|
- bin/ellen
|
140
169
|
- ellen.gemspec
|
170
|
+
- images/screenshot.png
|
141
171
|
- lib/ellen.rb
|
142
172
|
- lib/ellen/action.rb
|
143
173
|
- lib/ellen/adapter_builder.rb
|
144
174
|
- lib/ellen/adapters/base.rb
|
145
175
|
- lib/ellen/adapters/shell.rb
|
176
|
+
- lib/ellen/brains/base.rb
|
177
|
+
- lib/ellen/brains/null.rb
|
146
178
|
- lib/ellen/command_builder.rb
|
147
179
|
- lib/ellen/commands/base.rb
|
148
180
|
- lib/ellen/commands/generate.rb
|
@@ -157,6 +189,7 @@ files:
|
|
157
189
|
- lib/ellen/version.rb
|
158
190
|
- spec/ellen/commands/generate_spec.rb
|
159
191
|
- spec/ellen/commands/run_spec.rb
|
192
|
+
- spec/ellen/robot_spec.rb
|
160
193
|
- spec/spec_helper.rb
|
161
194
|
- templates/Gemfile
|
162
195
|
homepage: https://github.com/r7kamura/ellen
|
@@ -186,4 +219,5 @@ summary: A chatterbot framework, inspired by Hubot
|
|
186
219
|
test_files:
|
187
220
|
- spec/ellen/commands/generate_spec.rb
|
188
221
|
- spec/ellen/commands/run_spec.rb
|
222
|
+
- spec/ellen/robot_spec.rb
|
189
223
|
- spec/spec_helper.rb
|