slack-ruby-bot-server 2.1.1 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/danger-comment.yml +11 -0
- data/.github/workflows/danger.yml +11 -21
- data/.github/workflows/rubocop.yml +9 -3
- data/.github/workflows/test-mongodb.yml +43 -24
- data/.github/workflows/test-postgresql.yml +48 -25
- data/.rubocop.yml +1 -0
- data/.rubocop_todo.yml +22 -14
- data/AGENTS.md +55 -0
- data/CHANGELOG.md +14 -0
- data/CONTRIBUTING.md +10 -5
- data/Dangerfile +3 -1
- data/Gemfile +31 -24
- data/LICENSE +1 -1
- data/README.md +6 -21
- data/RELEASING.md +26 -18
- data/Rakefile +1 -1
- data/UPGRADING.md +6 -0
- data/lib/slack-ruby-bot-server/api/endpoints/teams_endpoint.rb +2 -2
- data/lib/slack-ruby-bot-server/api/helpers/cursor_helpers.rb +2 -2
- data/lib/slack-ruby-bot-server/api/helpers/error_helpers.rb +21 -21
- data/lib/slack-ruby-bot-server/api/helpers/sort_helpers.rb +3 -2
- data/lib/slack-ruby-bot-server/api/middleware.rb +1 -1
- data/lib/slack-ruby-bot-server/config/database_adapters/activerecord.rb +7 -2
- data/lib/slack-ruby-bot-server/service.rb +3 -2
- data/lib/slack-ruby-bot-server/version.rb +1 -1
- data/slack-ruby-bot-server.gemspec +2 -0
- metadata +21 -9
- data/Gemfile.danger +0 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f7080b4c298a9246ee55a74395a69e185657e7999e7acd19c55792f3a5cc2fd4
|
|
4
|
+
data.tar.gz: 4a5495629509d5b4352d42b0290ead69db7ffd8a157841eb7a85dd7d1053b928
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 769de3df16397c503ed1075acda16a9b6f67a8a6dba7d2acad8a6d28c6a06dade0f7f2046f6f6cd560883dbee849dd17bdf913a0ee6b8eedc5928b9db58f40c1
|
|
7
|
+
data.tar.gz: cabe33848ffe7d6895d1b659e28ff43922740062964d29c6ae7d7f152e33f38820b0849f5fdfe90d28f924904dc0b61496a4da723462aa6c1670688251843f78
|
|
@@ -1,23 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
on:
|
|
1
|
+
name: Danger
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
types: [opened, reopened, edited, synchronize]
|
|
6
|
+
|
|
4
7
|
jobs:
|
|
5
8
|
danger:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
- name: Set up Ruby
|
|
12
|
-
uses: ruby/setup-ruby@v1
|
|
13
|
-
with:
|
|
14
|
-
ruby-version: 2.6
|
|
15
|
-
bundler-cache: true
|
|
16
|
-
- name: Run Danger
|
|
17
|
-
env:
|
|
18
|
-
BUNDLE_GEMFILE: Gemfile.danger
|
|
19
|
-
run: |
|
|
20
|
-
bundle install
|
|
21
|
-
# the personal token is public, this is ok, base64 encode to avoid tripping Github
|
|
22
|
-
TOKEN=$(echo -n Z2hwX0xNQ3VmanBFeTBvYkZVTWh6NVNqVFFBOEUxU25abzBqRUVuaAo= | base64 --decode)
|
|
23
|
-
DANGER_GITHUB_API_TOKEN=$TOKEN bundle exec danger --verbose
|
|
9
|
+
uses: numbata/danger-pr-comment/.github/workflows/danger-run.yml@v0.1.0
|
|
10
|
+
secrets: inherit
|
|
11
|
+
with:
|
|
12
|
+
ruby-version: '3.4'
|
|
13
|
+
bundler-cache: true
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: lint
|
|
3
3
|
on: [push, pull_request]
|
|
4
|
+
permissions:
|
|
5
|
+
contents: read
|
|
6
|
+
concurrency:
|
|
7
|
+
group: rubocop-${{ github.ref }}
|
|
8
|
+
cancel-in-progress: true
|
|
4
9
|
jobs:
|
|
5
10
|
lint:
|
|
6
11
|
name: RuboCop
|
|
7
|
-
runs-on: ubuntu-
|
|
12
|
+
runs-on: ubuntu-24.04
|
|
13
|
+
timeout-minutes: 10
|
|
8
14
|
steps:
|
|
9
|
-
- uses: actions/checkout@
|
|
15
|
+
- uses: actions/checkout@v7
|
|
10
16
|
- name: Set up Ruby
|
|
11
17
|
uses: ruby/setup-ruby@v1
|
|
12
18
|
with:
|
|
13
|
-
ruby-version: '
|
|
19
|
+
ruby-version: '4.0'
|
|
14
20
|
bundler-cache: true
|
|
15
21
|
- name: Run RuboCop
|
|
16
22
|
run: bundle exec rubocop
|
|
@@ -1,37 +1,56 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
2
|
+
name: MongoDB
|
|
3
3
|
on: [push, pull_request]
|
|
4
|
+
permissions:
|
|
5
|
+
contents: read
|
|
6
|
+
concurrency:
|
|
7
|
+
group: mongodb-${{ github.ref }}
|
|
8
|
+
cancel-in-progress: true
|
|
4
9
|
jobs:
|
|
5
10
|
test:
|
|
6
|
-
runs-on: ubuntu-
|
|
11
|
+
runs-on: ubuntu-24.04
|
|
12
|
+
timeout-minutes: 20
|
|
13
|
+
env:
|
|
14
|
+
DATABASE_ADAPTER: mongoid
|
|
15
|
+
MONGOID_VERSION: ${{ matrix.entry.mongoid }}
|
|
16
|
+
GRAPE_VERSION: ${{ matrix.entry.grape || '>= 0' }}
|
|
17
|
+
JSON_VERSION: ${{ matrix.entry.json }}
|
|
7
18
|
strategy:
|
|
19
|
+
fail-fast: false
|
|
8
20
|
matrix:
|
|
9
21
|
entry:
|
|
10
|
-
|
|
11
|
-
- { ruby:
|
|
12
|
-
- { ruby:
|
|
13
|
-
- { ruby: 3.
|
|
14
|
-
- { ruby: 3.
|
|
15
|
-
- { ruby: 3.
|
|
16
|
-
|
|
22
|
+
# These Active Support versions pass quirks_mode, removed in JSON 3.
|
|
23
|
+
- { ruby: '3.2', mongoid: '6.4.8', mongodb: '4.4', json: '~> 2.0' }
|
|
24
|
+
- { ruby: '3.2', mongoid: '7.2.3', mongodb: '4.4', json: '~> 2.0' }
|
|
25
|
+
- { ruby: '3.2', mongoid: '7.3.0', mongodb: '4.4', json: '~> 2.0' }
|
|
26
|
+
- { ruby: '3.3', mongoid: '7.3.0', mongodb: '5.0', json: '~> 2.0' }
|
|
27
|
+
- { ruby: '3.4', mongoid: '7.5.2', mongodb: '5.0', json: '~> 2.0' }
|
|
28
|
+
- { ruby: '3.4', mongoid: '8.1.11', mongodb: '6.0', json: '~> 2.0' }
|
|
29
|
+
- { ruby: '3.4', mongoid: '8.1.11', mongodb: '7.0', json: '~> 2.0' }
|
|
30
|
+
- { ruby: '3.4', mongoid: '8.1.11', mongodb: '8.0', json: '~> 2.0' }
|
|
31
|
+
- { ruby: '3.3', mongoid: '~> 9.1', mongodb: '8.0', grape: '~> 3.2', json: '~> 3.0' }
|
|
32
|
+
- { ruby: '3.4', mongoid: '~> 9.1', mongodb: '8.0', grape: '~> 4.0', json: '~> 3.0' }
|
|
33
|
+
- { ruby: '4.0', mongoid: '~> 9.1', mongodb: '8.0', grape: '~> 4.0', json: '~> 3.0' }
|
|
34
|
+
name: test (ruby=${{ matrix.entry.ruby }}, mongoid=${{ matrix.entry.mongoid }}, mongodb=${{ matrix.entry.mongodb }}, grape=${{ matrix.entry.grape || 'auto' }}, json=${{ matrix.entry.json }})
|
|
35
|
+
services:
|
|
36
|
+
mongodb:
|
|
37
|
+
image: mongo:${{ matrix.entry.mongodb }}
|
|
38
|
+
ports:
|
|
39
|
+
- 27017:27017
|
|
40
|
+
options: >-
|
|
41
|
+
--health-cmd "mongosh --quiet --eval 'db.adminCommand({ ping: 1 })' || mongo --quiet --eval 'db.adminCommand({ ping: 1 })'"
|
|
42
|
+
--health-interval 10s
|
|
43
|
+
--health-timeout 5s
|
|
44
|
+
--health-retries 10
|
|
17
45
|
steps:
|
|
18
|
-
- uses: actions/checkout@
|
|
46
|
+
- uses: actions/checkout@v7
|
|
19
47
|
- uses: ruby/setup-ruby@v1
|
|
20
48
|
with:
|
|
21
49
|
ruby-version: ${{ matrix.entry.ruby }}
|
|
22
|
-
|
|
50
|
+
bundler-cache: true
|
|
51
|
+
cache-version: mongoid-${{ matrix.entry.mongoid }}-grape-${{ matrix.entry.grape || 'auto' }}-json-${{ matrix.entry.json }}
|
|
52
|
+
- uses: browser-actions/setup-firefox@v1.7.2
|
|
23
53
|
with:
|
|
24
|
-
|
|
25
|
-
- run: geckodriver --version
|
|
26
|
-
- uses: supercharge/mongodb-github-action@1.7.0
|
|
27
|
-
with:
|
|
28
|
-
mongodb-version: ${{ matrix.entry.mongodb }}
|
|
54
|
+
firefox-version: latest
|
|
29
55
|
- name: Test
|
|
30
|
-
|
|
31
|
-
env:
|
|
32
|
-
DATABASE_ADAPTER: mongoid
|
|
33
|
-
MONGOID_VERSION: ${{ matrix.entry.mongoid }}
|
|
34
|
-
with:
|
|
35
|
-
run: |
|
|
36
|
-
bundle install
|
|
37
|
-
bundle exec rake spec
|
|
56
|
+
run: xvfb-run --auto-servernum bundle exec rake spec
|
|
@@ -1,38 +1,61 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
2
|
+
name: PostgreSQL
|
|
3
3
|
on: [push, pull_request]
|
|
4
|
+
permissions:
|
|
5
|
+
contents: read
|
|
6
|
+
concurrency:
|
|
7
|
+
group: postgresql-${{ github.ref }}
|
|
8
|
+
cancel-in-progress: true
|
|
4
9
|
jobs:
|
|
5
10
|
test:
|
|
6
|
-
runs-on: ubuntu-
|
|
11
|
+
runs-on: ubuntu-24.04
|
|
12
|
+
timeout-minutes: 20
|
|
13
|
+
env:
|
|
14
|
+
DATABASE_ADAPTER: activerecord
|
|
15
|
+
ACTIVERECORD_VERSION: ${{ matrix.entry.active_record }}
|
|
16
|
+
GRAPE_VERSION: ${{ matrix.entry.grape || '>= 0' }}
|
|
17
|
+
JSON_VERSION: ${{ matrix.entry.json }}
|
|
18
|
+
DATABASE_URL: postgres://test:password@localhost/slack_ruby_bot_server_test
|
|
7
19
|
strategy:
|
|
20
|
+
fail-fast: false
|
|
8
21
|
matrix:
|
|
9
22
|
entry:
|
|
10
|
-
|
|
11
|
-
- { ruby: 3.
|
|
12
|
-
- { ruby: 3.
|
|
13
|
-
|
|
23
|
+
# Active Support 6.x, 7.0, and 8.0 pass quirks_mode, removed in JSON 3.
|
|
24
|
+
- { ruby: '3.2', postgresql: '11', active_record: '~> 6.0.0', json: '~> 2.0' }
|
|
25
|
+
- { ruby: '3.2', postgresql: '11', active_record: '~> 6.1.0', json: '~> 2.0' }
|
|
26
|
+
- { ruby: '3.2', postgresql: '14', active_record: '~> 7.0.0', json: '~> 2.0' }
|
|
27
|
+
- { ruby: '3.3', postgresql: '14', active_record: '~> 7.2.0', json: '~> 3.0' }
|
|
28
|
+
- { ruby: '3.4', postgresql: '14', active_record: '~> 7.2.0', json: '~> 3.0' }
|
|
29
|
+
- { ruby: '3.4', postgresql: '15', active_record: '~> 8.0.2', json: '~> 2.0' }
|
|
30
|
+
- { ruby: '3.4', postgresql: '16', active_record: '~> 8.0.2', json: '~> 2.0' }
|
|
31
|
+
- { ruby: '3.4', postgresql: '17', active_record: '~> 8.0.2', json: '~> 2.0' }
|
|
32
|
+
- { ruby: '3.3', postgresql: '18', active_record: '~> 8.1', grape: '~> 3.2', json: '~> 3.0' }
|
|
33
|
+
- { ruby: '3.4', postgresql: '18', active_record: '~> 8.1', grape: '~> 4.0', json: '~> 3.0' }
|
|
34
|
+
- { ruby: '4.0', postgresql: '18', active_record: '~> 8.1', grape: '~> 4.0', json: '~> 3.0' }
|
|
35
|
+
name: test (ruby=${{ matrix.entry.ruby }}, postgresql=${{ matrix.entry.postgresql }}, active_record=${{ matrix.entry.active_record }}, grape=${{ matrix.entry.grape || 'auto' }}, json=${{ matrix.entry.json }})
|
|
36
|
+
services:
|
|
37
|
+
postgresql:
|
|
38
|
+
image: postgres:${{ matrix.entry.postgresql }}
|
|
39
|
+
env:
|
|
40
|
+
POSTGRES_DB: slack_ruby_bot_server_test
|
|
41
|
+
POSTGRES_USER: test
|
|
42
|
+
POSTGRES_PASSWORD: password
|
|
43
|
+
ports:
|
|
44
|
+
- 5432:5432
|
|
45
|
+
options: >-
|
|
46
|
+
--health-cmd "pg_isready -U test -d slack_ruby_bot_server_test"
|
|
47
|
+
--health-interval 10s
|
|
48
|
+
--health-timeout 5s
|
|
49
|
+
--health-retries 10
|
|
14
50
|
steps:
|
|
15
|
-
- uses: actions/checkout@
|
|
51
|
+
- uses: actions/checkout@v7
|
|
16
52
|
- uses: ruby/setup-ruby@v1
|
|
17
53
|
with:
|
|
18
54
|
ruby-version: ${{ matrix.entry.ruby }}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
- run: geckodriver --version
|
|
23
|
-
- uses: harmon758/postgresql-action@v1
|
|
55
|
+
bundler-cache: true
|
|
56
|
+
cache-version: activerecord-${{ matrix.entry.active_record }}-grape-${{ matrix.entry.grape || 'auto' }}-json-${{ matrix.entry.json }}
|
|
57
|
+
- uses: browser-actions/setup-firefox@v1.7.2
|
|
24
58
|
with:
|
|
25
|
-
|
|
26
|
-
postgresql db: slack_ruby_bot_server_test
|
|
27
|
-
postgresql user: test
|
|
28
|
-
postgresql password: password
|
|
59
|
+
firefox-version: latest
|
|
29
60
|
- name: Test
|
|
30
|
-
|
|
31
|
-
env:
|
|
32
|
-
DATABASE_ADAPTER: activerecord
|
|
33
|
-
ACTIVERECORD_VERSION: ${{ matrix.entry.active_record }}
|
|
34
|
-
DATABASE_URL: postgres://test:password@localhost/slack_ruby_bot_server_test
|
|
35
|
-
with:
|
|
36
|
-
run: |
|
|
37
|
-
bundle install
|
|
38
|
-
bundle exec rake spec
|
|
61
|
+
run: xvfb-run --auto-servernum bundle exec rake spec
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
2
|
# `rubocop --auto-gen-config`
|
|
3
|
-
# on
|
|
3
|
+
# on 2025-10-08 12:27:28 UTC using RuboCop version 1.81.1.
|
|
4
4
|
# The point is for the user to remove these configuration records
|
|
5
5
|
# one by one as the offenses are removed from the code base.
|
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
|
8
8
|
|
|
9
9
|
# Offense count: 1
|
|
10
|
-
# Configuration parameters: Severity
|
|
11
|
-
# Include: **/*.gemspec
|
|
10
|
+
# Configuration parameters: Severity.
|
|
12
11
|
Gemspec/RequiredRubyVersion:
|
|
13
12
|
Exclude:
|
|
14
13
|
- 'slack-ruby-bot-server.gemspec'
|
|
@@ -38,12 +37,18 @@ Lint/ConstantDefinitionInBlock:
|
|
|
38
37
|
Exclude:
|
|
39
38
|
- 'lib/slack-ruby-bot-server/models/team/methods.rb'
|
|
40
39
|
|
|
40
|
+
# Offense count: 1
|
|
41
|
+
Lint/UselessDefined:
|
|
42
|
+
Exclude:
|
|
43
|
+
- 'lib/slack-ruby-bot-server/ext/bson/object_id.rb'
|
|
44
|
+
|
|
41
45
|
# Offense count: 1
|
|
42
46
|
# Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms.
|
|
43
47
|
# CheckDefinitionPathHierarchyRoots: lib, spec, test, src
|
|
44
48
|
# 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
|
|
45
49
|
Naming/FileName:
|
|
46
50
|
Exclude:
|
|
51
|
+
- 'Rakefile.rb'
|
|
47
52
|
- 'lib/slack-ruby-bot-server.rb'
|
|
48
53
|
|
|
49
54
|
# Offense count: 1
|
|
@@ -62,7 +67,7 @@ Naming/MethodParameterName:
|
|
|
62
67
|
- 'lib/slack-ruby-bot-server/models/team/mongoid.rb'
|
|
63
68
|
- 'lib/slack-ruby-bot-server/service.rb'
|
|
64
69
|
|
|
65
|
-
# Offense count:
|
|
70
|
+
# Offense count: 6
|
|
66
71
|
# This cop supports safe autocorrection (--autocorrect).
|
|
67
72
|
# Configuration parameters: EnforcedStyle.
|
|
68
73
|
# SupportedStyles: separated, grouped
|
|
@@ -70,6 +75,13 @@ Style/AccessorGrouping:
|
|
|
70
75
|
Exclude:
|
|
71
76
|
- 'lib/slack-ruby-bot-server/config.rb'
|
|
72
77
|
|
|
78
|
+
# Offense count: 2
|
|
79
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
80
|
+
Style/CollectionQuerying:
|
|
81
|
+
Exclude:
|
|
82
|
+
- 'lib/slack-ruby-bot-server/api/helpers/error_helpers.rb'
|
|
83
|
+
- 'lib/slack-ruby-bot-server/api/helpers/sort_helpers.rb'
|
|
84
|
+
|
|
73
85
|
# Offense count: 3
|
|
74
86
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
75
87
|
Style/GlobalStdStream:
|
|
@@ -77,16 +89,6 @@ Style/GlobalStdStream:
|
|
|
77
89
|
- 'spec/database_adapters/activerecord/activerecord.rb'
|
|
78
90
|
- 'tasks/db.rake'
|
|
79
91
|
|
|
80
|
-
# Offense count: 18
|
|
81
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
82
|
-
# Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
|
|
83
|
-
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
|
|
84
|
-
# SupportedShorthandSyntax: always, never, either, consistent
|
|
85
|
-
Style/HashSyntax:
|
|
86
|
-
Exclude:
|
|
87
|
-
- 'lib/slack-ruby-bot-server/api/endpoints/teams_endpoint.rb'
|
|
88
|
-
- 'lib/slack-ruby-bot-server/models/team/methods.rb'
|
|
89
|
-
|
|
90
92
|
# Offense count: 1
|
|
91
93
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
92
94
|
Style/HashTransformKeys:
|
|
@@ -99,6 +101,12 @@ Style/HashTransformValues:
|
|
|
99
101
|
Exclude:
|
|
100
102
|
- 'lib/slack-ruby-bot-server/api/helpers/error_helpers.rb'
|
|
101
103
|
|
|
104
|
+
# Offense count: 2
|
|
105
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
106
|
+
Style/MapToHash:
|
|
107
|
+
Exclude:
|
|
108
|
+
- 'spec/support/api/endpoints/it_behaves_like_a_cursor_api.rb'
|
|
109
|
+
|
|
102
110
|
# Offense count: 1
|
|
103
111
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
104
112
|
# Configuration parameters: EnforcedStyle, Autocorrect.
|
data/AGENTS.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Agent Instructions
|
|
2
|
+
|
|
3
|
+
## Project
|
|
4
|
+
|
|
5
|
+
Slack Ruby Bot Server is a Ruby gem providing a Grape API and multi-team Slack bot lifecycle management. Read [CONTRIBUTING.md](CONTRIBUTING.md) before making changes.
|
|
6
|
+
|
|
7
|
+
- `lib/slack-ruby-bot-server/api/`: endpoints, presenters, helpers, and middleware.
|
|
8
|
+
- `lib/slack-ruby-bot-server/models/` and `lib/slack-ruby-bot-server/ext/`: models and database-specific behavior.
|
|
9
|
+
- `lib/slack-ruby-bot-server/app.rb` and `service.rb`: application setup and service lifecycle.
|
|
10
|
+
- `public/`: registration UI and static assets.
|
|
11
|
+
- `spec/`: RSpec API, model, service, and browser integration tests.
|
|
12
|
+
- `spec/database_adapters/`: adapter setup, test schemas, and database cleanup.
|
|
13
|
+
- `.github/workflows/`: compatibility matrices, lint, and Danger.
|
|
14
|
+
|
|
15
|
+
## Dependencies and Tests
|
|
16
|
+
|
|
17
|
+
Set the adapter and version selectors before installing dependencies. Use a Ruby version covered by CI; the examples below match the current Ruby 4/Grape 4 jobs.
|
|
18
|
+
|
|
19
|
+
Start MongoDB locally, then run:
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
export DATABASE_ADAPTER=mongoid MONGOID_VERSION='~> 9.1' GRAPE_VERSION='~> 4.0' JSON_VERSION='~> 3.0'
|
|
23
|
+
export DATABASE_URL=mongodb://localhost/slack_ruby_bot_server_test
|
|
24
|
+
bundle install
|
|
25
|
+
bundle exec rake
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
For PostgreSQL, start the server and adjust local credentials in `DATABASE_URL` as needed:
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
export DATABASE_ADAPTER=activerecord ACTIVERECORD_VERSION='~> 8.1' GRAPE_VERSION='~> 4.0' JSON_VERSION='~> 3.0'
|
|
32
|
+
export DATABASE_URL=postgresql://localhost/slack_ruby_bot_server_test
|
|
33
|
+
bundle install
|
|
34
|
+
bundle exec rake
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Use only a dedicated local test database. The suite deletes or truncates records, and the Active Record schema recreates the teams table.
|
|
38
|
+
|
|
39
|
+
`bundle exec rake` runs RuboCop and the full RSpec suite. Use `bundle exec rspec path/to/spec.rb` for focused checks. Validate shared behavior against both adapters before committing; batch final checks rather than repeatedly running full suites during editing.
|
|
40
|
+
|
|
41
|
+
Browser tests require Firefox. Selenium Manager provisions geckodriver when needed. On Linux, install Xvfb and run `xvfb-run --auto-servernum bundle exec rake`. Adapter suites must run sequentially on one host because Capybara uses port 9293.
|
|
42
|
+
|
|
43
|
+
`Gemfile.lock` is intentionally ignored. Re-resolve dependencies when switching adapter/version combinations; do not add the lockfile to the gem repository.
|
|
44
|
+
|
|
45
|
+
## Changes and Compatibility
|
|
46
|
+
|
|
47
|
+
Preserve both database adapters and the existing unique CI matrix combinations, including explicit Grape 3/4 coverage. Quote version strings in workflow YAML and validate workflow changes with `actionlint`.
|
|
48
|
+
|
|
49
|
+
Keep JSON 2 constraints scoped to affected legacy matrix jobs through `JSON_VERSION`; modern jobs explicitly test JSON 3. Do not add a blanket JSON upper bound to the Gemfile or gemspec.
|
|
50
|
+
|
|
51
|
+
Follow existing Ruby conventions and `.rubocop.yml`; do not relax cops or add exclusions just to make checks pass. Add focused regression tests for changed behavior and update directly related documentation. Keep Markdown paragraphs on one line.
|
|
52
|
+
|
|
53
|
+
Add a changelog entry under the next release, with contributor attribution and the linked PR number once available. Danger checks the changelog and table of contents.
|
|
54
|
+
|
|
55
|
+
Keep each PR branch to one logical commit. Include `Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>` for Copilot contributions, and identify AI-authored GitHub descriptions/comments as posted on behalf of the requesting user. Never force-push `master`. Do not publish a release or push a release tag without explicit authorization.
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
### Changelog
|
|
2
2
|
|
|
3
|
+
### 2.2.1 (2026/10/24)
|
|
4
|
+
|
|
5
|
+
* [#182](https://github.com/slack-ruby/slack-ruby-bot-server/pull/182): Modernize CI with current actions, native database services, dependency caching, and explicit Ruby 4, Mongoid 9, Active Record 8.1, PostgreSQL 18, Grape 3/4, and JSON 2/3 coverage while retaining existing compatibility combinations - [@dblock](https://github.com/dblock), [@Copilot](https://github.com/apps/copilot-swe-agent).
|
|
6
|
+
* [#181](https://github.com/slack-ruby/slack-ruby-bot-server/pull/181): Migrated Danger to `danger-pr-comment` workflow - [@dblock](https://github.com/dblock).
|
|
7
|
+
* [#180](https://github.com/slack-ruby/slack-ruby-bot-server/pull/180): Add support for Grape v3 - [@markokajzer](https://github.com/markokajzer).
|
|
8
|
+
|
|
9
|
+
### 2.2.0 (2025/09/22)
|
|
10
|
+
|
|
11
|
+
* [#176](https://github.com/slack-ruby/slack-ruby-bot-server/pull/176): Deps: bump mongoid-scroll to 2.0 - [@markokajzer](https://github.com/markokajzer).
|
|
12
|
+
* [#175](https://github.com/slack-ruby/slack-ruby-bot-server/pull/175): Fix(activerecord): correctly check for database in rails 7.2+ - [@markokajzer](https://github.com/markokajzer).
|
|
13
|
+
* [#178](https://github.com/slack-ruby/slack-ruby-bot-server/pull/178): Add support for Mongoid 8 - [@dblock](https://github.com/dblock).
|
|
14
|
+
* [#178](https://github.com/slack-ruby/slack-ruby-bot-server/pull/178): Cursor-helper now requires mongoid-scroll 2.x - [@dblock](https://github.com/dblock).
|
|
15
|
+
* [#178](https://github.com/slack-ruby/slack-ruby-bot-server/pull/178): Add support for ActiveRecord 8 - [@dblock](https://github.com/dblock).
|
|
16
|
+
|
|
3
17
|
### 2.1.1 (2023/07/25)
|
|
4
18
|
|
|
5
19
|
* [#172](https://github.com/slack-ruby/slack-ruby-bot-server/pull/172): Fix: intervals may not always be started in an async block - [@dblock](https://github.com/dblock).
|
data/CONTRIBUTING.md
CHANGED
|
@@ -28,15 +28,20 @@ git checkout -b my-feature-branch
|
|
|
28
28
|
|
|
29
29
|
## Bundle Install and Test
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
Select a database adapter before installing dependencies. For example, to match the Ruby 4 MongoDB/Grape 4 job, start MongoDB locally and run:
|
|
32
32
|
|
|
33
|
-
```
|
|
33
|
+
```sh
|
|
34
|
+
export DATABASE_ADAPTER=mongoid MONGOID_VERSION='~> 9.1' GRAPE_VERSION='~> 4.0' JSON_VERSION='~> 3.0'
|
|
35
|
+
export DATABASE_URL=mongodb://localhost/slack_ruby_bot_server_test
|
|
34
36
|
bundle install
|
|
35
37
|
bundle exec rake
|
|
36
38
|
```
|
|
37
39
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
For PostgreSQL, set `DATABASE_ADAPTER=activerecord`, `ACTIVERECORD_VERSION`, and `DATABASE_URL` instead. `GRAPE_VERSION` optionally constrains the Grape version for either adapter; without it, Bundler selects a compatible version. CI preserves the older compatibility combinations and adds explicit Grape 3 and 4 jobs with current ORM versions, including Ruby 4. Each database runs in a health-checked service container, while Firefox runs under Xvfb. Selenium Manager provisions the matching driver.
|
|
41
|
+
|
|
42
|
+
`JSON_VERSION` optionally constrains the development/test JSON dependency; otherwise it is unrestricted. CI uses JSON 2 for Mongoid 6-8 and Active Record 6.x, 7.0, and 8.0 because their Active Support versions pass `quirks_mode`, removed in JSON 3. Mongoid 9, Active Record 7.2, and Active Record 8.1 jobs explicitly test JSON 3. These selectors do not restrict the published gem's runtime dependencies.
|
|
43
|
+
|
|
44
|
+
On Linux, install [Firefox](https://www.mozilla.org/firefox/) and `Xvfb`, then run:
|
|
40
45
|
|
|
41
46
|
```
|
|
42
47
|
xvfb-run --auto-servernum bundle exec rake
|
|
@@ -121,7 +126,7 @@ git push origin my-feature-branch -f
|
|
|
121
126
|
|
|
122
127
|
## Check on Your Pull Request
|
|
123
128
|
|
|
124
|
-
Go back to your pull request after a few minutes and
|
|
129
|
+
Go back to your pull request after a few minutes and check its GitHub Actions results. Everything should look green, otherwise fix issues and update your commit as described above.
|
|
125
130
|
|
|
126
131
|
## Be Patient
|
|
127
132
|
|
data/Dangerfile
CHANGED
data/Gemfile
CHANGED
|
@@ -1,41 +1,48 @@
|
|
|
1
1
|
source 'https://rubygems.org'
|
|
2
2
|
|
|
3
|
-
case ENV
|
|
3
|
+
case ENV.fetch('DATABASE_ADAPTER', nil)
|
|
4
4
|
when 'mongoid' then
|
|
5
|
+
gem 'database_cleaner-mongoid', '~> 2.0.1'
|
|
5
6
|
gem 'kaminari-mongoid'
|
|
6
7
|
gem 'mongoid', ENV['MONGOID_VERSION'] || '~> 7.3.0'
|
|
7
|
-
gem 'mongoid-scroll'
|
|
8
|
+
gem 'mongoid-scroll', '~> 2.0'
|
|
8
9
|
gem 'mongoid-shell'
|
|
9
10
|
when 'activerecord' then
|
|
10
11
|
gem 'activerecord', ENV['ACTIVERECORD_VERSION'] || '~> 6.0.0'
|
|
12
|
+
gem 'database_cleaner-active_record', '~> 2.2.0'
|
|
11
13
|
gem 'otr-activerecord'
|
|
12
|
-
gem 'pagy_cursor'
|
|
14
|
+
gem 'pagy_cursor', '~> 0.6.1'
|
|
13
15
|
gem 'pg'
|
|
14
16
|
when nil
|
|
15
17
|
warn "Missing ENV['DATABASE_ADAPTER']."
|
|
16
18
|
else
|
|
17
|
-
warn "Invalid ENV['DATABASE_ADAPTER']: #{ENV
|
|
19
|
+
warn "Invalid ENV['DATABASE_ADAPTER']: #{ENV.fetch('DATABASE_ADAPTER', nil)}."
|
|
18
20
|
end
|
|
19
21
|
|
|
20
22
|
gemspec
|
|
21
23
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
24
|
+
gem 'bundler'
|
|
25
|
+
gem 'byebug'
|
|
26
|
+
gem 'capybara'
|
|
27
|
+
gem 'danger-changelog'
|
|
28
|
+
gem 'danger-pr-comment'
|
|
29
|
+
gem 'danger-toc'
|
|
30
|
+
gem 'fabrication'
|
|
31
|
+
gem 'faker'
|
|
32
|
+
gem 'faraday'
|
|
33
|
+
gem 'faraday-rack'
|
|
34
|
+
gem 'grape', ENV.fetch('GRAPE_VERSION', '>= 0')
|
|
35
|
+
gem 'hyperclient'
|
|
36
|
+
gem 'json', ENV.fetch('JSON_VERSION', '>= 0')
|
|
37
|
+
gem 'mutex_m'
|
|
38
|
+
gem 'rack'
|
|
39
|
+
gem 'rack-server-pages'
|
|
40
|
+
gem 'rack-test'
|
|
41
|
+
gem 'rackup'
|
|
42
|
+
gem 'rake'
|
|
43
|
+
gem 'rspec'
|
|
44
|
+
gem 'rubocop'
|
|
45
|
+
gem 'selenium-webdriver'
|
|
46
|
+
gem 'vcr'
|
|
47
|
+
gem 'webmock'
|
|
48
|
+
gem 'webrick'
|
data/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2015-
|
|
3
|
+
Copyright (c) 2015-2025 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
|
@@ -2,7 +2,6 @@ Slack Ruby Bot Server
|
|
|
2
2
|
=====================
|
|
3
3
|
|
|
4
4
|
[](https://badge.fury.io/rb/slack-ruby-bot-server)
|
|
5
|
-
[](https://codeclimate.com/github/slack-ruby/slack-ruby-bot-server)
|
|
6
5
|
[](https://github.com/slack-ruby/slack-ruby-bot-server/actions/workflows/test-mongodb.yml)
|
|
7
6
|
[](https://github.com/slack-ruby/slack-ruby-bot-server/actions/workflows/test-postgresql.yml)
|
|
8
7
|
[](https://github.com/slack-ruby/slack-ruby-bot-server/actions/workflows/rubocop.yml)
|
|
@@ -30,17 +29,15 @@ Build a complete Slack bot service with Slack button integration, in Ruby.
|
|
|
30
29
|
- [HTML Templates](#html-templates)
|
|
31
30
|
- [Access Tokens](#access-tokens)
|
|
32
31
|
- [Sample Bots Using Slack Ruby Bot Server](#sample-bots-using-slack-ruby-bot-server)
|
|
33
|
-
- [Slack Bots with Granular Permissions](#slack-bots-with-granular-permissions)
|
|
34
|
-
- [Legacy Slack Bots](#legacy-slack-bots)
|
|
35
32
|
- [Copyright & License](#copyright--license)
|
|
36
33
|
|
|
37
34
|
## What is this?
|
|
38
35
|
|
|
39
|
-
A library that contains a web server and a RESTful [Grape](http://github.com/ruby-grape/grape) API serving a Slack bot to multiple teams. Use in conjunction with [slack-ruby-bot-server-events](https://github.com/slack-ruby/slack-ruby-bot-server-events) to build a complete Slack bot service
|
|
36
|
+
A library that contains a web server and a RESTful [Grape](http://github.com/ruby-grape/grape) API serving a Slack bot to multiple teams. Use in conjunction with [slack-ruby-bot-server-events](https://github.com/slack-ruby/slack-ruby-bot-server-events) to build a complete Slack bot service. Your customers can use a Slack button to install the bot.
|
|
40
37
|
|
|
41
38
|
## Stable Release
|
|
42
39
|
|
|
43
|
-
You're reading the documentation for the **stable** release of slack-ruby-bot-server, 2.
|
|
40
|
+
You're reading the documentation for the **stable** release of slack-ruby-bot-server, 2.2.1. See [UPGRADING](UPGRADING.md) when upgrading from an older version. See [MIGRATING](MIGRATING.md) for help with migrating Legacy Slack Apps to Granular Scopes.
|
|
44
41
|
|
|
45
42
|
## Make Your Own
|
|
46
43
|
|
|
@@ -278,7 +275,6 @@ A number of extensions use service manager callbacks and service timers to imple
|
|
|
278
275
|
* [slack-ruby-bot-server-events](https://github.com/slack-ruby/slack-ruby-bot-server-events): Easily handle Slack slash commands, interactive buttons and events.
|
|
279
276
|
* [slack-ruby-bot-server-mailchimp](https://github.com/slack-ruby/slack-ruby-bot-server-mailchimp): Subscribes new bot users to a Mailchimp mailing list.
|
|
280
277
|
* [slack-ruby-bot-server-stripe](https://github.com/slack-ruby/slack-ruby-bot-server-stripe): Enables paid bots with trial periods and commerce through Stripe.
|
|
281
|
-
* [slack-ruby-bot-server-rtm](https://github.com/slack-ruby/slack-ruby-bot-server-rtm): Create RTM Slack bots.
|
|
282
278
|
|
|
283
279
|
#### Service Class
|
|
284
280
|
|
|
@@ -317,24 +313,13 @@ By default the implementation of [Team](lib/slack-ruby-bot-server/models/team) s
|
|
|
317
313
|
|
|
318
314
|
## Sample Bots Using Slack Ruby Bot Server
|
|
319
315
|
|
|
320
|
-
### Slack Bots with Granular Permissions
|
|
321
|
-
|
|
322
316
|
* [slack-ruby-bot-server-events-sample](https://github.com/slack-ruby/slack-ruby-bot-server-events-sample), a generic sample
|
|
323
317
|
* [slack-rails-bot-starter](https://github.com/CrazyOptimist/slack-rails-bot-starter), an all-in-one Rails starter kit
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
* [slack-ruby-bot-server-sample](https://github.com/slack-ruby/slack-ruby-bot-server-sample), a generic sample
|
|
328
|
-
* [slack-sup](https://github.com/dblock/slack-sup), see [sup.playplay.io](https://sup.playplay.io)
|
|
329
|
-
* [slack-gamebot](https://github.com/dblock/slack-gamebot), see [www.playplay.io](https://www.playplay.io)
|
|
330
|
-
* [slack-market](https://github.com/dblock/slack-market), see [market.playplay.io](https://market.playplay.io)
|
|
331
|
-
* [slack-shellbot](https://github.com/slack-ruby/slack-shellbot), see [shell.playplay.io](https://shell.playplay.io)
|
|
332
|
-
* [slack-api-explorer](https://github.com/slack-ruby/slack-api-explorer), see [api-explorer.playplay.io](https://shell.playplay.io)
|
|
333
|
-
* [slack-strava](https://github.com/dblock/slack-strava), see [slava.playplay.io](https://slava.playplay.io)
|
|
334
|
-
* [slack-arena](https://github.com/dblock/slack-arena), see [arena.playplay.io](https://arena.playplay.io)
|
|
335
|
-
|
|
318
|
+
* [slack-sup2](https://github.com/dblock/slack-sup2), see [sup2.playplay.io](https://sup2.playplay.io)
|
|
319
|
+
* [slack-gamebot2](https://github.com/dblock/slack-gamebot2), see [gamebot2.playplay.io](https://gamebot2.playplay.io)
|
|
320
|
+
|
|
336
321
|
## Copyright & License
|
|
337
322
|
|
|
338
|
-
Copyright [Daniel Doubrovkine](http://code.dblock.org) and Contributors, 2015-
|
|
323
|
+
Copyright [Daniel Doubrovkine](http://code.dblock.org) and Contributors, 2015-2025
|
|
339
324
|
|
|
340
325
|
[MIT License](LICENSE)
|
data/RELEASING.md
CHANGED
|
@@ -4,19 +4,25 @@ There're no hard rules about when to release slack-ruby-bot-server. Release bug
|
|
|
4
4
|
|
|
5
5
|
### Release
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Start from a clean, up-to-date canonical checkout on `master`. Confirm that the version in `lib/slack-ruby-bot-server/version.rb` matches the next changelog heading and has not already been published on RubyGems or tagged in Git.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Run the tests against dedicated local test databases as described in [CONTRIBUTING.md](CONTRIBUTING.md). Set the adapter and version selectors before installing dependencies. For example, with Ruby 4 and MongoDB running locally:
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
export DATABASE_ADAPTER=mongoid MONGOID_VERSION='~> 9.1' GRAPE_VERSION='~> 4.0' JSON_VERSION='~> 3.0'
|
|
13
|
+
export DATABASE_URL=mongodb://localhost/slack_ruby_bot_server_test
|
|
10
14
|
bundle install
|
|
11
|
-
rake
|
|
15
|
+
bundle exec rake
|
|
12
16
|
```
|
|
13
17
|
|
|
14
|
-
|
|
18
|
+
Also validate the Active Record adapter with its own test database. Do not run adapter suites concurrently on one host; browser tests share port 9293. Never use a production database.
|
|
19
|
+
|
|
20
|
+
Check that [GitHub Actions](https://github.com/slack-ruby/slack-ruby-bot-server/actions) succeeded for the release commit across both database matrices and RuboCop. A successful build for a different commit is not sufficient.
|
|
15
21
|
|
|
16
22
|
Change "Next" in [CHANGELOG.md](CHANGELOG.md) to the current date.
|
|
17
23
|
|
|
18
24
|
```
|
|
19
|
-
### 2.
|
|
25
|
+
### 2.2.1 (2026/10/24)
|
|
20
26
|
```
|
|
21
27
|
|
|
22
28
|
Remove the line with "Your contribution here.", since there will be no more contributions to this release.
|
|
@@ -26,34 +32,36 @@ Change `**next**` in the "Stable Release" section in README that warns users tha
|
|
|
26
32
|
```
|
|
27
33
|
## Stable Release
|
|
28
34
|
|
|
29
|
-
You're reading the documentation for the **stable** release of slack-ruby-bot-server, 2.
|
|
35
|
+
You're reading the documentation for the **stable** release of slack-ruby-bot-server, 2.2.1. See [UPGRADING](UPGRADING.md) when upgrading from an older version. See [MIGRATING](MIGRATING.md) for help with migrating Legacy Slack Apps to Granular Scopes.
|
|
30
36
|
```
|
|
31
37
|
|
|
32
38
|
Commit your changes.
|
|
33
39
|
|
|
34
40
|
```
|
|
35
|
-
git add README.md CHANGELOG.md
|
|
36
|
-
git commit -m "Preparing for release, 2.
|
|
41
|
+
git add README.md CHANGELOG.md RELEASING.md
|
|
42
|
+
git commit -m "Preparing for release, 2.2.1."
|
|
37
43
|
git push origin master
|
|
38
44
|
```
|
|
39
45
|
|
|
40
|
-
|
|
46
|
+
Wait for the release commit's GitHub Actions checks to succeed before publishing.
|
|
41
47
|
|
|
42
|
-
|
|
43
|
-
|
|
48
|
+
RubyGems publishing requires a maintainer's credentials and may require a fresh one-time password (OTP). For an agent-assisted release, ask the maintainer for the OTP immediately before publishing, after tests, commits, and CI are complete. Use it only for the publishing process; never put OTPs or API keys in committed files, release notes, or logs.
|
|
49
|
+
|
|
50
|
+
Pass the temporary code through `GEM_HOST_OTP_CODE`. With `OTP` holding the freshly supplied code:
|
|
44
51
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
Pushed slack-ruby-bot-server 2.0.1 to rubygems.org.
|
|
52
|
+
```sh
|
|
53
|
+
GEM_HOST_OTP_CODE="$OTP" bundle exec rake release
|
|
54
|
+
unset OTP
|
|
49
55
|
```
|
|
50
56
|
|
|
57
|
+
The release task builds the gem in `pkg/`, tags the release, pushes commits and the tag, and publishes to RubyGems. Confirm that the remote tag points to the release commit and that RubyGems lists the expected version before proceeding. If publishing fails, inspect which steps completed before retrying; do not move an existing release tag or overwrite a published version.
|
|
58
|
+
|
|
51
59
|
### Prepare for the Next Version
|
|
52
60
|
|
|
53
61
|
Add the next release to [CHANGELOG.md](CHANGELOG.md).
|
|
54
62
|
|
|
55
63
|
```
|
|
56
|
-
### 2.
|
|
64
|
+
### 2.2.2 (Next)
|
|
57
65
|
|
|
58
66
|
* Your contribution here.
|
|
59
67
|
```
|
|
@@ -65,13 +73,13 @@ Undo your change in README about the stable release.
|
|
|
65
73
|
```
|
|
66
74
|
## Stable Release
|
|
67
75
|
|
|
68
|
-
You're reading the documentation for the **next** release of slack-ruby-bot-server. Please see the documentation for the [last stable release, v2.
|
|
76
|
+
You're reading the documentation for the **next** release of slack-ruby-bot-server. Please see the documentation for the [last stable release, v2.2.1](https://github.com/slack-ruby/slack-ruby-bot-server/blob/v2.2.1/README.md) unless you're integrating with HEAD. See [UPGRADING](UPGRADING.md) when upgrading from an older version. See [MIGRATING](MIGRATING.md) for help with migrating Legacy Slack Apps to Granular Scopes.
|
|
69
77
|
```
|
|
70
78
|
|
|
71
79
|
Commit your changes.
|
|
72
80
|
|
|
73
81
|
```
|
|
74
82
|
git add README.md CHANGELOG.md lib/slack-ruby-bot-server/version.rb
|
|
75
|
-
git commit -m "Preparing for next development iteration, 2.
|
|
83
|
+
git commit -m "Preparing for next development iteration, 2.2.2."
|
|
76
84
|
git push origin master
|
|
77
85
|
```
|
data/Rakefile
CHANGED
|
@@ -5,7 +5,7 @@ require 'rspec/core'
|
|
|
5
5
|
require 'rspec/core/rake_task'
|
|
6
6
|
|
|
7
7
|
RSpec::Core::RakeTask.new(:spec) do |spec|
|
|
8
|
-
spec.pattern = FileList['spec/**/*_spec.rb'].exclude(%r{ext\/(?!#{ENV
|
|
8
|
+
spec.pattern = FileList['spec/**/*_spec.rb'].exclude(%r{ext\/(?!#{ENV.fetch('DATABASE_ADAPTER', nil)})})
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
require 'rubocop/rake_task'
|
data/UPGRADING.md
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
Upgrading Slack-Ruby-Bot-Server
|
|
2
2
|
===============================
|
|
3
3
|
|
|
4
|
+
### Upgrading to >= 2.2.0
|
|
5
|
+
|
|
6
|
+
#### Cursor Helper Iterator Changes
|
|
7
|
+
|
|
8
|
+
The mongoid [cursor helper](lib/slack-ruby-bot-server/api/helpers/cursor_helpers.rb) now requires `mongoid-scroll` 2.x, the second argument to `scroll` has changed. See mongoid-scroll [UPGRADING](https://github.com/mongoid/mongoid-scroll/blob/master/UPGRADING.md#upgrading-to--200) for more information.
|
|
9
|
+
|
|
4
10
|
### Upgrading to >= 2.0.0
|
|
5
11
|
|
|
6
12
|
#### Replaced Pagination Gem for ActiveRecord
|
|
@@ -41,8 +41,8 @@ module SlackRubyBotServer
|
|
|
41
41
|
raise 'Missing SLACK_CLIENT_ID or SLACK_CLIENT_SECRET.' unless ENV.key?('SLACK_CLIENT_ID') && ENV.key?('SLACK_CLIENT_SECRET')
|
|
42
42
|
|
|
43
43
|
options = {
|
|
44
|
-
client_id: ENV
|
|
45
|
-
client_secret: ENV
|
|
44
|
+
client_id: ENV.fetch('SLACK_CLIENT_ID', nil),
|
|
45
|
+
client_secret: ENV.fetch('SLACK_CLIENT_SECRET', nil),
|
|
46
46
|
code: params[:code]
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -16,9 +16,9 @@ module SlackRubyBotServer
|
|
|
16
16
|
coll = coll.skip(params[:offset].to_i) if params.key?(:offset)
|
|
17
17
|
size = (params[:size] || 10).to_i
|
|
18
18
|
coll = coll.limit(size)
|
|
19
|
-
coll.scroll(params[:cursor]) do |record,
|
|
19
|
+
coll.scroll(params[:cursor]) do |record, iterator|
|
|
20
20
|
results[:results] << record if record
|
|
21
|
-
results[:next] = next_cursor.to_s
|
|
21
|
+
results[:next] = iterator.next_cursor.to_s
|
|
22
22
|
break if results[:results].count >= size
|
|
23
23
|
end
|
|
24
24
|
results[:total_count] = coll.count if params[:total_count] && coll.respond_to?(:count)
|
|
@@ -10,42 +10,42 @@ module SlackRubyBotServer
|
|
|
10
10
|
Middleware.logger.error "#{e.class.name}: #{e.message}\n #{backtrace}"
|
|
11
11
|
error = { type: 'other_error', message: e.message }
|
|
12
12
|
error[:backtrace] = backtrace
|
|
13
|
-
|
|
13
|
+
error!(error, 400)
|
|
14
14
|
end
|
|
15
15
|
# rescue document validation errors into detail json
|
|
16
16
|
if SlackRubyBotServer::Config.mongoid?
|
|
17
17
|
rescue_from Mongoid::Errors::Validations do |e|
|
|
18
18
|
backtrace = e.backtrace[0..5].join("\n ")
|
|
19
19
|
Middleware.logger.warn "#{e.class.name}: #{e.message}\n #{backtrace}"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
error!({
|
|
21
|
+
type: 'param_error',
|
|
22
|
+
message: e.document.errors.full_messages.uniq.join(', ') + '.',
|
|
23
|
+
detail: e.document.errors.messages.each_with_object({}) do |(k, v), h|
|
|
24
|
+
h[k] = v.uniq
|
|
25
|
+
end
|
|
26
|
+
}, 400)
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
rescue_from Grape::Exceptions::Validation do |e|
|
|
30
30
|
backtrace = e.backtrace[0..5].join("\n ")
|
|
31
31
|
Middleware.logger.warn "#{e.class.name}: #{e.message}\n #{backtrace}"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
error!({
|
|
33
|
+
type: 'param_error',
|
|
34
|
+
message: 'Invalid parameters.',
|
|
35
|
+
detail: { e.params.join(', ') => [e.message] }
|
|
36
|
+
}, 400)
|
|
37
37
|
end
|
|
38
38
|
rescue_from Grape::Exceptions::ValidationErrors do |e|
|
|
39
39
|
backtrace = e.backtrace[0..5].join("\n ")
|
|
40
40
|
Middleware.logger.warn "#{e.class.name}: #{e.message}\n #{backtrace}"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
41
|
+
error!({
|
|
42
|
+
type: 'param_error',
|
|
43
|
+
message: 'Invalid parameters.',
|
|
44
|
+
detail: e.errors.each_with_object({}) do |(k, v), h|
|
|
45
|
+
# JSON does not permit having a key of type Array
|
|
46
|
+
h[k.count == 1 ? k.first : k.join(', ')] = v
|
|
47
|
+
end
|
|
48
|
+
}, 400)
|
|
49
49
|
end
|
|
50
50
|
end
|
|
51
51
|
end
|
|
@@ -13,7 +13,7 @@ module SlackRubyBotServer
|
|
|
13
13
|
supported_sort_orders = route_sort
|
|
14
14
|
error!("This API doesn't support sorting", 400) if supported_sort_orders.blank?
|
|
15
15
|
unless supported_sort_orders.include?(sort_order)
|
|
16
|
-
error!("Invalid sort order: #{sort_order}, must be#{supported_sort_orders.count == 1
|
|
16
|
+
error!("Invalid sort order: #{sort_order}, must be#{' one of' unless supported_sort_orders.count == 1} '#{supported_sort_orders.join("', '")}'", 400)
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
19
|
sort_order = sort_order.split(',').map do |sort_entry|
|
|
@@ -50,7 +50,8 @@ module SlackRubyBotServer
|
|
|
50
50
|
error!("Cannot sort #{coll.class.name}", 500)
|
|
51
51
|
end
|
|
52
52
|
end
|
|
53
|
-
coll = coll.is_a?(Module) && coll.respond_to?(:all)
|
|
53
|
+
coll = coll.all if coll.is_a?(Module) && coll.respond_to?(:all)
|
|
54
|
+
coll
|
|
54
55
|
end
|
|
55
56
|
end
|
|
56
57
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require 'rack/cors'
|
|
2
2
|
require 'rack-rewrite'
|
|
3
3
|
require 'rack-server-pages'
|
|
4
|
-
require 'otr-activerecord' if SlackRubyBotServer::Config.activerecord? && !defined?(
|
|
4
|
+
require 'otr-activerecord' if SlackRubyBotServer::Config.activerecord? && !defined?(Rails)
|
|
5
5
|
|
|
6
6
|
module SlackRubyBotServer
|
|
7
7
|
module Api
|
|
@@ -6,7 +6,12 @@ require 'pagy_cursor/pagy/extras/cursor'
|
|
|
6
6
|
module SlackRubyBotServer
|
|
7
7
|
module DatabaseAdapter
|
|
8
8
|
def self.check!
|
|
9
|
-
ActiveRecord::
|
|
9
|
+
if ActiveRecord.version >= Gem::Version.new('7.2')
|
|
10
|
+
ActiveRecord::Base.connection.database_exists?
|
|
11
|
+
else
|
|
12
|
+
ActiveRecord::Base.connection_pool.with_connection(&:active?)
|
|
13
|
+
end
|
|
14
|
+
|
|
10
15
|
raise 'Unexpected error.' unless ActiveRecord::Base.connected?
|
|
11
16
|
rescue StandardError => e
|
|
12
17
|
warn "Error connecting to PostgreSQL: #{e.message}"
|
|
@@ -33,4 +38,4 @@ module SlackRubyBotServer
|
|
|
33
38
|
end
|
|
34
39
|
end
|
|
35
40
|
|
|
36
|
-
|
|
41
|
+
Boolean = Grape::API::Boolean
|
|
@@ -78,8 +78,8 @@ module SlackRubyBotServer
|
|
|
78
78
|
start_intervals!
|
|
79
79
|
end
|
|
80
80
|
|
|
81
|
-
def start_intervals!
|
|
82
|
-
::Async::Reactor.run do
|
|
81
|
+
def start_intervals!(&_block)
|
|
82
|
+
::Async::Reactor.run do |task|
|
|
83
83
|
@intervals.each_pair do |period, calls_with_options|
|
|
84
84
|
calls_with_options.each do |call_with_options|
|
|
85
85
|
call, options = *call_with_options
|
|
@@ -88,6 +88,7 @@ module SlackRubyBotServer
|
|
|
88
88
|
end
|
|
89
89
|
end
|
|
90
90
|
end
|
|
91
|
+
yield task if block_given?
|
|
91
92
|
end
|
|
92
93
|
end
|
|
93
94
|
|
|
@@ -20,8 +20,10 @@ Gem::Specification.new do |spec|
|
|
|
20
20
|
spec.add_dependency 'grape-roar', '>= 0.4.0'
|
|
21
21
|
spec.add_dependency 'grape-swagger'
|
|
22
22
|
spec.add_dependency 'kaminari-grape'
|
|
23
|
+
spec.add_dependency 'logger'
|
|
23
24
|
spec.add_dependency 'rack-cors'
|
|
24
25
|
spec.add_dependency 'rack-rewrite'
|
|
25
26
|
spec.add_dependency 'rack-server-pages'
|
|
26
27
|
spec.add_dependency 'slack-ruby-client'
|
|
28
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
|
27
29
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: slack-ruby-bot-server
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel Doubrovkine
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: async
|
|
@@ -94,6 +93,20 @@ dependencies:
|
|
|
94
93
|
- - ">="
|
|
95
94
|
- !ruby/object:Gem::Version
|
|
96
95
|
version: '0'
|
|
96
|
+
- !ruby/object:Gem::Dependency
|
|
97
|
+
name: logger
|
|
98
|
+
requirement: !ruby/object:Gem::Requirement
|
|
99
|
+
requirements:
|
|
100
|
+
- - ">="
|
|
101
|
+
- !ruby/object:Gem::Version
|
|
102
|
+
version: '0'
|
|
103
|
+
type: :runtime
|
|
104
|
+
prerelease: false
|
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
106
|
+
requirements:
|
|
107
|
+
- - ">="
|
|
108
|
+
- !ruby/object:Gem::Version
|
|
109
|
+
version: '0'
|
|
97
110
|
- !ruby/object:Gem::Dependency
|
|
98
111
|
name: rack-cors
|
|
99
112
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -150,7 +163,6 @@ dependencies:
|
|
|
150
163
|
- - ">="
|
|
151
164
|
- !ruby/object:Gem::Version
|
|
152
165
|
version: '0'
|
|
153
|
-
description:
|
|
154
166
|
email:
|
|
155
167
|
- dblock@dblock.org
|
|
156
168
|
executables: []
|
|
@@ -158,6 +170,7 @@ extensions: []
|
|
|
158
170
|
extra_rdoc_files: []
|
|
159
171
|
files:
|
|
160
172
|
- ".github/FUNDING.yml"
|
|
173
|
+
- ".github/workflows/danger-comment.yml"
|
|
161
174
|
- ".github/workflows/danger.yml"
|
|
162
175
|
- ".github/workflows/rubocop.yml"
|
|
163
176
|
- ".github/workflows/test-mongodb.yml"
|
|
@@ -166,12 +179,12 @@ files:
|
|
|
166
179
|
- ".rspec"
|
|
167
180
|
- ".rubocop.yml"
|
|
168
181
|
- ".rubocop_todo.yml"
|
|
182
|
+
- AGENTS.md
|
|
169
183
|
- CHANGELOG.md
|
|
170
184
|
- CONTRIBUTING.md
|
|
171
185
|
- DEBUGGING.md
|
|
172
186
|
- Dangerfile
|
|
173
187
|
- Gemfile
|
|
174
|
-
- Gemfile.danger
|
|
175
188
|
- Guardfile
|
|
176
189
|
- LICENSE
|
|
177
190
|
- MIGRATING.md
|
|
@@ -229,8 +242,8 @@ files:
|
|
|
229
242
|
- tasks/db.rake
|
|
230
243
|
homepage: https://github.com/slack-ruby/slack-ruby-bot-server
|
|
231
244
|
licenses: []
|
|
232
|
-
metadata:
|
|
233
|
-
|
|
245
|
+
metadata:
|
|
246
|
+
rubygems_mfa_required: 'true'
|
|
234
247
|
rdoc_options: []
|
|
235
248
|
require_paths:
|
|
236
249
|
- lib
|
|
@@ -245,8 +258,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
245
258
|
- !ruby/object:Gem::Version
|
|
246
259
|
version: '0'
|
|
247
260
|
requirements: []
|
|
248
|
-
rubygems_version:
|
|
249
|
-
signing_key:
|
|
261
|
+
rubygems_version: 4.0.20
|
|
250
262
|
specification_version: 4
|
|
251
263
|
summary: A Grape API serving a Slack bot to multiple teams.
|
|
252
264
|
test_files: []
|