Skip to content

Commit

Permalink
Fix gemspec ruby version checks (#259)
Browse files Browse the repository at this point in the history
* 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.

* Fix: Update `syntax_suggest` dependency version constraint

- `”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
  • Loading branch information
kurioscreative authored Jan 1, 2025
1 parent bb76efe commit 128b662
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions derailed_benchmarks.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ 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"
gem.add_dependency "syntax_suggest", "~> 1.1.0"
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"
gem.add_dependency "rack-test", ">= 0"
Expand Down

0 comments on commit 128b662

Please sign in to comment.