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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 86a1479af364899fd951bee2d75f30d3fd32d2ccb60f3804716d574746f1b85e
4
- data.tar.gz: 88cfbd7ed0bec93439f327f5389f9bff6a8eeeb0eeeb2d89f35fa3b08cefc416
3
+ metadata.gz: c2e8d227e46164c37274bc2fc72c30074f7496835c08a20c5ed6da960336fdf9
4
+ data.tar.gz: 35a54416b198e2fc372c1613922b28fd1a9f7a5bac39ab0229c3ea7afbd3ed82
5
5
  SHA512:
6
- metadata.gz: 9efdeede9435e4d5bca785b0dbd567a65119892a2521882477e3e5e79480257886375f2170dd54166e6e05fa9be186e4f8da2f878bdae0674c7b76061ac9e66a
7
- data.tar.gz: 2a7bf1ee2397aaca5a3337503209009e679e0ebf5daaeed374c8a75fb4ffb102d7a4298d87a8c5c092789932f1f259919119c7959ee21f0c3130c8d90195b673
6
+ metadata.gz: 1e2bcb076d7d28570316239a3584dbd2fd80386dd2468dd0c99038c832f08297c1cb71e94261e38a9e17858c375bed512fe2e5162e5994f4bef1c97faace8f5d
7
+ data.tar.gz: 170b0bb0da5086f2c135ceda394ce0184394e0ff49b5a00e0942d45279f2410a002199ef46fcd23e25b241597689f42bb16025419d33cd8bfc8900dd3d3be3a8
@@ -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-2018 Daniel Doubrovkine & Contributors
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
- A library that enables you to write a complete Slack bot service with Slack button integration, in Ruby. 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). A good demo of a service built on top of this is [missingkidsbot.org](http://missingkidsbot.org).
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.10.0. See [UPGRADING](UPGRADING.md) when upgrading from an older version.
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
- [Create a New Application](https://api.slack.com/applications/new) on Slack.
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 the instructions, note the app's client ID and secret, give the bot a default name, etc. The redirect URL should be the location of your app, for testing purposes use `http://localhost:9292`. Edit your `.env` file and add `SLACK_CLIENT_ID=...` and `SLACK_CLIENT_SECRET=...` in it. Run `bundle install` and `foreman start`. Navigate to [localhost:9292](http://localhost:9292). Register using the Slack button.
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
- If you deploy to Heroku set `SLACK_CLIENT_ID` and `SLACK_CLIENT_SECRET` via `heroku config:add SLACK_CLIENT_ID=... SLACK_CLIENT_SECRET=...`.
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-2018
221
+ Copyright [Daniel Doubrovkine](http://code.dblock.org) and Contributors, 2015-2019
216
222
 
217
223
  [MIT License](LICENSE)
@@ -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
@@ -1,3 +1,3 @@
1
1
  module SlackRubyBotServer
2
- VERSION = '0.10.0'.freeze
2
+ VERSION = '0.11.0'.freeze
3
3
  end
@@ -7,6 +7,7 @@ gem 'pg'
7
7
  gem 'rack-server-pages'
8
8
  gem 'rack-test'
9
9
  gem 'slack-ruby-bot-server', path: '../../'
10
+ gem 'unicorn'
10
11
 
11
12
  group :development, :test do
12
13
  gem 'standalone_migrations', '~> 5.2'
@@ -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(YAML.load_file('config/postgresql.yml')[ENV['RACK_ENV']])
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
 
@@ -14,4 +14,4 @@ test:
14
14
 
15
15
  production:
16
16
  <<: *default
17
- database: slack_ruby_bot_server_production
17
+ url: <%= ENV["DATABASE_URL"] %>
@@ -6,6 +6,7 @@ gem 'slack-ruby-bot-server', path: '../../'
6
6
 
7
7
  gem 'kaminari-mongoid'
8
8
  gem 'mongoid-scroll'
9
+ gem 'unicorn'
9
10
 
10
11
  group :test do
11
12
  gem 'database_cleaner'
@@ -24,5 +24,4 @@ Gem::Specification.new do |spec|
24
24
  spec.add_dependency 'rack-rewrite'
25
25
  spec.add_dependency 'rack-server-pages'
26
26
  spec.add_dependency 'slack-ruby-bot', '>= 0.12.0'
27
- spec.add_dependency 'unicorn'
28
27
  end
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.10.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-03-24 00:00:00.000000000 Z
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
data/app.json DELETED
@@ -1,9 +0,0 @@
1
- {
2
- "name": "Slack Bot Server",
3
- "description": "A Slack bot server.",
4
- "respository": "https://github.com/slack-ruby/slack-ruby-bot-server",
5
- "keywords": ["slack", "bots"],
6
- "addons": [
7
- "mongolab"
8
- ]
9
- }