Skip to content

Commit

Permalink
Allow using the latest version of rakc (3.x)
Browse files Browse the repository at this point in the history
The project dependencies now allow rack 3 to be installed.  This
backwards incompatible version extracted handlers in a new `rackup` gem.
While we could indicate we prefer to use rack 2 which is still receiving
update, it is more future-proof to update our code to be compatible with
the latest version of the dependency.

This is a development dependency only so will not affect users of the
project.
  • Loading branch information
smortex committed Jan 21, 2024
1 parent 68f7712 commit 1c0f438
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
11 changes: 11 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,14 @@ source 'https://rubygems.org'

# Specify your gem's dependencies in riemann-tools.gemspec
gemspec

if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.7.0')
# XXX: Needed for Ruby 2.6 compatibility
#
# With Ruby 2.6 an older version of rakup is installed that cause other gems
# to be installed with a legacy version.
#
# Because rakup is only needed when using rack 3, we can just ignore this
# with Ruby 2.6.
gem 'rackup'
end
8 changes: 7 additions & 1 deletion spec/riemann/tools/http_check_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
# frozen_string_literal: true

require 'openssl'
require 'rack/handler/webrick'
begin
require 'rackup/handler/webrick'
rescue LoadError
# XXX: Needed for Ruby 2.6 compatibility
# Moved to the rackup gem in recent versions
require 'rack/handler/webrick'
end
require 'sinatra/base'
require 'webrick'
require 'webrick/https'
Expand Down

0 comments on commit 1c0f438

Please sign in to comment.