ruboty 1.2.2 → 1.2.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6a05184c782758a07fe769a07976396f6833dcac
4
- data.tar.gz: 1db530f4c88ff64f43281fccbceeaad570ea0141
3
+ metadata.gz: 985c3008104c6e170325097857be489a8128f97b
4
+ data.tar.gz: aad5cc9b0fba7c702b5059aa994b0878abed94c1
5
5
  SHA512:
6
- metadata.gz: b16a9cd78ee34c4470d0096f0c5da0c9c9fa31726ad97f2f95ef3be77b2ab0d058651e630ce2ed4fef4de7090a0b22f7b32865af97517ca096bdac46cae94df5
7
- data.tar.gz: f323757c6de220447f430148524ed68dfdc9dd387b9078c1ccec85346562f9971c2440daa1da1119e0ab9aae572651b4656dc21253f1f3c90264ad642e0c9716
6
+ metadata.gz: 07696686fdaab75c885b4136d03370b1a2c16e1fe4273213e96ed87fbd3f93952e657d3875bbc475568fd37e24f56a71ee9cd5b4efe996a3854bbad1e9a46852
7
+ data.tar.gz: f6783b8b5fd0d864a8328ee619b98545ee44b065ead9238072d9fe85cdbc33def02bac1f7e32b82c2da357f38d731e56614f1c58d1bcc3421d54c4f6544c2d8d
@@ -1,3 +1,6 @@
1
+ ## 1.2.3
2
+ - User default Logger class (thx @eagletmt)
3
+
1
4
  ## 1.2.2
2
5
  - Support ^D on shell adapter (thx @suu-g)
3
6
 
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)
@@ -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 = Ruboty::Logger.new($stdout)
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"
@@ -28,7 +28,7 @@ module Ruboty
28
28
  private
29
29
 
30
30
  def explain
31
- Ruboty.logger.info(USAGE)
31
+ puts USAGE
32
32
  end
33
33
 
34
34
  def read
@@ -1,3 +1,3 @@
1
1
  module Ruboty
2
- VERSION = "1.2.2"
2
+ VERSION = "1.2.3"
3
3
  end
@@ -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", "2.14.1"
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.should be_a Ruboty::Adapters::Shell
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.should be_a another_adapter_class
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.stub(:info)
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.stub(readline: "exit")
20
- adapter.should_receive(:stop).and_call_original
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.stub(readline: "quit")
28
- adapter.should_receive(:stop).and_call_original
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.stub(readline: nil)
36
- adapter.should_receive(:stop).and_call_original
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.stub(:readline).and_raise(Interrupt)
44
- adapter.should_receive(:stop).and_call_original
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.stub(:readline).and_return("a", "exit")
52
- robot.should_receive(:receive).with(body: "a", source: described_class::SOURCE)
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.exist?("./ruboty/").should == true
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.should_receive(:error).with("Error: ./ruboty/ already exists.")
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
@@ -15,7 +15,7 @@ describe Ruboty::Commands::Run do
15
15
  end
16
16
 
17
17
  it "creates an adapter and calls .run to it" do
18
- Ruboty::Adapters::Shell.any_instance.should_receive(:run)
18
+ expect_any_instance_of(Ruboty::Adapters::Shell).to receive(:run)
19
19
  call
20
20
  end
21
21
  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.should_receive(:error).with(/description of A/)
43
- Ruboty.should_receive(:exit)
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
@@ -21,7 +21,7 @@ describe Ruboty::Handlers::Base do
21
21
 
22
22
  describe ".on" do
23
23
  it "registers an action to the handler" do
24
- robot.should_receive(:say).with(2)
24
+ expect(robot).to receive(:say).with(2)
25
25
  robot.receive(body: "1 + 1")
26
26
  end
27
27
  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.should_receive(:say).with(
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.should_receive(:say).with(
45
+ expect(robot).to receive(:say).with(
46
46
  hash_including(
47
47
  body: "ruboty /ping\\z/i - Return PONG to PING",
48
48
  ),
@@ -23,7 +23,7 @@ describe Ruboty::Handlers::Ping do
23
23
  end
24
24
 
25
25
  it "returns PONG to PING" do
26
- robot.should_receive(:say).with(
26
+ expect(robot).to receive(:say).with(
27
27
  body: replied,
28
28
  from: to,
29
29
  to: from,
@@ -19,7 +19,7 @@ describe Ruboty::Handlers::Whoami do
19
19
  end
20
20
 
21
21
  it "returns PONG to PING" do
22
- robot.should_receive(:say).with(
22
+ expect(robot).to receive(:say).with(
23
23
  body: from,
24
24
  from: to,
25
25
  to: from,
@@ -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.should be_a Ruboty::Brains::Memory
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"].should == 1
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.should be_a another_brain_class
34
+ expect(instance.brain).to be_a another_brain_class
35
35
  end
36
36
  end
37
37
  end
@@ -10,7 +10,6 @@ require "active_support/core_ext/string/strip"
10
10
  require "ruboty"
11
11
 
12
12
  RSpec.configure do |config|
13
- config.treat_symbols_as_metadata_keys_with_true_values = true
14
13
  config.run_all_when_everything_filtered = true
15
14
  config.filter_run :focus
16
15
  end
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.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: 2015-04-09 00:00:00.000000000 Z
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: 2.14.1
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: 2.14.1
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:
@@ -1,10 +0,0 @@
1
- require "logger"
2
-
3
- module Ruboty
4
- class Logger < Logger
5
- def initialize(*)
6
- super
7
- @formatter = ->(severity, time, name, message) { "#{message}\n" }
8
- end
9
- end
10
- end