slack-ruby-bot 0.11.2 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5ce2b630c8c8febedc5e967ff7fddeaa50cea17b881fb73fa2a7bf58e486005c
4
- data.tar.gz: 7eb5553808ed92fbcb256e35f2d7fb85b5943841a5205fb3b05b73f271f18817
3
+ metadata.gz: 22dc3beb892b34e2ac402dda4e3406b06ad7b60d25c6db1098517934f599a000
4
+ data.tar.gz: 8d089bd14bf6a096a89711627f459504bc3ba6a1dc04d1c45eff4c40476cf8ab
5
5
  SHA512:
6
- metadata.gz: 3b6b488d4b4b2aa1911429abac4d591a977926c715580d534d8b21ebc88f9c3babad8dcbf5e9a773e123abaa882e2a98267aa8befefe9d8f11dc396c307246c0
7
- data.tar.gz: 12859a82a5f268068b630efe1535c18206d2cee981839110aa6113e05fabf02f5024a0d3ca297972f4de81de7403d3b77f26af6e5f6f08c58fbea2e65ea4e111
6
+ metadata.gz: ff99ab182faab024601afe41a40fa8b66c589aeaf66d02819ad05196200e4ef3d6cd7e5fae6c670630f3b7225d96fc33d0031e370852b3ba6bdd33acfc182a22
7
+ data.tar.gz: dd313bbae823189799d92888222f9433a6cba629aba7ac7e922dfd7154317c3332ad1ff1246a6537ec2000626826866bb4ebcf2fb857aac614609cedcd6ba0b2
@@ -1,14 +1,18 @@
1
- ### 0.11.2 (2018/12/01)
1
+ ### 0.12.0 (2019/2/25)
2
+
3
+ * [#203](https://github.com/slack-ruby/slack-ruby-bot/pull/203): Removing restart logic - [@RodneyU215](https://github.com/RodneyU215).
4
+
5
+ ### 0.11.2 (2018/12/1)
2
6
 
3
7
  * [#198](https://github.com/slack-ruby/slack-ruby-bot/pull/198): Recommend using `async-websocket` instead of `celluloid-io` - [@dblock](https://github.com/dblock).
4
8
  * [#202](https://github.com/slack-ruby/slack-ruby-bot/pull/202): Allow frozen string in Hooks::Message - [@jonosenior](https://github.com/jonosenior).
5
9
 
6
- ### 0.11.1 (2018/05/06)
10
+ ### 0.11.1 (2018/5/6)
7
11
 
8
12
  * [#187](https://github.com/slack-ruby/slack-ruby-bot/pull/187): Added support for the [official Giphy SDK](https://github.com/Giphy/giphy-ruby-client) - [@dblock](https://github.com/dblock).
9
13
  * [#185](https://github.com/slack-ruby/slack-ruby-bot/pull/185): Log backtrace of exceptions - [@dblock](https://github.com/dblock).
10
14
 
11
- ### 0.11.0 (2018/04/02)
15
+ ### 0.11.0 (2018/4/2)
12
16
 
13
17
  * [#182](https://github.com/slack-ruby/slack-ruby-bot/pull/182): Refactor CommandsHelper class and Help module - [@mdudzinski](https://github.com/mdudzinski).
14
18
  * [#180](https://github.com/slack-ruby/slack-ruby-bot/pull/180): Allow to respond to text in attachments #177 - [@mdudzinski](https://github.com/mdudzinski).
@@ -24,18 +28,18 @@
24
28
  * [#163](https://github.com/slack-ruby/slack-ruby-bot/pull/163): Allow `command` to accept regular expressions - [@kstole](https://github.com/kstole).
25
29
  * [#166](https://github.com/slack-ruby/slack-ruby-bot/pull/166): Allow special characters and capitals in bot aliases - [@kstole](https://github.com/kstole).
26
30
 
27
- ### 0.10.4 (2017/07/05)
31
+ ### 0.10.4 (2017/7/5)
28
32
 
29
33
  * [#149](https://github.com/slack-ruby/slack-ruby-bot/pull/149): Add `logger` configuration to set a custom logger - [@upscent](https://github.com/upscent).
30
34
  * [#147](https://github.com/slack-ruby/slack-ruby-bot/pull/147): Adds `server.on` as a shortcut for `hooks.add` and deprecate `hooks` method - [@laertispappas](https://github.com/laertispappas).
31
35
  * [#143](https://github.com/slack-ruby/slack-ruby-bot/pull/143): Provide `permitted?` method to allow for simple authorization extensions - [@chuckremes](https://github.com/chuckremes).
32
36
 
33
- ### 0.10.3 (2017/06/15)
37
+ ### 0.10.3 (2017/6/15)
34
38
 
35
39
  * [#145](https://github.com/slack-ruby/slack-ruby-bot/pull/145): Map multiple command strings to same controller method - [@chuckremes](https://github.com/chuckremes).
36
40
  * [#144](https://github.com/slack-ruby/slack-ruby-bot/pull/144): Support usage of commands with embedded spaces when using Controller methods - [@chuckremes](https://github.com/chuckremes).
37
41
 
38
- ### 0.10.2 (2017/06/03)
42
+ ### 0.10.2 (2017/6/3)
39
43
 
40
44
  * [#137](https://github.com/slack-ruby/slack-ruby-bot/pull/137): Add Model-View-Controller classes to allow for more explicit control over how `command`s are designed - [@chuckremes](https://github.com/chuckremes).
41
45
  * [#130](https://github.com/slack-ruby/slack-ruby-bot/issues/130): Added test dependencies in TUTORIAL.md - [@jbristow](https://github.com/jbristow).
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, v0.11.2.
22
+ You're reading the documentation for the **stable** release of slack-ruby-bot, v0.12.0.
23
23
  See [CHANGELOG](CHANGELOG.md) for a history of changes and [UPGRADING](UPGRADING.md) for how to upgrade to more recent versions.
24
24
 
25
25
  ## Usage
@@ -32,7 +32,7 @@ See [CHANGELOG](CHANGELOG.md) for a history of changes and [UPGRADING](UPGRADING
32
32
  source 'https://rubygems.org'
33
33
 
34
34
  gem 'slack-ruby-bot'
35
- gem 'celluloid-io'
35
+ gem 'async-websocket'
36
36
  ```
37
37
 
38
38
  #### pongbot.rb
@@ -83,7 +83,7 @@ end
83
83
 
84
84
  Command match data includes `match['bot']`, `match['command']` and `match['expression']`. The `bot` match always checks against the `SlackRubyBot::Config.user` and `SlackRubyBot::Config.user_id` values obtained when the bot starts.
85
85
 
86
- The `command` method can take strings, which will have be escaped with `Regexp.escape`, and regular expressions.
86
+ The `command` method can take strings, which will have to be escaped with `Regexp.escape`, and regular expressions.
87
87
 
88
88
  ```ruby
89
89
  class CallBot < SlackRubyBot::Bot
@@ -145,7 +145,7 @@ This is particularly fun with emoji.
145
145
 
146
146
  ![](screenshots/aliases.gif)
147
147
 
148
- Bots also will respond to a direct message, with or without the bot name in the message itself.
148
+ Bots will also respond to a direct message, with or without the bot name in the message itself.
149
149
 
150
150
  ![](screenshots/dms.gif)
151
151
 
@@ -1,6 +1,12 @@
1
1
  Upgrading SlackRubyBot
2
2
  ======================
3
3
 
4
+ ### Upgrading to >= 0.12.0
5
+
6
+ #### Remove any references to `SlackRubyBot::Server#restart!`
7
+
8
+ We have removed `SlackRubyBot::Server#restart!` since the [`slack-ruby-client`](https://github.com/slack-ruby/slack-ruby-client/blob/master/CHANGELOG.md) now restarts any connection that was not intentionally stopped via `SlackRubyBot::Server#stop!`.
9
+
4
10
  ### Upgrading to >= 0.10.4
5
11
 
6
12
  #### Replace `server.hooks.add` with `server.on`
@@ -32,37 +32,17 @@ module SlackRubyBot
32
32
  end
33
33
 
34
34
  def start!
35
- @stopping = false
36
- @async = false
37
35
  client.start!
38
36
  end
39
37
 
40
38
  def start_async
41
- @stopping = false
42
- @async = true
43
39
  client.start_async
44
40
  end
45
41
 
46
42
  def stop!
47
- @stopping = true
48
43
  client.stop! if @client
49
44
  end
50
45
 
51
- def restart!(wait = 1)
52
- @async ? start_async : start!
53
- rescue StandardError => e
54
- case e.message
55
- when 'account_inactive', 'invalid_auth'
56
- logger.error "#{token}: #{e.message}, team will be deactivated."
57
- @stopping = true
58
- else
59
- sleep wait
60
- logger.error "#{e.message}, reconnecting in #{wait} second(s)."
61
- logger.debug e
62
- restart! [wait * 2, 60].min
63
- end
64
- end
65
-
66
46
  private
67
47
 
68
48
  def handle_exceptions
@@ -98,10 +78,6 @@ module SlackRubyBot
98
78
  def client
99
79
  @client ||= begin
100
80
  client = SlackRubyBot::Client.new(aliases: aliases, send_gifs: send_gifs, token: token)
101
- client.on :close do |_data|
102
- @client = nil
103
- restart! unless @stopping
104
- end
105
81
  _hooks.client = client
106
82
 
107
83
  client
@@ -1,3 +1,3 @@
1
1
  module SlackRubyBot
2
- VERSION = '0.11.2'.freeze
2
+ VERSION = '0.12.0'.freeze
3
3
  end
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
15
15
  s.licenses = ['MIT']
16
16
  s.summary = 'The easiest way to write a Slack bot in Ruby.'
17
17
  s.add_dependency 'hashie'
18
- s.add_dependency 'slack-ruby-client', '>= 0.6.0'
18
+ s.add_dependency 'slack-ruby-client', '>= 0.14.0'
19
19
  s.add_development_dependency 'rack-test'
20
20
  s.add_development_dependency 'rake'
21
21
  s.add_development_dependency 'rspec'
@@ -94,21 +94,4 @@ describe SlackRubyBot::Server do
94
94
  end
95
95
  end
96
96
  end
97
- context '#restart!' do
98
- subject do
99
- SlackRubyBot::Server.new(token: 'token')
100
- end
101
- it 'reloads server after disconnection' do
102
- expect(subject).to receive(:restart!)
103
- subject.send(:client).send(:callbacks)['close'].first.call
104
- expect(subject.instance_variable_get(:@stopping)).to be_falsy
105
- end
106
- it 'does not reload server for inactive account' do
107
- stopping = -> { subject.instance_variable_get :@stopping }
108
- allow(subject).to receive(:start!) { raise StandardError, 'account_inactive' }
109
- expect(stopping.call).to be_falsy
110
- subject.restart!
111
- expect(stopping.call).to be true
112
- end
113
- end
114
97
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slack-ruby-bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.2
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Doubrovkine
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-01 00:00:00.000000000 Z
11
+ date: 2019-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 0.6.0
33
+ version: 0.14.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 0.6.0
40
+ version: 0.14.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rack-test
43
43
  requirement: !ruby/object:Gem::Requirement