slack-ruby-bot 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/README.md +1 -1
- data/lib/slack-ruby-bot/support/loggable.rb +13 -11
- data/lib/slack-ruby-bot/version.rb +1 -1
- data/spec/slack-ruby-bot/support/loggable_spec.rb +18 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1348b71125e07ba882c91f785c185b39fd6f169
|
4
|
+
data.tar.gz: be83b12cf72deed88f2b7a85bf4cb68dcb6bf6fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce40f511fb328ea0574b6189ad8dcef5de8401ac79a7c1bee9fb0c06d1bfcf0ccb6744e9fe71c29b302973ac8af713628229cf1a85aea41ae2ec910b185b37da
|
7
|
+
data.tar.gz: 89df71def40ed033436c1703cd15ac08e6f2999f4187c4996101ae022651a6c52a8e60e78466ce4551b357e6f5b53fe95e50b08d650be73677fd744ade9125ce
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,8 @@
|
|
1
|
-
### 0.8.
|
1
|
+
### 0.8.2 (7/10/2016)
|
2
|
+
|
3
|
+
* [#85](https://github.com/dblock/slack-ruby-bot/issues/85): Fix: regression in bot instance logging - [@dblock](https://github.com/dblock).
|
4
|
+
|
5
|
+
### 0.8.1 (7/10/2016)
|
2
6
|
|
3
7
|
* [#69](https://github.com/dblock/slack-ruby-bot/pull/69): Ability to add help info to bot and commands - [@accessd](https://github.com/accessd).
|
4
8
|
* [#75](https://github.com/dblock/slack-ruby-bot/issues/75): Guarantee order of command evaluation - [@dblock](https://github.com/dblock).
|
data/README.md
CHANGED
@@ -19,7 +19,7 @@ If you are not familiar with Slack bots or Slack API concepts, you might want to
|
|
19
19
|
|
20
20
|
## Stable Release
|
21
21
|
|
22
|
-
You're reading the documentation for the **stable** release of slack-ruby-bot
|
22
|
+
You're reading the documentation for the **stable** release of slack-ruby-bot. See [CHANGELOG](CHANGELOG.md) for a history of changes and [UPGRADING](UPGRADING.md) for how to upgrade to more recent versions.
|
23
23
|
|
24
24
|
## Usage
|
25
25
|
|
@@ -1,21 +1,23 @@
|
|
1
1
|
module SlackRubyBot
|
2
2
|
module Loggable
|
3
3
|
def self.included(base)
|
4
|
-
base.send :include,
|
5
|
-
base.extend(
|
4
|
+
base.send :include, InstanceMethods
|
5
|
+
base.extend(ClassMethods)
|
6
6
|
end
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
module ClassMethods
|
9
|
+
def logger
|
10
|
+
@logger ||= begin
|
11
|
+
$stdout.sync = true
|
12
|
+
Logger.new(STDOUT)
|
13
|
+
end
|
14
|
+
end
|
13
15
|
end
|
14
|
-
end
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
17
|
+
module InstanceMethods
|
18
|
+
def logger
|
19
|
+
self.class.logger
|
20
|
+
end
|
19
21
|
end
|
20
22
|
end
|
21
23
|
end
|
@@ -8,15 +8,28 @@ describe SlackRubyBot::Loggable do
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
end
|
11
|
+
let! :child_class_with_logger do
|
12
|
+
Class.new(class_with_logger) do
|
13
|
+
def public_logger
|
14
|
+
logger
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
11
18
|
describe 'logger for class' do
|
12
19
|
it do
|
13
20
|
expect(class_with_logger.logger).to be_kind_of Logger
|
21
|
+
expect(child_class_with_logger.logger).to be_kind_of Logger
|
14
22
|
end
|
15
23
|
it 'should be cached' do
|
16
24
|
first_logger = class_with_logger.logger
|
17
25
|
second_logger = class_with_logger.logger
|
18
26
|
expect(first_logger.object_id).to eq second_logger.object_id
|
19
27
|
end
|
28
|
+
it 'should not be shared by a child class' do
|
29
|
+
first_logger = class_with_logger.logger
|
30
|
+
second_logger = child_class_with_logger.logger
|
31
|
+
expect(first_logger.object_id).to_not eq second_logger.object_id
|
32
|
+
end
|
20
33
|
end
|
21
34
|
describe 'logger for instance' do
|
22
35
|
it do
|
@@ -27,5 +40,10 @@ describe SlackRubyBot::Loggable do
|
|
27
40
|
second_logger = class_with_logger.new.public_logger
|
28
41
|
expect(first_logger.object_id).to eq second_logger.object_id
|
29
42
|
end
|
43
|
+
it 'should not be shared by a child class' do
|
44
|
+
first_logger = class_with_logger.new.public_logger
|
45
|
+
second_logger = child_class_with_logger.new.public_logger
|
46
|
+
expect(first_logger.object_id).to_not eq second_logger.object_id
|
47
|
+
end
|
30
48
|
end
|
31
49
|
end
|