From 7a1328bcd79d5c8d2fa0cbba342722c254d0a604 Mon Sep 17 00:00:00 2001 From: Glenn Ericksen Date: Thu, 5 Dec 2024 22:38:38 -0500 Subject: [PATCH 1/2] Fix: Conditional dependency logic in gemspec - Fixed the logic in the gemspec file to correctly compare the current Ruby version with the required version. - Replaced string comparison of `RUBY_VERSION` with `Gem::Version` for better semantic version handling. - Addressed edge cases, such as "3.10" being greater than "3.2". Why: The previous comparison caused a `LoadError` for `syntax_suggest` on Ruby 3.1.6 due to incorrect string-based version comparison. RUBY_VERSION returns a string, not a comparable version, breaking the current comparison in some cases. --- derailed_benchmarks.gemspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/derailed_benchmarks.gemspec b/derailed_benchmarks.gemspec index 358ac4d..bd9a291 100644 --- a/derailed_benchmarks.gemspec +++ b/derailed_benchmarks.gemspec @@ -29,12 +29,12 @@ Gem::Specification.new do |gem| gem.add_dependency "rack", ">= 1" gem.add_dependency "rake", "> 10", "< 14" gem.add_dependency "thor", ">= 0.19", "< 2" - if RUBY_VERSION >= '3.0' + if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.0") gem.add_dependency "ruby-statistics", ">= 4.0.1" else gem.add_dependency "ruby-statistics", ">= 2.1" end - if RUBY_VERSION < "3.2" + if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3.2") gem.add_dependency "syntax_suggest", "~> 1.1.0" end gem.add_dependency "mini_histogram", ">= 0.3.0" From 0d13b0ed8e36293bda1708c013d13ab9f24dc86d Mon Sep 17 00:00:00 2001 From: Glenn Ericksen Date: Thu, 5 Dec 2024 23:21:17 -0500 Subject: [PATCH 2/2] Fix: Update `syntax_suggest` dependency version constraint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - `”syntax_suggest", "~> 1.1.0"` to `”syntax_suggest", ">= 1.1.0"` in the gemspec Why: Allows greater flexibility for users by supporting newer versions of `syntax_suggest` beyond the `1.x` range, especially as 2.x requires ruby >= 3.0 --- derailed_benchmarks.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/derailed_benchmarks.gemspec b/derailed_benchmarks.gemspec index bd9a291..370ad3f 100644 --- a/derailed_benchmarks.gemspec +++ b/derailed_benchmarks.gemspec @@ -35,7 +35,7 @@ Gem::Specification.new do |gem| gem.add_dependency "ruby-statistics", ">= 2.1" end if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3.2") - gem.add_dependency "syntax_suggest", "~> 1.1.0" + gem.add_dependency "syntax_suggest", ">= 1.1.0" end gem.add_dependency "mini_histogram", ">= 0.3.0" gem.add_dependency "rack-test", ">= 0"