Skip to content

Commit

Permalink
Fix compatibility with Sidekiq 7, ActiveSupport 7, Ruby 3 (#349)
Browse files Browse the repository at this point in the history
* Fix compat with Sidekiq 7

* Update Changelog

* Fix bundle
  • Loading branch information
mgomes authored Nov 26, 2022
1 parent 3d39878 commit 04a6419
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 12 deletions.
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* [Logging] `primary_session`, `previous_session`, and `back_to_session` now explicitly logged
* [Sessions] The session is no longer set on update or stepping witht destination flow and state match the existing session.
* [Scheduled Replies] The `service_message.target_id` is now set for scheduled replies. NOTE: scheduled replies that are already enqueued will NOT have this set.
* [Server] Updated to Puma 5.5
* [Server] Updated to Sidekiq 6.3
* [Server] Updated to Sinatra 2.1
* [Server] Updated to Puma 6.x
* [Server] Updated to Sidekiq 7.x
* [Server] Updated to Sinatra 3.x
* [Sessions] Added `to_s` for sessions to pretty print the slug. Useful when debugging.
* `send_reples` now supports two additional options for replies:
`send_replies(custom_reply: 'hello/say_hello')`
Expand Down
5 changes: 4 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ PATH
activesupport (~> 7.0)
multi_json (~> 1.12)
puma (~> 6.0)
redis (~> 5.0)
sidekiq (~> 7.0)
sinatra (~> 2.0)
sinatra (>= 2, < 4)
thor (~> 1.0)
zeitwerk (~> 2.6)

Expand Down Expand Up @@ -38,6 +39,8 @@ GEM
rack
rack-test (2.0.2)
rack (>= 1.3)
redis (5.0.5)
redis-client (>= 0.9.0)
redis-client (0.11.2)
connection_pool
rspec (3.12.0)
Expand Down
7 changes: 5 additions & 2 deletions lib/stealth/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# base requirements
require 'yaml'
require 'sidekiq'
require 'redis'
require 'active_support/all'

begin
Expand Down Expand Up @@ -123,15 +124,17 @@ def self.load_environment

load_bot!

Sidekiq[:reloader] = Stealth.bot_reloader
Sidekiq.configure_server do |config|
config[:reloader] = Stealth.bot_reloader
end

if defined?(ActiveRecord)
if ENV['DATABASE_URL'].present?
ActiveRecord::Base.establish_connection(ENV['DATABASE_URL'])
else
database_config = File.read(File.join(Stealth.root, 'config', 'database.yml'))
ActiveRecord::Base.establish_connection(
YAML.load(ERB.new(database_config).result)[Stealth.env]
YAML.load(ERB.new(database_config).result, aliases: true)[Stealth.env]
)
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/stealth/generators/builder/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ source 'https://rubygems.org'

gem 'stealth', '~> 2.0'

gem 'railties', '~> 6.0'
gem 'activerecord', '~> 6.0'
gem 'railties', '~> 7.0'
gem 'activerecord', '~> 7.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'

Expand Down
9 changes: 5 additions & 4 deletions stealth.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ Gem::Specification.new do |s|
s.authors = ['Mauricio Gomes', 'Matthew Black']
s.email = '[email protected]'

s.add_dependency 'sinatra', '~> 2.0'
s.add_dependency 'puma', '~> 6.0'
s.add_dependency 'thor', '~> 1.0'
s.add_dependency 'activesupport', '~> 7.0'
s.add_dependency 'multi_json', '~> 1.12'
s.add_dependency 'puma', '~> 6.0'
s.add_dependency 'redis', '~> 5.0'
s.add_dependency 'sidekiq', '~> 7.0'
s.add_dependency 'activesupport', '~> 7.0'
s.add_dependency 'sinatra', '>= 2', '< 4'
s.add_dependency 'thor', '~> 1.0'
s.add_dependency 'zeitwerk', '~> 2.6'

s.add_development_dependency 'rspec', '~> 3.9'
Expand Down

0 comments on commit 04a6419

Please sign in to comment.