ruboty 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +3 -3
- data/lib/ruboty.rb +2 -2
- data/lib/ruboty/adapters/shell.rb +1 -1
- data/lib/ruboty/version.rb +1 -1
- data/ruboty.gemspec +1 -1
- data/spec/ruboty/adapter_builder_spec.rb +2 -2
- data/spec/ruboty/adapters/shell_spec.rb +11 -11
- data/spec/ruboty/commands/generate_spec.rb +2 -2
- data/spec/ruboty/commands/run_spec.rb +1 -1
- data/spec/ruboty/env/validatable_spec.rb +2 -2
- data/spec/ruboty/handlers/base_spec.rb +1 -1
- data/spec/ruboty/handlers/help_spec.rb +2 -2
- data/spec/ruboty/handlers/ping_spec.rb +1 -1
- data/spec/ruboty/handlers/whoami_spec.rb +1 -1
- data/spec/ruboty/robot_spec.rb +3 -3
- data/spec/spec_helper.rb +0 -1
- metadata +5 -5
- data/lib/ruboty/logger.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 985c3008104c6e170325097857be489a8128f97b
|
4
|
+
data.tar.gz: aad5cc9b0fba7c702b5059aa994b0878abed94c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07696686fdaab75c885b4136d03370b1a2c16e1fe4273213e96ed87fbd3f93952e657d3875bbc475568fd37e24f56a71ee9cd5b4efe996a3854bbad1e9a46852
|
7
|
+
data.tar.gz: f6783b8b5fd0d864a8328ee619b98545ee44b065ead9238072d9fe85cdbc33def02bac1f7e32b82c2da357f38d731e56614f1c58d1bcc3421d54c4f6544c2d8d
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -8,10 +8,11 @@ Ruby + Bot = Ruboty.
|
|
8
8
|
## Adapter
|
9
9
|
Adapter hooks up ruboty to chat services.
|
10
10
|
|
11
|
-
* [ruboty-hipchat](https://github.com/r7kamura/ruboty-hipchat)
|
12
|
-
* [ruboty-idobata](https://github.com/hanachin/ruboty-idobata)
|
13
11
|
* [ruboty-slack](https://github.com/r7kamura/ruboty-slack)
|
14
12
|
* [ruboty-twitter](https://github.com/r7kamura/ruboty-twitter)
|
13
|
+
* [ruboty-hipchat](https://github.com/r7kamura/ruboty-hipchat)
|
14
|
+
* [ruboty-idobata](https://github.com/hanachin/ruboty-idobata)
|
15
|
+
* [ruboty-chatwork](https://github.com/mhag/ruboty-chatwork)
|
15
16
|
|
16
17
|
## Brain
|
17
18
|
Brain persists memories.
|
@@ -27,7 +28,6 @@ Handler provides various behaviors.
|
|
27
28
|
* [ruboty-echo](https://github.com/taiki45/ruboty-echo)
|
28
29
|
* [ruboty-github](https://github.com/r7kamura/ruboty-github)
|
29
30
|
* [ruboty-google_image](https://github.com/r7kamura/ruboty-google_image)
|
30
|
-
* [ruboty-japan_weather](https://github.com/taiki45/ruboty-japan_weather)
|
31
31
|
* [ruboty-kokodeikku](https://github.com/r7kamura/ruboty-kokodeikku)
|
32
32
|
* [ruboty-lgtm](https://github.com/negipo/ruboty-lgtm)
|
33
33
|
* [ruboty-syoboi_calendar](https://github.com/r7kamura/ruboty-syoboi_calendar)
|
data/lib/ruboty.rb
CHANGED
@@ -3,6 +3,7 @@ require "active_support/core_ext/module/delegation"
|
|
3
3
|
require "active_support/core_ext/string/inflections"
|
4
4
|
require "bundler"
|
5
5
|
require "dotenv"
|
6
|
+
require "logger"
|
6
7
|
require "mem"
|
7
8
|
require "slop"
|
8
9
|
|
@@ -13,7 +14,7 @@ module Ruboty
|
|
13
14
|
def logger
|
14
15
|
@logger ||= begin
|
15
16
|
$stdout.sync = true
|
16
|
-
logger =
|
17
|
+
logger = Logger.new($stdout)
|
17
18
|
logger.level = ENV["LOG_LEVEL"] ? ENV["LOG_LEVEL"].to_i : Logger::INFO
|
18
19
|
logger
|
19
20
|
end
|
@@ -55,7 +56,6 @@ require "ruboty/commands/generate"
|
|
55
56
|
require "ruboty/commands/help"
|
56
57
|
require "ruboty/commands/run"
|
57
58
|
require "ruboty/handlers/base"
|
58
|
-
require "ruboty/logger"
|
59
59
|
require "ruboty/message"
|
60
60
|
require "ruboty/robot"
|
61
61
|
require "ruboty/version"
|
data/lib/ruboty/version.rb
CHANGED
data/ruboty.gemspec
CHANGED
@@ -23,6 +23,6 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_dependency "slop"
|
24
24
|
spec.add_development_dependency "codeclimate-test-reporter", ">= 0.3.0"
|
25
25
|
spec.add_development_dependency "rake"
|
26
|
-
spec.add_development_dependency "rspec", "
|
26
|
+
spec.add_development_dependency "rspec", "3.4.0"
|
27
27
|
spec.add_development_dependency "simplecov"
|
28
28
|
end
|
@@ -12,7 +12,7 @@ describe Ruboty::AdapterBuilder do
|
|
12
12
|
describe "#build" do
|
13
13
|
context "with no other adapter class definition" do
|
14
14
|
it "returns a Ruboty::Adapters::Shell as a default adapter" do
|
15
|
-
builder.build.
|
15
|
+
expect(builder.build).to be_a Ruboty::Adapters::Shell
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
@@ -29,7 +29,7 @@ describe Ruboty::AdapterBuilder do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
it "returns an instance of that adapter class" do
|
32
|
-
builder.build.
|
32
|
+
expect(builder.build).to be_a another_adapter_class
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe Ruboty::Adapters::Shell do
|
4
4
|
before do
|
5
|
-
Ruboty.logger.
|
5
|
+
allow(Ruboty.logger).to receive(:info)
|
6
6
|
end
|
7
7
|
|
8
8
|
let(:adapter) do
|
@@ -16,40 +16,40 @@ describe Ruboty::Adapters::Shell do
|
|
16
16
|
describe "#run" do
|
17
17
|
context "with `exit`" do
|
18
18
|
it "stops" do
|
19
|
-
Readline.
|
20
|
-
adapter.
|
19
|
+
allow(Readline).to receive(:readline).and_return("exit")
|
20
|
+
expect(adapter).to receive(:stop).and_call_original
|
21
21
|
adapter.run
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
25
|
context "with `quit`" do
|
26
26
|
it "stops" do
|
27
|
-
Readline.
|
28
|
-
adapter.
|
27
|
+
allow(Readline).to receive(:readline).and_return("quit")
|
28
|
+
expect(adapter).to receive(:stop).and_call_original
|
29
29
|
adapter.run
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
33
|
context "with EOF" do
|
34
34
|
it "stops" do
|
35
|
-
Readline.
|
36
|
-
adapter.
|
35
|
+
allow(Readline).to receive(:readline).and_return(nil)
|
36
|
+
expect(adapter).to receive(:stop).and_call_original
|
37
37
|
adapter.run
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
41
|
context "with Inturrupt from console" do
|
42
42
|
it "stops" do
|
43
|
-
Readline.
|
44
|
-
adapter.
|
43
|
+
allow(Readline).to receive(:readline).and_raise(Interrupt)
|
44
|
+
expect(adapter).to receive(:stop).and_call_original
|
45
45
|
adapter.run
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
49
|
context "without `exit` nor `quit`" do
|
50
50
|
it "passes given message to robot" do
|
51
|
-
Readline.
|
52
|
-
robot.
|
51
|
+
allow(Readline).to receive(:readline).and_return("a", "exit")
|
52
|
+
expect(robot).to receive(:receive).with(body: "a", source: described_class::SOURCE)
|
53
53
|
adapter.run
|
54
54
|
end
|
55
55
|
end
|
@@ -21,7 +21,7 @@ describe Ruboty::Commands::Generate do
|
|
21
21
|
context "with normal condition" do
|
22
22
|
it "generates ./ruboty/ directory from our templates" do
|
23
23
|
call
|
24
|
-
File.
|
24
|
+
expect(File).to be_exist("./ruboty/")
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -31,7 +31,7 @@ describe Ruboty::Commands::Generate do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
it "exits process with dying message" do
|
34
|
-
Ruboty.logger.
|
34
|
+
expect(Ruboty.logger).to receive(:error).with("Error: ./ruboty/ already exists.")
|
35
35
|
expect { call }.to raise_error(SystemExit)
|
36
36
|
end
|
37
37
|
end
|
@@ -39,8 +39,8 @@ describe Ruboty::Env::Validatable do
|
|
39
39
|
describe "#validate!" do
|
40
40
|
context "without required ENV" do
|
41
41
|
it "dies with usage as erorr message" do
|
42
|
-
Ruboty.logger.
|
43
|
-
Ruboty.
|
42
|
+
expect(Ruboty.logger).to receive(:error).with(/description of A/)
|
43
|
+
expect(Ruboty).to receive(:exit)
|
44
44
|
instance.validate!
|
45
45
|
end
|
46
46
|
end
|
@@ -24,7 +24,7 @@ describe Ruboty::Handlers::Help do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
it "responds to `@ruboty help` and says each handler's description" do
|
27
|
-
robot.
|
27
|
+
expect(robot).to receive(:say).with(
|
28
28
|
body: body,
|
29
29
|
code: true,
|
30
30
|
from: to,
|
@@ -42,7 +42,7 @@ describe Ruboty::Handlers::Help do
|
|
42
42
|
|
43
43
|
context "with filter" do
|
44
44
|
it "filters descriptions by given filter" do
|
45
|
-
robot.
|
45
|
+
expect(robot).to receive(:say).with(
|
46
46
|
hash_including(
|
47
47
|
body: "ruboty /ping\\z/i - Return PONG to PING",
|
48
48
|
),
|
data/spec/ruboty/robot_spec.rb
CHANGED
@@ -12,12 +12,12 @@ describe Ruboty::Robot do
|
|
12
12
|
describe "#brain" do
|
13
13
|
context "without any Brain class" do
|
14
14
|
it "returns a Ruboty::Brains::Memory" do
|
15
|
-
instance.brain.
|
15
|
+
expect(instance.brain).to be_a Ruboty::Brains::Memory
|
16
16
|
end
|
17
17
|
|
18
18
|
it "can be used as a Hash object" do
|
19
19
|
instance.brain.data["a"] = 1
|
20
|
-
instance.brain.data["a"].
|
20
|
+
expect(instance.brain.data["a"]).to eq 1
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
@@ -31,7 +31,7 @@ describe Ruboty::Robot do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
it "returns its instance as a Brain" do
|
34
|
-
instance.brain.
|
34
|
+
expect(instance.brain).to be_a another_brain_class
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruboty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryo Nakamura
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -114,14 +114,14 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - '='
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
117
|
+
version: 3.4.0
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - '='
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
124
|
+
version: 3.4.0
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: simplecov
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -176,7 +176,6 @@ files:
|
|
176
176
|
- lib/ruboty/handlers/help.rb
|
177
177
|
- lib/ruboty/handlers/ping.rb
|
178
178
|
- lib/ruboty/handlers/whoami.rb
|
179
|
-
- lib/ruboty/logger.rb
|
180
179
|
- lib/ruboty/message.rb
|
181
180
|
- lib/ruboty/robot.rb
|
182
181
|
- lib/ruboty/version.rb
|
@@ -229,3 +228,4 @@ test_files:
|
|
229
228
|
- spec/ruboty/handlers/whoami_spec.rb
|
230
229
|
- spec/ruboty/robot_spec.rb
|
231
230
|
- spec/spec_helper.rb
|
231
|
+
has_rdoc:
|