Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate app to granular scopes and events API. #22

Merged
merged 1 commit into from
Nov 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 19 additions & 30 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,71 +1,60 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2020-11-15 22:07:57 UTC using RuboCop version 1.3.0.
# on 2020-11-22 17:19:23 UTC using RuboCop version 1.3.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 1
# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include.
# Include: **/*.gemfile, **/Gemfile, **/gems.rb
Bundler/OrderedGems:
Exclude:
- 'Gemfile'

# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: AllowAliasSyntax, AllowedMethods.
# AllowedMethods: alias_method, public, protected, private
Layout/EmptyLinesAroundAttributeAccessor:
# Offense count: 1
Lint/MissingSuper:
Exclude:
- 'slack-shellbot/models/current_directory_entry.rb'
- 'slack-shellbot/models/parent_directory_entry.rb'
- 'lib/commands/base.rb'

# Offense count: 8
Lint/MixedRegexpCaptureTypes:
Exclude:
- 'slack-shellbot/commands/cat.rb'
- 'slack-shellbot/commands/cd.rb'
- 'slack-shellbot/commands/echo.rb'
- 'slack-shellbot/commands/mkdir.rb'
- 'slack-shellbot/commands/rm.rb'
- 'slack-shellbot/commands/rmdir.rb'
- 'slack-shellbot/commands/touch.rb'
- 'slack-shellbot/commands/vi.rb'
- 'lib/commands/cat.rb'
- 'lib/commands/cd.rb'
- 'lib/commands/echo.rb'
- 'lib/commands/mkdir.rb'
- 'lib/commands/rm.rb'
- 'lib/commands/rmdir.rb'
- 'lib/commands/touch.rb'
- 'lib/commands/vi.rb'

# Offense count: 2
# Cop supports --auto-correct.
Lint/NonDeterministicRequireOrder:
Exclude:
- 'slack-shellbot.rb'
- 'app.rb'
- 'spec/spec_helper.rb'

# Offense count: 1
# Configuration parameters: AllowComments.
Lint/SuppressedException:
Exclude:
- 'slack-shellbot/models/vi_program.rb'

# Offense count: 1
# Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, Regex, IgnoreExecutableScripts, AllowedAcronyms.
# 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
Naming/FileName:
Exclude:
- 'slack-shellbot.rb'
- 'lib/models/vi_program.rb'

# Offense count: 2
# Configuration parameters: ForbiddenDelimiters.
# ForbiddenDelimiters: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$))
Naming/HeredocDelimiterNaming:
Exclude:
- 'slack-shellbot/commands/help.rb'
- 'slack-shellbot/info.rb'
- 'lib/commands/help.rb'
- 'lib/info.rb'

# Offense count: 19
# Offense count: 17
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Layout/LineLength:
Max: 163
Max: 150
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### Changelog

* 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).
* 2018/9/10, [#6](https://github.com/slack-ruby/slack-shellbot/issues/6): Fix `Unmatched double quote` errors - [@dblock](https://github.com/dblock).
* 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).
* 2016/3/2, [#4](https://github.com/slack-ruby/slack-shellbot/issues/4): Edit messages in-place with `vi` - [@dblock](https://github.com/dblock).
Expand Down
25 changes: 0 additions & 25 deletions DEPLOYMENT.md

This file was deleted.

2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ gem 'rack-robotz'
gem 'rack-server-pages'
gem 'slack-ruby-bot-server'
gem 'slack-ruby-bot-server-mailchimp'
gem 'slack-ruby-bot-server-rtm'
gem 'slack-ruby-bot-server-events'
gem 'unicorn'

group :development, :test do
Expand Down
23 changes: 8 additions & 15 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ GEM
console (~> 1.10)
nio4r (~> 2.3)
timers (~> 4.1)
async-io (1.30.1)
async (~> 1.14)
async-websocket (0.8.0)
async-io
websocket-driver (~> 0.7.0)
bson (4.11.1)
builder (3.2.4)
capybara (3.33.0)
Expand Down Expand Up @@ -49,7 +44,7 @@ GEM
dry-container (0.7.2)
concurrent-ruby (~> 1.0)
dry-configurable (~> 0.1, >= 0.1.3)
dry-core (0.4.9)
dry-core (0.4.10)
concurrent-ruby (~> 1.0)
dry-equalizer (0.3.0)
dry-inflector (0.2.0)
Expand Down Expand Up @@ -160,7 +155,7 @@ GEM
newrelic-slack-ruby-bot (0.2.2)
newrelic_rpm
slack-ruby-bot (>= 0.10.5)
newrelic_rpm (6.13.1)
newrelic_rpm (6.14.0)
nio4r (2.5.4)
nokogiri (1.10.10)
mini_portile2 (~> 2.4.0)
Expand All @@ -185,7 +180,7 @@ GEM
raindrops (0.19.1)
rake (13.0.1)
regexp_parser (1.8.2)
reline (0.1.8)
reline (0.1.9)
io-console (~> 0.5)
representable (3.0.4)
declarative (< 0.1.0)
Expand All @@ -212,7 +207,7 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-support (3.10.0)
rubocop (1.3.0)
rubocop (1.3.1)
parallel (~> 1.10)
parser (>= 2.7.1.5)
rainbow (>= 2.2.2, < 4.0)
Expand All @@ -232,7 +227,7 @@ GEM
slack-ruby-bot (0.16.0)
hashie
slack-ruby-client (>= 0.14.0)
slack-ruby-bot-server (1.0.0)
slack-ruby-bot-server (1.1.0)
async
foreman
grape
Expand All @@ -243,13 +238,11 @@ GEM
rack-rewrite
rack-server-pages
slack-ruby-client
slack-ruby-bot-server-events (0.2.0)
slack-ruby-bot-server (>= 0.12.0)
slack-ruby-bot-server-mailchimp (0.2.0)
mailchimp_api_v3
slack-ruby-bot-server (>= 0.10.0)
slack-ruby-bot-server-rtm (0.1.1)
async-websocket (~> 0.8.0)
slack-ruby-bot (>= 0.12.0)
slack-ruby-bot-server (>= 1.0.0)
slack-ruby-client (0.14.6)
activesupport
faraday (>= 0.9)
Expand Down Expand Up @@ -307,8 +300,8 @@ DEPENDENCIES
rubocop
selenium-webdriver
slack-ruby-bot-server
slack-ruby-bot-server-events
slack-ruby-bot-server-mailchimp
slack-ruby-bot-server-rtm
unicorn
vcr
webmock
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

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

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
18 changes: 2 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,19 @@ Slack-Shellbot
=============

[![Add to Slack](https://platform.slack-edge.com/img/[email protected])](http://shell.playplay.io)

Or roll your own ...

[![Build Status](https://travis-ci.org/slack-ruby/slack-shellbot.svg)](https://travis-ci.org/slack-ruby/slack-shellbot)
[![Code Climate](https://codeclimate.com/github/slack-ruby/slack-shellbot/badges/gpa.svg)](https://codeclimate.com/github/slack-ruby/slack-shellbot)

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

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

## Installation

Create a new Bot Integration under [services/new/bot](http://slack.com/services/new/bot). Note the API token.
You will be able to invoke shellbot by the name you give it in the UI above.

Run `SLACK_API_TOKEN=<your API token> foreman start`

## Production Deployment

See [DEPLOYMENT](DEPLOYMENT.md)

## Contributing

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

## Copyright and License

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

This project is licensed under the [MIT License](LICENSE.md).
9 changes: 0 additions & 9 deletions app.json

This file was deleted.

12 changes: 4 additions & 8 deletions slack-shellbot.rb → app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@

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

require 'slack-shellbot/error'
require 'slack-shellbot/version'
require 'slack-shellbot/info'
require 'slack-shellbot/models'
require 'slack-shellbot/api'
require 'slack-shellbot/app'
require 'slack-shellbot/server'
require 'slack-shellbot/commands'
require_relative 'lib/version'
require_relative 'lib/info'
require_relative 'lib/models'
require_relative 'lib/commands'
21 changes: 6 additions & 15 deletions config.ru
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
$LOAD_PATH.unshift(File.dirname(__FILE__))
# frozen_string_literal: true

ENV['RACK_ENV'] ||= 'development'
require_relative 'app'

require 'bundler/setup'
Bundler.require :default, ENV['RACK_ENV']
NewRelic::Agent.manual_start

require 'slack-ruby-bot-server'
require 'slack-shellbot'
SlackRubyBotServer::App.instance.prepare!
SlackRubyBotServer::Service.start!

SlackShellbot::App.instance.prepare!

Thread.abort_on_exception = true

Thread.new do
SlackRubyBotServer::Service.instance.start_from_database!
end

run Api::Middleware.instance
run SlackRubyBotServer::Api::Middleware.instance
29 changes: 0 additions & 29 deletions config/initializers/slack-ruby-bot/client.rb

This file was deleted.

51 changes: 0 additions & 51 deletions config/initializers/slack-ruby-bot/hooks/message.rb

This file was deleted.

4 changes: 4 additions & 0 deletions config/initializers/slack_ruby_bot_server.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
SlackRubyBotServer.configure do |config|
config.oauth_version = :v2
config.oauth_scope = ['chat:write', 'im:history', 'mpim:history', 'channels:history', 'groups:history']
end
Loading