slack-ruby-bot-server 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/LICENSE +1 -1
- data/README.md +12 -6
- data/UPGRADING.md +14 -0
- data/lib/slack-ruby-bot-server/app.rb +0 -27
- data/lib/slack-ruby-bot-server/models/team/methods.rb +0 -13
- data/lib/slack-ruby-bot-server/version.rb +1 -1
- data/sample_apps/sample_app_activerecord/Gemfile +1 -0
- data/sample_apps/sample_app_activerecord/config.ru +8 -1
- data/sample_apps/sample_app_activerecord/config/postgresql.yml +1 -1
- data/sample_apps/sample_app_mongoid/Gemfile +1 -0
- data/slack-ruby-bot-server.gemspec +0 -1
- metadata +2 -17
- data/app.json +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2e8d227e46164c37274bc2fc72c30074f7496835c08a20c5ed6da960336fdf9
|
4
|
+
data.tar.gz: 35a54416b198e2fc372c1613922b28fd1a9f7a5bac39ab0229c3ea7afbd3ed82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e2bcb076d7d28570316239a3584dbd2fd80386dd2468dd0c99038c832f08297c1cb71e94261e38a9e17858c375bed512fe2e5162e5994f4bef1c97faace8f5d
|
7
|
+
data.tar.gz: 170b0bb0da5086f2c135ceda394ce0184394e0ff49b5a00e0942d45279f2410a002199ef46fcd23e25b241597689f42bb16025419d33cd8bfc8900dd3d3be3a8
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
### Changelog
|
2
2
|
|
3
|
+
#### 0.11.0 (Next)
|
4
|
+
|
5
|
+
* [#101](https://github.com/slack-ruby/slack-ruby-bot-server/pull/101): Removed legacy migrations, including `SLACK_API_TOKEN`, team `name`, `team_id` and `active` - [@dblock](https://github.com/dblock).
|
6
|
+
* [#98](https://github.com/slack-ruby/slack-ruby-bot-server/pull/98): Removed `unicorn` from gem dependencies - [@dblock](https://github.com/dblock).
|
7
|
+
* [#90](https://github.com/slack-ruby/slack-ruby-bot-server/pull/90): Update ActiveRecord sample app to support ENV variables in `postgresql.yml` - [@ashkan18](https://github.com/ashkan18).
|
8
|
+
|
3
9
|
#### 0.10.0 (2019/3/23)
|
4
10
|
|
5
11
|
* [#97](https://github.com/slack-ruby/slack-ruby-bot-server/pull/97): Added `Config#service_class` to override the `SlackRubyBotServer::Service.instance` singleton - [@dblock](https://github.com/dblock).
|
data/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2015-
|
3
|
+
Copyright (c) 2015-2019 Daniel Doubrovkine & Contributors
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
@@ -5,7 +5,11 @@ Slack Ruby Bot Server
|
|
5
5
|
[![Build Status](https://travis-ci.org/slack-ruby/slack-ruby-bot-server.svg?branch=master)](https://travis-ci.org/slack-ruby/slack-ruby-bot-server)
|
6
6
|
[![Code Climate](https://codeclimate.com/github/slack-ruby/slack-ruby-bot-server.svg)](https://codeclimate.com/github/slack-ruby/slack-ruby-bot-server)
|
7
7
|
|
8
|
-
|
8
|
+
Build a complete Slack bot service with Slack button integration, in Ruby.
|
9
|
+
|
10
|
+
If you are not familiar with Slack bots or Slack API concepts, you might want to watch [this video](http://code.dblock.org/2016/03/11/your-first-slack-bot-service-video.html).
|
11
|
+
|
12
|
+
A good [open-source demo](https://github.com/dblock/slack-strava) of a service built on top of this library is [Strava integration with Slack](https://slava.playplay.io).
|
9
13
|
|
10
14
|
### What is this?
|
11
15
|
|
@@ -13,7 +17,7 @@ A library that contains a [Grape](http://github.com/ruby-grape/grape) API servin
|
|
13
17
|
|
14
18
|
### Stable Release
|
15
19
|
|
16
|
-
You're reading the documentation for the **stable** release of slack-ruby-bot-server, v0.
|
20
|
+
You're reading the documentation for the **stable** release of slack-ruby-bot-server, v0.11.0. See [UPGRADING](UPGRADING.md) when upgrading from an older version.
|
17
21
|
|
18
22
|
### Try Me
|
19
23
|
|
@@ -58,13 +62,15 @@ See the [sample app using ActiveRecord](sample_apps/sample_app_activerecord) for
|
|
58
62
|
|
59
63
|
### Usage
|
60
64
|
|
61
|
-
[
|
65
|
+
Start with one of the samples above, which contain a couple of custom commands, necessary dependencies and tests, then [create a new application](https://api.slack.com/applications/new) on Slack.
|
62
66
|
|
63
67
|
![](images/new.png)
|
64
68
|
|
65
|
-
Follow
|
69
|
+
Follow Slack's instructions, note the app client ID and secret, give the bot a default name, etc. The redirect URL should be the location of your app, for local testing purposes use `http://localhost:9292`.
|
70
|
+
|
71
|
+
Within your application, edit your `.env` file and add `SLACK_CLIENT_ID=...` and `SLACK_CLIENT_SECRET=...` in it.
|
66
72
|
|
67
|
-
|
73
|
+
Run `bundle install` and `foreman start` to boot the app. Navigate to [localhost:9292](http://localhost:9292). You should see an "Add to Slack" button. Use it to install the app into your own Slack team.
|
68
74
|
|
69
75
|
### API
|
70
76
|
|
@@ -212,6 +218,6 @@ You can see a sample implementation in [slack-sup#3a497b](https://github.com/dbl
|
|
212
218
|
|
213
219
|
### Copyright & License
|
214
220
|
|
215
|
-
Copyright [Daniel Doubrovkine](http://code.dblock.org) and Contributors, 2015-
|
221
|
+
Copyright [Daniel Doubrovkine](http://code.dblock.org) and Contributors, 2015-2019
|
216
222
|
|
217
223
|
[MIT License](LICENSE)
|
data/UPGRADING.md
CHANGED
@@ -1,6 +1,20 @@
|
|
1
1
|
Upgrading Slack-Ruby-Bot-Server
|
2
2
|
===============================
|
3
3
|
|
4
|
+
### Upgrading to >= 0.11.0
|
5
|
+
|
6
|
+
#### Removed Legacy Migrations
|
7
|
+
|
8
|
+
Several legacy migrations have been removed, including the code to automatically create a team from a legacy `SLACK_API_TOKEN`, setting `Team#active`, `name` and `team_id`.
|
9
|
+
|
10
|
+
See [#101](https://github.com/slack-ruby/slack-ruby-bot-server/pull/101) for more information.
|
11
|
+
|
12
|
+
#### Unicorn Dependency
|
13
|
+
|
14
|
+
The dependency on `unicorn` has been removed from gemspec. Use `unicorn` or `puma` or another application server as you see fit by explicitly adding a dependency in your Gemfile.
|
15
|
+
|
16
|
+
See [#98](https://github.com/slack-ruby/slack-ruby-bot-server/pull/98) for more information.
|
17
|
+
|
4
18
|
### Upgrading to >= 0.10.0
|
5
19
|
|
6
20
|
#### New Team Fields
|
@@ -3,9 +3,6 @@ module SlackRubyBotServer
|
|
3
3
|
def prepare!
|
4
4
|
check_database!
|
5
5
|
init_database!
|
6
|
-
mark_teams_active!
|
7
|
-
migrate_from_single_team!
|
8
|
-
update_team_name_and_id!
|
9
6
|
purge_inactive_teams!
|
10
7
|
configure_global_aliases!
|
11
8
|
end
|
@@ -31,30 +28,6 @@ module SlackRubyBotServer
|
|
31
28
|
SlackRubyBotServer::DatabaseAdapter.init!
|
32
29
|
end
|
33
30
|
|
34
|
-
def mark_teams_active!
|
35
|
-
Team.where(active: nil).update_all(active: true)
|
36
|
-
end
|
37
|
-
|
38
|
-
def update_team_name_and_id!
|
39
|
-
Team.active.where(team_id: nil).each do |team|
|
40
|
-
begin
|
41
|
-
auth = team.ping![:auth]
|
42
|
-
team.update_attributes!(team_id: auth['team_id'], name: auth['team'])
|
43
|
-
rescue StandardError => e
|
44
|
-
logger.warn "Error pinging team #{team.id}: #{e.message}."
|
45
|
-
team.set(active: false)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
def migrate_from_single_team!
|
51
|
-
return unless ENV.key?('SLACK_API_TOKEN')
|
52
|
-
logger.info 'Migrating from env SLACK_API_TOKEN ...'
|
53
|
-
team = Team.find_or_create_from_env!
|
54
|
-
logger.info "Automatically migrated team: #{team}."
|
55
|
-
logger.warn "You should unset ENV['SLACK_API_TOKEN']."
|
56
|
-
end
|
57
|
-
|
58
31
|
def purge_inactive_teams!
|
59
32
|
Team.purge!
|
60
33
|
end
|
@@ -38,18 +38,5 @@ module Methods
|
|
38
38
|
presence: client.users_getPresence(user: auth['user_id'])
|
39
39
|
}
|
40
40
|
end
|
41
|
-
|
42
|
-
def self.find_or_create_from_env!
|
43
|
-
token = ENV['SLACK_API_TOKEN']
|
44
|
-
return unless token
|
45
|
-
team = Team.where(token: token).first
|
46
|
-
team ||= Team.new(token: token)
|
47
|
-
info = Slack::Web::Client.new(token: token).team_info
|
48
|
-
team.team_id = info['team']['id']
|
49
|
-
team.name = info['team']['name']
|
50
|
-
team.domain = info['team']['domain']
|
51
|
-
team.save!
|
52
|
-
team
|
53
|
-
end
|
54
41
|
end
|
55
42
|
end
|
@@ -4,8 +4,15 @@ Bundler.require :default
|
|
4
4
|
|
5
5
|
require_relative 'commands'
|
6
6
|
require 'yaml'
|
7
|
+
require 'erb'
|
7
8
|
|
8
|
-
ActiveRecord::Base.establish_connection(
|
9
|
+
ActiveRecord::Base.establish_connection(
|
10
|
+
YAML.safe_load(
|
11
|
+
ERB.new(
|
12
|
+
File.read('config/postgresql.yml')
|
13
|
+
).result, [], [], true
|
14
|
+
)[ENV['RACK_ENV']]
|
15
|
+
)
|
9
16
|
|
10
17
|
NewRelic::Agent.manual_start
|
11
18
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slack-ruby-bot-server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.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: 2019-
|
11
|
+
date: 2019-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async-websocket
|
@@ -150,20 +150,6 @@ dependencies:
|
|
150
150
|
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: 0.12.0
|
153
|
-
- !ruby/object:Gem::Dependency
|
154
|
-
name: unicorn
|
155
|
-
requirement: !ruby/object:Gem::Requirement
|
156
|
-
requirements:
|
157
|
-
- - ">="
|
158
|
-
- !ruby/object:Gem::Version
|
159
|
-
version: '0'
|
160
|
-
type: :runtime
|
161
|
-
prerelease: false
|
162
|
-
version_requirements: !ruby/object:Gem::Requirement
|
163
|
-
requirements:
|
164
|
-
- - ">="
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
version: '0'
|
167
153
|
description:
|
168
154
|
email:
|
169
155
|
- dblock@dblock.org
|
@@ -187,7 +173,6 @@ files:
|
|
187
173
|
- RELEASING.md
|
188
174
|
- Rakefile
|
189
175
|
- UPGRADING.md
|
190
|
-
- app.json
|
191
176
|
- images/new.png
|
192
177
|
- images/slackbotserver.gif
|
193
178
|
- images/slackbutton.gif
|