Skip to content

Commit 3afcaa8

Browse files
authored
Merge pull request #22 from slack-ruby/events-api
Migrate app to granular scopes and events API.
2 parents 7d2517d + d28edfd commit 3afcaa8

File tree

95 files changed

+394
-1171
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+394
-1171
lines changed

.rubocop_todo.yml

Lines changed: 19 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,60 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2020-11-15 22:07:57 UTC using RuboCop version 1.3.0.
3+
# on 2020-11-22 17:19:23 UTC using RuboCop version 1.3.1.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
77
# versions of RuboCop, may require this file to be generated again.
88

9-
# Offense count: 1
9+
# Offense count: 2
1010
# Cop supports --auto-correct.
1111
# Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include.
1212
# Include: **/*.gemfile, **/Gemfile, **/gems.rb
1313
Bundler/OrderedGems:
1414
Exclude:
1515
- 'Gemfile'
1616

17-
# Offense count: 2
18-
# Cop supports --auto-correct.
19-
# Configuration parameters: AllowAliasSyntax, AllowedMethods.
20-
# AllowedMethods: alias_method, public, protected, private
21-
Layout/EmptyLinesAroundAttributeAccessor:
17+
# Offense count: 1
18+
Lint/MissingSuper:
2219
Exclude:
23-
- 'slack-shellbot/models/current_directory_entry.rb'
24-
- 'slack-shellbot/models/parent_directory_entry.rb'
20+
- 'lib/commands/base.rb'
2521

2622
# Offense count: 8
2723
Lint/MixedRegexpCaptureTypes:
2824
Exclude:
29-
- 'slack-shellbot/commands/cat.rb'
30-
- 'slack-shellbot/commands/cd.rb'
31-
- 'slack-shellbot/commands/echo.rb'
32-
- 'slack-shellbot/commands/mkdir.rb'
33-
- 'slack-shellbot/commands/rm.rb'
34-
- 'slack-shellbot/commands/rmdir.rb'
35-
- 'slack-shellbot/commands/touch.rb'
36-
- 'slack-shellbot/commands/vi.rb'
25+
- 'lib/commands/cat.rb'
26+
- 'lib/commands/cd.rb'
27+
- 'lib/commands/echo.rb'
28+
- 'lib/commands/mkdir.rb'
29+
- 'lib/commands/rm.rb'
30+
- 'lib/commands/rmdir.rb'
31+
- 'lib/commands/touch.rb'
32+
- 'lib/commands/vi.rb'
3733

3834
# Offense count: 2
3935
# Cop supports --auto-correct.
4036
Lint/NonDeterministicRequireOrder:
4137
Exclude:
42-
- 'slack-shellbot.rb'
38+
- 'app.rb'
4339
- 'spec/spec_helper.rb'
4440

4541
# Offense count: 1
4642
# Configuration parameters: AllowComments.
4743
Lint/SuppressedException:
4844
Exclude:
49-
- 'slack-shellbot/models/vi_program.rb'
50-
51-
# Offense count: 1
52-
# Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, Regex, IgnoreExecutableScripts, AllowedAcronyms.
53-
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
54-
Naming/FileName:
55-
Exclude:
56-
- 'slack-shellbot.rb'
45+
- 'lib/models/vi_program.rb'
5746

5847
# Offense count: 2
5948
# Configuration parameters: ForbiddenDelimiters.
6049
# ForbiddenDelimiters: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$))
6150
Naming/HeredocDelimiterNaming:
6251
Exclude:
63-
- 'slack-shellbot/commands/help.rb'
64-
- 'slack-shellbot/info.rb'
52+
- 'lib/commands/help.rb'
53+
- 'lib/info.rb'
6554

66-
# Offense count: 19
55+
# Offense count: 17
6756
# Cop supports --auto-correct.
6857
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
6958
# URISchemes: http, https
7059
Layout/LineLength:
71-
Max: 163
60+
Max: 150

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
### Changelog
22

3+
* 2020/11/22. [#22](https://github.com/slack-ruby/slack-shellbot/pull/22): Migrate app to granular scopes and events API - [@dblock](https://github.com/dblock).
34
* 2018/9/10, [#6](https://github.com/slack-ruby/slack-shellbot/issues/6): Fix `Unmatched double quote` errors - [@dblock](https://github.com/dblock).
45
* 2016/3/2, [#5](https://github.com/slack-ruby/slack-shellbot/issues/5): `:q` will quit `vi` without saving the file - [@dblock](https://github.com/dblock).
56
* 2016/3/2, [#4](https://github.com/slack-ruby/slack-shellbot/issues/4): Edit messages in-place with `vi` - [@dblock](https://github.com/dblock).

DEPLOYMENT.md

Lines changed: 0 additions & 25 deletions
This file was deleted.

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ gem 'rack-robotz'
1313
gem 'rack-server-pages'
1414
gem 'slack-ruby-bot-server'
1515
gem 'slack-ruby-bot-server-mailchimp'
16-
gem 'slack-ruby-bot-server-rtm'
16+
gem 'slack-ruby-bot-server-events'
1717
gem 'unicorn'
1818

1919
group :development, :test do

Gemfile.lock

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@ GEM
1616
console (~> 1.10)
1717
nio4r (~> 2.3)
1818
timers (~> 4.1)
19-
async-io (1.30.1)
20-
async (~> 1.14)
21-
async-websocket (0.8.0)
22-
async-io
23-
websocket-driver (~> 0.7.0)
2419
bson (4.11.1)
2520
builder (3.2.4)
2621
capybara (3.33.0)
@@ -49,7 +44,7 @@ GEM
4944
dry-container (0.7.2)
5045
concurrent-ruby (~> 1.0)
5146
dry-configurable (~> 0.1, >= 0.1.3)
52-
dry-core (0.4.9)
47+
dry-core (0.4.10)
5348
concurrent-ruby (~> 1.0)
5449
dry-equalizer (0.3.0)
5550
dry-inflector (0.2.0)
@@ -160,7 +155,7 @@ GEM
160155
newrelic-slack-ruby-bot (0.2.2)
161156
newrelic_rpm
162157
slack-ruby-bot (>= 0.10.5)
163-
newrelic_rpm (6.13.1)
158+
newrelic_rpm (6.14.0)
164159
nio4r (2.5.4)
165160
nokogiri (1.10.10)
166161
mini_portile2 (~> 2.4.0)
@@ -185,7 +180,7 @@ GEM
185180
raindrops (0.19.1)
186181
rake (13.0.1)
187182
regexp_parser (1.8.2)
188-
reline (0.1.8)
183+
reline (0.1.9)
189184
io-console (~> 0.5)
190185
representable (3.0.4)
191186
declarative (< 0.1.0)
@@ -212,7 +207,7 @@ GEM
212207
diff-lcs (>= 1.2.0, < 2.0)
213208
rspec-support (~> 3.10.0)
214209
rspec-support (3.10.0)
215-
rubocop (1.3.0)
210+
rubocop (1.3.1)
216211
parallel (~> 1.10)
217212
parser (>= 2.7.1.5)
218213
rainbow (>= 2.2.2, < 4.0)
@@ -232,7 +227,7 @@ GEM
232227
slack-ruby-bot (0.16.0)
233228
hashie
234229
slack-ruby-client (>= 0.14.0)
235-
slack-ruby-bot-server (1.0.0)
230+
slack-ruby-bot-server (1.1.0)
236231
async
237232
foreman
238233
grape
@@ -243,13 +238,11 @@ GEM
243238
rack-rewrite
244239
rack-server-pages
245240
slack-ruby-client
241+
slack-ruby-bot-server-events (0.2.0)
242+
slack-ruby-bot-server (>= 0.12.0)
246243
slack-ruby-bot-server-mailchimp (0.2.0)
247244
mailchimp_api_v3
248245
slack-ruby-bot-server (>= 0.10.0)
249-
slack-ruby-bot-server-rtm (0.1.1)
250-
async-websocket (~> 0.8.0)
251-
slack-ruby-bot (>= 0.12.0)
252-
slack-ruby-bot-server (>= 1.0.0)
253246
slack-ruby-client (0.14.6)
254247
activesupport
255248
faraday (>= 0.9)
@@ -307,8 +300,8 @@ DEPENDENCIES
307300
rubocop
308301
selenium-webdriver
309302
slack-ruby-bot-server
303+
slack-ruby-bot-server-events
310304
slack-ruby-bot-server-mailchimp
311-
slack-ruby-bot-server-rtm
312305
unicorn
313306
vcr
314307
webmock

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2016-2017 Daniel Doubrovkine, Artsy and Contributors
3+
Copyright (c) 2016-2020 Daniel Doubrovkine, Artsy and Contributors
44

55
Permission is hereby granted, free of charge, to any person obtaining
66
a copy of this software and associated documentation files (the

README.md

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,19 @@ Slack-Shellbot
22
=============
33

44
[![Add to Slack](https://platform.slack-edge.com/img/[email protected])](http://shell.playplay.io)
5-
6-
Or roll your own ...
7-
85
[![Build Status](https://travis-ci.org/slack-ruby/slack-shellbot.svg)](https://travis-ci.org/slack-ruby/slack-shellbot)
96
[![Code Climate](https://codeclimate.com/github/slack-ruby/slack-shellbot/badges/gpa.svg)](https://codeclimate.com/github/slack-ruby/slack-shellbot)
107

118
A shell bot for Slack. A demo is worth a thousand words.
129

1310
![](public/img/vi.gif)
1411

15-
## Installation
16-
17-
Create a new Bot Integration under [services/new/bot](http://slack.com/services/new/bot). Note the API token.
18-
You will be able to invoke shellbot by the name you give it in the UI above.
19-
20-
Run `SLACK_API_TOKEN=<your API token> foreman start`
21-
22-
## Production Deployment
23-
24-
See [DEPLOYMENT](DEPLOYMENT.md)
25-
2612
## Contributing
2713

28-
This bot is built with [slack-ruby-bot](https://github.com/dblock/slack-ruby-bot). See [CONTRIBUTING](CONTRIBUTING.md).
14+
This bot is built with [slack-ruby-bot-server-events](https://github.com/slack-ruby/slack-ruby-bot-server-events). See [CONTRIBUTING](CONTRIBUTING.md).
2915

3016
## Copyright and License
3117

32-
Copyright (c) 2016-2017, Daniel Doubrovkine, Artsy and [Contributors](CHANGELOG.md).
18+
Copyright (c) 2016-2020, Daniel Doubrovkine, Artsy and [Contributors](CHANGELOG.md).
3319

3420
This project is licensed under the [MIT License](LICENSE.md).

app.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

slack-shellbot.rb renamed to app.rb

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,7 @@
99

1010
Mongoid.load! File.expand_path('../config/mongoid.yml', __FILE__), ENV['RACK_ENV']
1111

12-
require 'slack-shellbot/error'
13-
require 'slack-shellbot/version'
14-
require 'slack-shellbot/info'
15-
require 'slack-shellbot/models'
16-
require 'slack-shellbot/api'
17-
require 'slack-shellbot/app'
18-
require 'slack-shellbot/server'
19-
require 'slack-shellbot/commands'
12+
require_relative 'lib/version'
13+
require_relative 'lib/info'
14+
require_relative 'lib/models'
15+
require_relative 'lib/commands'

config.ru

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,10 @@
1-
$LOAD_PATH.unshift(File.dirname(__FILE__))
1+
# frozen_string_literal: true
22

3-
ENV['RACK_ENV'] ||= 'development'
3+
require_relative 'app'
44

5-
require 'bundler/setup'
6-
Bundler.require :default, ENV['RACK_ENV']
5+
NewRelic::Agent.manual_start
76

8-
require 'slack-ruby-bot-server'
9-
require 'slack-shellbot'
7+
SlackRubyBotServer::App.instance.prepare!
8+
SlackRubyBotServer::Service.start!
109

11-
SlackShellbot::App.instance.prepare!
12-
13-
Thread.abort_on_exception = true
14-
15-
Thread.new do
16-
SlackRubyBotServer::Service.instance.start_from_database!
17-
end
18-
19-
run Api::Middleware.instance
10+
run SlackRubyBotServer::Api::Middleware.instance

0 commit comments

Comments
 (0)