slack-ruby-bot-server-rtm 0.1.1 → 0.3.0

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.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/.github/FUNDING.yml +1 -0
  3. data/.github/workflows/danger.yml +22 -0
  4. data/.github/workflows/rubocop.yml +16 -0
  5. data/.github/workflows/test-mongodb.yml +25 -0
  6. data/.github/workflows/test-postgresql.yml +33 -0
  7. data/.rubocop.yml +6 -0
  8. data/.rubocop_todo.yml +93 -3
  9. data/CHANGELOG.md +8 -0
  10. data/Gemfile +12 -13
  11. data/Gemfile.danger +6 -0
  12. data/LICENSE +1 -1
  13. data/README.md +16 -3
  14. data/Rakefile +1 -1
  15. data/lib/slack-ruby-bot-server-rtm/lifecycle.rb +3 -1
  16. data/lib/slack-ruby-bot-server-rtm/server.rb +8 -4
  17. data/lib/slack-ruby-bot-server-rtm/version.rb +1 -1
  18. data/sample_apps/sample_app_activerecord/Gemfile +5 -3
  19. data/sample_apps/sample_app_activerecord/config/postgresql.yml +1 -0
  20. data/sample_apps/sample_app_activerecord/config.ru +2 -2
  21. data/sample_apps/sample_app_activerecord/db/migrate/20201125164500_add_oauth_fields.rb +8 -0
  22. data/sample_apps/sample_app_activerecord/db/schema.rb +19 -19
  23. data/sample_apps/sample_app_activerecord/spec/commands/help_spec.rb +1 -0
  24. data/sample_apps/sample_app_activerecord/spec/commands/whoami_spec.rb +1 -0
  25. data/sample_apps/sample_app_activerecord/spec/spec_helper.rb +5 -2
  26. data/sample_apps/sample_app_mongoid/Gemfile +1 -1
  27. data/sample_apps/sample_app_mongoid/config.ru +1 -1
  28. data/sample_apps/sample_app_mongoid/spec/commands/help_spec.rb +1 -0
  29. data/sample_apps/sample_app_mongoid/spec/commands/whoami_spec.rb +1 -0
  30. data/sample_apps/sample_app_mongoid/spec/spec_helper.rb +4 -11
  31. data/slack-ruby-bot-server-rtm.gemspec +3 -0
  32. metadata +40 -5
  33. data/.travis.yml +0 -21
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5824cb54023d4ee24f318fe9b455cd4ccc3b450ecaec0ccc893223517e823d87
4
- data.tar.gz: aca8db91d16aeb611f25bb0784deab2072fbcb777c32b155c6fa8a9bdf8afb31
3
+ metadata.gz: 78d6daeb5434320ef18ee8f51c896c95da6ae1bfa98a0a84c8605b46664d66e2
4
+ data.tar.gz: cffe4d958aa81c54ac1fbc55ed77b4597471ed9b9342bf99b962094fd5cd6a11
5
5
  SHA512:
6
- metadata.gz: 9ab696238cbe2b831efc55fc705d3b4d2e06b5e4594fbd5a2694b1bfb4faf8a3415b7292ffdf3bd223ef880f465e7ad6d29137920d6190976a214ec727ea284c
7
- data.tar.gz: a84c2a77ee1007efeee7114145d539ba8183b43ca38b4650ca5c0a6f422826a973c4b75e47ecb47347e36b46bb014cf1fb4c70948ec6125b690145487db1cb28
6
+ metadata.gz: 59f32b7e6545c37b2842486304daf75b292191e48c2eb62b926e3052a2873119d23b738357cc3ab3f6539a16a9bb50564354075fa3371eb1f099807e5eafda78
7
+ data.tar.gz: 115ce55cbe9dfa4d2f231b2c308bac50b1928050f9746424bd1dec025da0f347fab4650c01710cbedb8660927e0659d63bef550b1477d0d9c7c62c32474f5ff3
@@ -0,0 +1 @@
1
+ github: [dblock]
@@ -0,0 +1,22 @@
1
+ ---
2
+ name: danger
3
+ on: [pull_request]
4
+ jobs:
5
+ danger:
6
+ runs-on: ubuntu-latest
7
+ env:
8
+ BUNDLE_GEMFILE: Gemfile.danger
9
+ steps:
10
+ - uses: actions/checkout@v2
11
+ with:
12
+ fetch-depth: 0
13
+ - name: Set up Ruby
14
+ uses: ruby/setup-ruby@v1
15
+ with:
16
+ ruby-version: '2.7'
17
+ bundler-cache: true
18
+ - name: Run Danger
19
+ run: |
20
+ # the personal token is public, this is ok, base64 encode to avoid tripping Github
21
+ TOKEN=$(echo -n Z2hwX0xNQ3VmanBFeTBvYkZVTWh6NVNqVFFBOEUxU25abzBqRUVuaAo= | base64 --decode)
22
+ DANGER_GITHUB_API_TOKEN=$TOKEN bundle exec danger --verbose
@@ -0,0 +1,16 @@
1
+ ---
2
+ name: lint
3
+ on: [push, pull_request]
4
+ jobs:
5
+ lint:
6
+ name: RuboCop
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - uses: actions/checkout@v3
10
+ - name: Set up Ruby
11
+ uses: ruby/setup-ruby@v1
12
+ with:
13
+ ruby-version: '3.4'
14
+ bundler-cache: true
15
+ - name: Run RuboCop
16
+ run: bundle exec rubocop
@@ -0,0 +1,25 @@
1
+ ---
2
+ name: test-mongodb
3
+ on: [push, pull_request]
4
+ jobs:
5
+ test:
6
+ runs-on: ubuntu-latest
7
+ name: test
8
+ env:
9
+ DATABASE_ADAPTER: mongoid
10
+ steps:
11
+ - uses: actions/checkout@v2
12
+ - uses: ruby/setup-ruby@v1
13
+ with:
14
+ ruby-version: '3.4'
15
+ bundler-cache: true
16
+ - uses: supercharge/mongodb-github-action@1.7.0
17
+ with:
18
+ mongodb-version: '8.0'
19
+ - run: bundle exec rake spec
20
+ - working-directory: sample_apps/sample_app_mongoid
21
+ env:
22
+ RACK_ENV: test
23
+ run: |
24
+ bundle install
25
+ bundle exec rake
@@ -0,0 +1,33 @@
1
+ ---
2
+ name: test-postgresql
3
+ on: [push, pull_request]
4
+ jobs:
5
+ test:
6
+ runs-on: ubuntu-latest
7
+ name: test
8
+ services:
9
+ postgres:
10
+ image: postgres:17
11
+ env:
12
+ POSTGRES_USER: test
13
+ POSTGRES_PASSWORD: password
14
+ POSTGRES_DB: slack_ruby_bot_server_slack_test
15
+ ports:
16
+ - 5432:5432
17
+ options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
18
+ env:
19
+ DATABASE_ADAPTER: activerecord
20
+ DATABASE_URL: postgres://test:password@localhost/slack_ruby_bot_server_slack_test
21
+ RACK_ENV: test
22
+ steps:
23
+ - uses: actions/checkout@v2
24
+ - uses: ruby/setup-ruby@v1
25
+ with:
26
+ ruby-version: '3.4'
27
+ bundler-cache: true
28
+ - run: bundle exec rake spec
29
+ - working-directory: sample_apps/sample_app_activerecord
30
+ run: |
31
+ bundle install
32
+ bundle exec rake
33
+
data/.rubocop.yml CHANGED
@@ -1,3 +1,6 @@
1
+ AllCops:
2
+ NewCops: enable
3
+
1
4
  Metrics:
2
5
  Enabled: false
3
6
 
@@ -13,3 +16,6 @@ Style/ModuleFunction:
13
16
 
14
17
  inherit_from: .rubocop_todo.yml
15
18
 
19
+ plugins:
20
+ - rubocop-rake
21
+ - rubocop-rspec
data/.rubocop_todo.yml CHANGED
@@ -1,11 +1,23 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2020-11-14 17:59:41 -0500 using RuboCop version 0.81.0.
3
+ # on 2025-09-29 13:15:53 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
+ # Offense count: 1
10
+ # Configuration parameters: Severity.
11
+ Gemspec/RequiredRubyVersion:
12
+ Exclude:
13
+ - 'slack-ruby-bot-server-rtm.gemspec'
14
+
15
+ # Offense count: 1
16
+ # Configuration parameters: AllowComments, AllowEmptyLambdas.
17
+ Lint/EmptyBlock:
18
+ Exclude:
19
+ - 'spec/slack-ruby-bot-server-rtm/config_spec.rb'
20
+
9
21
  # Offense count: 1
10
22
  # Configuration parameters: IgnoreImplicitReferences.
11
23
  Lint/ShadowedArgument:
@@ -13,17 +25,95 @@ Lint/ShadowedArgument:
13
25
  - 'lib/slack-ruby-bot-server-rtm/lifecycle.rb'
14
26
 
15
27
  # Offense count: 2
16
- # Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
28
+ # Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms.
29
+ # CheckDefinitionPathHierarchyRoots: lib, spec, test, src
17
30
  # 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
18
31
  Naming/FileName:
19
32
  Exclude:
33
+ - 'Rakefile.rb'
20
34
  - 'lib/slack-ruby-bot-server-rtm.rb'
21
35
  - 'lib/slack-ruby-bot-server-rtm/ext/slack-ruby-bot.rb'
22
36
 
23
37
  # Offense count: 2
24
38
  # Configuration parameters: ForbiddenDelimiters.
25
- # ForbiddenDelimiters: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$))
39
+ # ForbiddenDelimiters: (?i-mx:(^|\s)(EO[A-Z]{1}|END)(\s|$))
26
40
  Naming/HeredocDelimiterNaming:
27
41
  Exclude:
28
42
  - 'sample_apps/sample_app_activerecord/commands/help.rb'
29
43
  - 'sample_apps/sample_app_mongoid/commands/help.rb'
44
+
45
+ # Offense count: 2
46
+ RSpec/AnyInstance:
47
+ Exclude:
48
+ - 'spec/slack-ruby-bot-server-rtm/lifecycle_spec.rb'
49
+
50
+ # Offense count: 7
51
+ # Configuration parameters: Prefixes, AllowedPatterns.
52
+ # Prefixes: when, with, without
53
+ RSpec/ContextWording:
54
+ Exclude:
55
+ - 'sample_apps/sample_app_activerecord/spec/commands/whoami_spec.rb'
56
+ - 'sample_apps/sample_app_mongoid/spec/commands/whoami_spec.rb'
57
+ - 'spec/slack-ruby-bot-server-rtm/lifecycle_spec.rb'
58
+ - 'spec/slack-ruby-bot-server-rtm/server_spec.rb'
59
+
60
+ # Offense count: 1
61
+ # This cop supports unsafe autocorrection (--autocorrect-all).
62
+ # Configuration parameters: SkipBlocks, EnforcedStyle, OnlyStaticConstants.
63
+ # SupportedStyles: described_class, explicit
64
+ RSpec/DescribedClass:
65
+ Exclude:
66
+ - 'spec/slack-ruby-bot-server-rtm/server_spec.rb'
67
+
68
+ # Offense count: 1
69
+ # This cop supports unsafe autocorrection (--autocorrect-all).
70
+ RSpec/EmptyExampleGroup:
71
+ Exclude:
72
+ - 'spec/slack-ruby-bot-server-rtm/config_spec.rb'
73
+
74
+ # Offense count: 7
75
+ # Configuration parameters: .
76
+ # SupportedStyles: have_received, receive
77
+ RSpec/MessageSpies:
78
+ EnforcedStyle: receive
79
+
80
+ # Offense count: 5
81
+ RSpec/MultipleExpectations:
82
+ Max: 2
83
+
84
+ # Offense count: 4
85
+ # Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
86
+ # SupportedStyles: always, named_only
87
+ RSpec/NamedSubject:
88
+ Exclude:
89
+ - 'spec/slack-ruby-bot-server-rtm/server_spec.rb'
90
+
91
+ # Offense count: 4
92
+ # Configuration parameters: CustomTransform, IgnoreMethods, IgnoreMetadata.
93
+ RSpec/SpecFilePathFormat:
94
+ Exclude:
95
+ - '**/spec/routing/**/*'
96
+ - 'spec/slack-ruby-bot-server-rtm/config_spec.rb'
97
+ - 'spec/slack-ruby-bot-server-rtm/lifecycle_spec.rb'
98
+ - 'spec/slack-ruby-bot-server-rtm/server_spec.rb'
99
+ - 'spec/slack-ruby-bot-server-rtm/version_spec.rb'
100
+
101
+ # Offense count: 1
102
+ RSpec/SubjectStub:
103
+ Exclude:
104
+ - 'spec/slack-ruby-bot-server-rtm/server_spec.rb'
105
+
106
+ # Offense count: 1
107
+ # This cop supports unsafe autocorrection (--autocorrect-all).
108
+ # Configuration parameters: EnforcedStyle.
109
+ # SupportedStyles: always, always_true, never
110
+ Style/FrozenStringLiteralComment:
111
+ Exclude:
112
+ - '**/*.arb'
113
+ - 'sample_apps/sample_app_activerecord/db/schema.rb'
114
+
115
+ # Offense count: 1
116
+ # This cop supports unsafe autocorrection (--autocorrect-all).
117
+ Style/GlobalStdStream:
118
+ Exclude:
119
+ - 'spec/database_adapters/activerecord/activerecord.rb'
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  ### Changelog
2
2
 
3
+ #### 0.3.0 (2025/09/29)
4
+
5
+ * [#2](https://github.com/slack-ruby/slack-ruby-bot-server-rtm/pull/2): Replace Travis-CI with GHA - [@dblock](https://github.com/dblock).
6
+
7
+ #### 0.2.0 (2020/11/27)
8
+
9
+ * [#1](https://github.com/slack-ruby/slack-ruby-bot-server-rtm/pull/1): Only start OAuth v1 teams with a bot token - [@dblock](https://github.com/dblock).
10
+
3
11
  #### 0.1.1 (2020/11/15)
4
12
 
5
13
  * Fix: error `private method 'run_callbacks' called for #<SlackRubyBotServer::Service>` - [@dblock](https://github.com/dblock).
data/Gemfile CHANGED
@@ -2,21 +2,22 @@
2
2
 
3
3
  source 'https://rubygems.org'
4
4
 
5
- case ENV['DATABASE_ADAPTER']
6
- when 'mongoid' then
5
+ case ENV.fetch('DATABASE_ADAPTER', nil)
6
+ when 'mongoid'
7
7
  gem 'kaminari-mongoid'
8
8
  gem 'mongoid'
9
9
  gem 'mongoid-scroll'
10
- when 'activerecord' then
11
- gem 'activerecord', '~> 5.0.0'
12
- gem 'otr-activerecord', '~> 1.2.1'
13
- gem 'virtus'
14
- gem 'cursor_pagination' # rubocop:disable Bundler/OrderedGems
10
+ when 'activerecord'
11
+ gem 'activerecord'
12
+ gem 'mutex_m'
13
+ gem 'otr-activerecord'
14
+ gem 'pagy_cursor'
15
15
  gem 'pg'
16
+ gem 'virtus'
16
17
  when nil
17
18
  warn "Missing ENV['DATABASE_ADAPTER']."
18
19
  else
19
- warn "Invalid ENV['DATABASE_ADAPTER']: #{ENV['DATABASE_ADAPTER']}."
20
+ warn "Invalid ENV['DATABASE_ADAPTER']: #{ENV.fetch('DATABASE_ADAPTER', nil)}."
20
21
  end
21
22
 
22
23
  gemspec
@@ -30,11 +31,9 @@ group :development, :test do
30
31
  gem 'rack-test'
31
32
  gem 'rake'
32
33
  gem 'rspec'
33
- gem 'rubocop', '0.81.0'
34
+ gem 'rubocop', '1.81.1'
35
+ gem 'rubocop-rake'
36
+ gem 'rubocop-rspec'
34
37
  gem 'vcr'
35
38
  gem 'webmock'
36
39
  end
37
-
38
- group :test do
39
- gem 'slack-ruby-danger', '~> 0.2.0', require: false
40
- end
data/Gemfile.danger ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ group :test do
4
+ gem 'danger-toc', '~> 0.2.0', require: false
5
+ gem 'slack-ruby-danger', '~> 0.2.0', require: false
6
+ end
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2020 Daniel Doubrovkine & Contributors
3
+ Copyright (c) 2020-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,9 +2,22 @@ Slack Ruby Bot Server RealTime (RTM) Extension
2
2
  ==============================================
3
3
 
4
4
  [![Gem Version](https://badge.fury.io/rb/slack-ruby-bot-server-rtm.svg)](https://badge.fury.io/rb/slack-ruby-bot-server-rtm)
5
- [![Build Status](https://travis-ci.org/slack-ruby/slack-ruby-bot-server-rtm.svg?branch=master)](https://travis-ci.org/slack-ruby/slack-ruby-bot-server-rtm)
5
+ [![test-postgresql](https://github.com/slack-ruby/slack-ruby-bot-server-rtm/actions/workflows/test-postgresql.yml/badge.svg)](https://github.com/slack-ruby/slack-ruby-bot-server-rtm/actions/workflows/test-postgresql.yml)
6
+ [![test-mongodb](https://github.com/slack-ruby/slack-ruby-bot-server-rtm/actions/workflows/test-mongodb.yml/badge.svg)](https://github.com/slack-ruby/slack-ruby-bot-server-rtm/actions/workflows/test-mongodb.yml)
6
7
 
7
- An extension to [slack-ruby-bot-server](https://github.com/slack-ruby/slack-ruby-bot-server) that makes it easy to implement Slack RTM bots.
8
+ # Table of Contents
9
+
10
+ - [Introduction](#introduction)
11
+ - [Samples](#samples)
12
+ - [Usage](#usage)
13
+ - [Gemfile](#gemfile)
14
+ - [Configure](#configure)
15
+ - [Server Class](#server-class)
16
+ - [Copyright & License](#copyright--license)
17
+
18
+ ### Introduction
19
+
20
+ This library is an extension to [slack-ruby-bot-server](https://github.com/slack-ruby/slack-ruby-bot-server) that makes it easy to implement Slack RTM bots.
8
21
 
9
22
  ### Samples
10
23
 
@@ -56,6 +69,6 @@ end
56
69
 
57
70
  ### Copyright & License
58
71
 
59
- Copyright [Daniel Doubrovkine](http://code.dblock.org) and Contributors, 2020
72
+ Copyright [Daniel Doubrovkine](http://code.dblock.org) and Contributors, 2020-2025
60
73
 
61
74
  [MIT License](LICENSE)
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ require 'rspec/core'
7
7
  require 'rspec/core/rake_task'
8
8
 
9
9
  RSpec::Core::RakeTask.new(:spec) do |spec|
10
- spec.pattern = FileList['spec/**/*_spec.rb'].exclude(%r{ext\/(?!#{ENV['DATABASE_ADAPTER']})})
10
+ spec.pattern = FileList['spec/**/*_spec.rb'].exclude(%r{ext/(?!#{ENV.fetch('DATABASE_ADAPTER', nil)})})
11
11
  end
12
12
 
13
13
  require 'rubocop/rake_task'
@@ -5,6 +5,8 @@ SlackRubyBotServer.configure do |config|
5
5
  end
6
6
 
7
7
  SlackRubyBotServer::Config.service_class.instance.on :starting do |team, _error, options|
8
+ next if team.respond_to?(:oauth_version) && team.oauth_version != 'v1'
9
+
8
10
  SlackRubyBotServer::Config.service_class.instance.logger.info "Starting real-time team #{team}."
9
11
  options = { team: team }
10
12
  server = SlackRubyBotServer::RealTime::Config.server_class.new(options)
@@ -26,6 +28,6 @@ SlackRubyBotServer::Config.service_class.instance.on :stopped do |team, _error,
26
28
  end
27
29
 
28
30
  SlackRubyBotServer::Config.service_class.instance.on :deactivated do |team, _error, _options|
29
- SlackRubyBotServer::Config.service_class.instance.logger.info "De-activating real-time team #{team}."
31
+ SlackRubyBotServer::Config.service_class.instance.logger.info "De-activated real-time team #{team}."
30
32
  team.server = nil
31
33
  end
@@ -13,7 +13,7 @@ module SlackRubyBotServer
13
13
  raise 'Missing team' unless @team
14
14
 
15
15
  attrs[:token] = @team.token
16
- super(attrs)
16
+ super
17
17
  open!
18
18
  end
19
19
 
@@ -23,9 +23,13 @@ module SlackRubyBotServer
23
23
  rescue StandardError => e
24
24
  SlackRubyBotServer::Config.service_class.instance.send(:run_callbacks, :error, team, e)
25
25
  case e.message
26
- when 'account_inactive', 'invalid_auth' then
27
- SlackRubyBotServer::Config.service_class.instance.logger.error "#{team.name}: #{e.message}, team will be deactivated."
28
- SlackRubyBotServer::Config.service_class.instance.deactivate! team
26
+ when 'account_inactive', 'invalid_auth'
27
+ if team.respond_to?(:oauth_version) && team.oauth_version != 'v1'
28
+ SlackRubyBotServer::Config.service_class.instance.logger.info "#{team.name}: #{e.message}, team OAuth scope has been upgraded."
29
+ else
30
+ SlackRubyBotServer::Config.service_class.instance.logger.error "#{team.name}: #{e.message}, team will be deactivated."
31
+ SlackRubyBotServer::Config.service_class.instance.deactivate! team
32
+ end
29
33
  else
30
34
  wait = e.retry_after if e.is_a?(Slack::Web::Api::Errors::TooManyRequestsError)
31
35
  SlackRubyBotServer::Config.service_class.instance.logger.error "#{team.name}: #{e.message}, restarting in #{wait} second(s)."
@@ -2,6 +2,6 @@
2
2
 
3
3
  module SlackRubyBotServer
4
4
  module RealTime
5
- VERSION = '0.1.1'
5
+ VERSION = '0.3.0'
6
6
  end
7
7
  end
@@ -2,9 +2,11 @@
2
2
 
3
3
  source 'https://rubygems.org'
4
4
 
5
- gem 'activerecord', '~> 5.0.0', require: 'active_record'
5
+ gem 'activerecord'
6
+ gem 'mutex_m'
6
7
  gem 'newrelic-slack-ruby-bot'
7
- gem 'otr-activerecord', '~> 1.2.1'
8
+ gem 'otr-activerecord'
9
+ gem 'pagy_cursor'
8
10
  gem 'pg'
9
11
  gem 'rack-server-pages'
10
12
  gem 'rack-test'
@@ -12,7 +14,7 @@ gem 'slack-ruby-bot-server-rtm', path: '../../'
12
14
  gem 'unicorn'
13
15
 
14
16
  group :development, :test do
15
- gem 'standalone_migrations', '~> 5.2'
17
+ gem 'standalone_migrations'
16
18
  end
17
19
 
18
20
  group :test do
@@ -11,6 +11,7 @@ development:
11
11
  test:
12
12
  <<: *default
13
13
  database: slack_ruby_bot_server_test
14
+ url: <%= ENV["DATABASE_URL"] || 'postgres://localhost/slack_ruby_bot_server_test' %>
14
15
 
15
16
  production:
16
17
  <<: *default
@@ -12,8 +12,8 @@ ActiveRecord::Base.establish_connection(
12
12
  YAML.safe_load(
13
13
  ERB.new(
14
14
  File.read('config/postgresql.yml')
15
- ).result, [], [], true
16
- )[ENV['RACK_ENV']]
15
+ ).result, aliases: true
16
+ )[ENV.fetch('RACK_ENV', nil)]
17
17
  )
18
18
 
19
19
  NewRelic::Agent.manual_start
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddOauthFields < ActiveRecord::Migration[5.0]
4
+ def change
5
+ add_column :teams, :oauth_scope, :string
6
+ add_column :teams, :oauth_version, :string, default: 'v1', null: false
7
+ end
8
+ end
@@ -1,31 +1,31 @@
1
- # frozen_string_literal: true
2
-
3
1
  # This file is auto-generated from the current state of the database. Instead
4
2
  # of editing this file, please use the migrations feature of Active Record to
5
3
  # incrementally modify your database, and then regenerate this schema definition.
6
4
  #
7
- # Note that this schema.rb definition is the authoritative source for your
8
- # database schema. If you need to create the application database on another
9
- # system, you should be using db:schema:load, not running all the migrations
10
- # from scratch. The latter is a flawed and unsustainable approach (the more migrations
11
- # you'll amass, the slower it'll run and the greater likelihood for issues).
5
+ # This file is the source Rails uses to define your schema when running `bin/rails
6
+ # db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
7
+ # be faster and is potentially less error prone than running all of your
8
+ # migrations from scratch. Old migrations may fail to apply correctly if those
9
+ # migrations use external dependencies or application code.
12
10
  #
13
11
  # It's strongly recommended that you check this file into your version control system.
14
12
 
15
- ActiveRecord::Schema.define(version: 20_190_323_181_453) do
13
+ ActiveRecord::Schema[8.0].define(version: 20_201_125_164_500) do
16
14
  # These are extensions that must be enabled in order to support this database
17
- enable_extension 'plpgsql'
15
+ enable_extension 'pg_catalog.plpgsql'
18
16
 
19
17
  create_table 'teams', force: :cascade do |t|
20
- t.string 'team_id'
21
- t.string 'name'
22
- t.boolean 'active', default: true
23
- t.string 'domain'
24
- t.string 'token'
25
- t.datetime 'created_at', null: false
26
- t.datetime 'updated_at', null: false
27
- t.string 'bot_user_id'
28
- t.string 'activated_user_id'
29
- t.string 'activated_user_access_token'
18
+ t.string 'team_id'
19
+ t.string 'name'
20
+ t.boolean 'active', default: true
21
+ t.string 'domain'
22
+ t.string 'token'
23
+ t.datetime 'created_at', null: false
24
+ t.datetime 'updated_at', null: false
25
+ t.string 'bot_user_id'
26
+ t.string 'activated_user_id'
27
+ t.string 'activated_user_access_token'
28
+ t.string 'oauth_scope'
29
+ t.string 'oauth_version', default: 'v1', null: false
30
30
  end
31
31
  end
@@ -8,6 +8,7 @@ describe Help do
8
8
  let(:app) { SlackRubyBotServer::RealTime::Server.new(team: team) }
9
9
  let(:client) { app.send(:client) }
10
10
  let(:message_hook) { SlackRubyBot::Hooks::Message.new }
11
+
11
12
  it 'default' do
12
13
  expect(client).to receive(:say).with(channel: 'channel', text: [Help::HELP, SlackRubyBotServer::INFO].join("\n"))
13
14
  expect(client).to receive(:say).with(channel: 'channel')
@@ -6,6 +6,7 @@ require 'commands/whoami'
6
6
  describe Whoami do
7
7
  let(:team) { Fabricate(:team) }
8
8
  let(:app) { SlackRubyBotServer::Server.new(team: team) }
9
+
9
10
  context 'whoami' do
10
11
  it 'returns username' do
11
12
  expect(message: "#{SlackRubyBot.config.user} whoami", channel: 'channel', user: 'user').to respond_with_slack_message(
@@ -6,14 +6,17 @@ ENV['RACK_ENV'] = 'test'
6
6
 
7
7
  require 'active_record'
8
8
  require 'database_cleaner'
9
+ require 'pagy_cursor'
9
10
  require 'slack-ruby-bot-server-rtm/rspec'
10
11
 
11
- db_config = YAML.safe_load(File.read(File.expand_path('../config/postgresql.yml', __dir__)), [], [], true)[ENV['RACK_ENV']]
12
+ yml = ERB.new(File.read(File.expand_path('../config/postgresql.yml', __dir__))).result
13
+ db_config = YAML.safe_load(yml, aliases: true)[ENV.fetch('RACK_ENV', nil)]
14
+
12
15
  ActiveRecord::Tasks::DatabaseTasks.create(db_config)
13
16
  ActiveRecord::Base.establish_connection(db_config)
14
17
 
15
18
  RSpec.configure do |config|
16
- config.around :each do |example|
19
+ config.around do |example|
17
20
  DatabaseCleaner.cleaning do
18
21
  example.run
19
22
  end
@@ -11,7 +11,7 @@ gem 'mongoid-scroll'
11
11
  gem 'unicorn'
12
12
 
13
13
  group :test do
14
- gem 'database_cleaner'
14
+ gem 'database_cleaner-mongoid'
15
15
  gem 'fabrication'
16
16
  gem 'faker'
17
17
  gem 'rack-test'
@@ -6,7 +6,7 @@ Bundler.require :default
6
6
 
7
7
  require_relative 'commands'
8
8
 
9
- Mongoid.load!(File.expand_path('config/mongoid.yml', __dir__), ENV['RACK_ENV'])
9
+ Mongoid.load!(File.expand_path('config/mongoid.yml', __dir__), ENV.fetch('RACK_ENV', nil))
10
10
 
11
11
  NewRelic::Agent.manual_start
12
12
 
@@ -8,6 +8,7 @@ describe Help do
8
8
  let(:app) { SlackRubyBotServer::RealTime::Server.new(team: team) }
9
9
  let(:client) { app.send(:client) }
10
10
  let(:message_hook) { SlackRubyBot::Hooks::Message.new }
11
+
11
12
  it 'default' do
12
13
  expect(client).to receive(:say).with(channel: 'channel', text: [Help::HELP, SlackRubyBotServer::INFO].join("\n"))
13
14
  expect(client).to receive(:say).with(channel: 'channel')
@@ -6,6 +6,7 @@ require 'commands/whoami'
6
6
  describe Whoami do
7
7
  let(:team) { Fabricate(:team) }
8
8
  let(:app) { SlackRubyBotServer::Server.new(team: team) }
9
+
9
10
  context 'whoami' do
10
11
  it 'returns username' do
11
12
  expect(message: "#{SlackRubyBot.config.user} whoami", channel: 'channel', user: 'user').to respond_with_slack_message(
@@ -5,25 +5,18 @@ $LOAD_PATH.unshift File.expand_path('..', __dir__)
5
5
  ENV['RACK_ENV'] = 'test'
6
6
 
7
7
  require 'mongoid'
8
- require 'database_cleaner'
8
+ require 'database_cleaner-mongoid'
9
9
  require 'slack-ruby-bot-server-rtm/rspec'
10
10
 
11
- Mongoid.load!(File.expand_path('../config/mongoid.yml', __dir__), ENV['RACK_ENV'])
11
+ Mongoid.load!(File.expand_path('../config/mongoid.yml', __dir__), ENV.fetch('RACK_ENV', nil))
12
12
 
13
13
  RSpec.configure do |config|
14
14
  config.before :suite do
15
- Mongo::Logger.logger.level = Logger::INFO
16
-
17
15
  Mongoid::Tasks::Database.create_indexes
16
+ DatabaseCleaner.start
18
17
  end
19
18
 
20
19
  config.after :suite do
21
- Mongoid.purge!
22
- end
23
-
24
- config.around :each do |example|
25
- DatabaseCleaner.cleaning do
26
- example.run
27
- end
20
+ DatabaseCleaner.clean
28
21
  end
29
22
  end
@@ -16,7 +16,10 @@ Gem::Specification.new do |spec|
16
16
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec)/}) }
17
17
  spec.require_paths = ['lib']
18
18
 
19
+ spec.add_dependency 'async', '<= 2.23.0'
19
20
  spec.add_dependency 'async-websocket', '~> 0.8.0'
20
21
  spec.add_dependency 'slack-ruby-bot', '>= 0.12.0'
21
22
  spec.add_dependency 'slack-ruby-bot-server', '>= 1.0.0'
23
+ spec.add_dependency 'slack-ruby-client', '< 3.0'
24
+ spec.metadata['rubygems_mfa_required'] = 'true'
22
25
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slack-ruby-bot-server-rtm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.3.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: 2020-11-15 00:00:00.000000000 Z
11
+ date: 2025-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: async
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "<="
18
+ - !ruby/object:Gem::Version
19
+ version: 2.23.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "<="
25
+ - !ruby/object:Gem::Version
26
+ version: 2.23.0
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: async-websocket
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +66,20 @@ dependencies:
52
66
  - - ">="
53
67
  - !ruby/object:Gem::Version
54
68
  version: 1.0.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: slack-ruby-client
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "<"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "<"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
55
83
  description:
56
84
  email:
57
85
  - dblock@dblock.org
@@ -59,15 +87,20 @@ executables: []
59
87
  extensions: []
60
88
  extra_rdoc_files: []
61
89
  files:
90
+ - ".github/FUNDING.yml"
91
+ - ".github/workflows/danger.yml"
92
+ - ".github/workflows/rubocop.yml"
93
+ - ".github/workflows/test-mongodb.yml"
94
+ - ".github/workflows/test-postgresql.yml"
62
95
  - ".gitignore"
63
96
  - ".rspec"
64
97
  - ".rubocop.yml"
65
98
  - ".rubocop_todo.yml"
66
- - ".travis.yml"
67
99
  - CHANGELOG.md
68
100
  - CONTRIBUTING.md
69
101
  - Dangerfile
70
102
  - Gemfile
103
+ - Gemfile.danger
71
104
  - LICENSE
72
105
  - README.md
73
106
  - RELEASING.md
@@ -96,6 +129,7 @@ files:
96
129
  - sample_apps/sample_app_activerecord/config/postgresql.yml
97
130
  - sample_apps/sample_app_activerecord/db/migrate/20170307164946_create_teams_table.rb
98
131
  - sample_apps/sample_app_activerecord/db/migrate/20190323181453_add_activated_fields.rb
132
+ - sample_apps/sample_app_activerecord/db/migrate/20201125164500_add_oauth_fields.rb
99
133
  - sample_apps/sample_app_activerecord/db/schema.rb
100
134
  - sample_apps/sample_app_activerecord/spec/api/root_spec.rb
101
135
  - sample_apps/sample_app_activerecord/spec/commands/help_spec.rb
@@ -119,7 +153,8 @@ files:
119
153
  - slack-ruby-bot-server-rtm.gemspec
120
154
  homepage: https://github.com/slack-ruby/slack-ruby-bot-server-rtm
121
155
  licenses: []
122
- metadata: {}
156
+ metadata:
157
+ rubygems_mfa_required: 'true'
123
158
  post_install_message:
124
159
  rdoc_options: []
125
160
  require_paths:
@@ -135,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
170
  - !ruby/object:Gem::Version
136
171
  version: '0'
137
172
  requirements: []
138
- rubygems_version: 3.1.3
173
+ rubygems_version: 3.5.16
139
174
  signing_key:
140
175
  specification_version: 4
141
176
  summary: Slack RTM bot extension for slack-ruby-bot-server.
data/.travis.yml DELETED
@@ -1,21 +0,0 @@
1
- language: ruby
2
-
3
- cache: bundler
4
-
5
- matrix:
6
- include:
7
- - rvm: 2.6.6
8
- script:
9
- - bundle exec danger
10
- - rvm: 2.6.6
11
- env: DATABASE_ADAPTER=activerecord
12
- services:
13
- - postgresql
14
- - rvm: 2.6.6
15
- env: DATABASE_ADAPTER=mongoid
16
- services:
17
- - mongodb
18
-
19
- script:
20
- - bundle exec rake
21
- - BUNDLE_GEMFILE=Gemfile && cd sample_apps/sample_app_$DATABASE_ADAPTER && bundle && RACK_ENV=test bundle exec rake