Incompatible with Ruby 3.2
Opened this issue · 3 comments
pboling commented
File.exists?
was deprecated in Ruby 2.1, and removed in Ruby 3.2.
It should be replaced with File.exist?
.
NoMethodError:
undefined method `exists?' for File:Class
# ./vendor/bundle/ruby/3.2.0/gems/randexp-0.1.7/lib/randexp/dictionary.rb:3:in `load_dictionary'
# ./vendor/bundle/ruby/3.2.0/gems/randexp-0.1.7/lib/randexp/dictionary.rb:16:in `words'
# ./vendor/bundle/ruby/3.2.0/gems/randexp-0.1.7/lib/randexp/randgen.rb:35:in `word'
# ./vendor/bundle/ruby/3.2.0/gems/randexp-0.1.7/lib/randexp/reducer.rb:60:in `char'
# ./vendor/bundle/ruby/3.2.0/gems/randexp-0.1.7/lib/randexp/reducer.rb:17:in `random'
# ./vendor/bundle/ruby/3.2.0/gems/randexp-0.1.7/lib/randexp/reducer.rb:4:in `reduce'
# ./vendor/bundle/ruby/3.2.0/gems/randexp-0.1.7/lib/randexp/reducer.rb:12:in `quantify'
# ./vendor/bundle/ruby/3.2.0/gems/randexp-0.1.7/lib/randexp/reducer.rb:4:in `reduce'
# ./vendor/bundle/ruby/3.2.0/gems/randexp-0.1.7/lib/randexp.rb:9:in `reduce'
# ./vendor/bundle/ruby/3.2.0/gems/randexp-0.1.7/lib/randexp/core_ext/regexp.rb:3:in `generate'
pboling commented
The solution, until this gem has a maintainer, (I volunteered and emailed @benburkert !) is to simply add the removed method back, and a handy gem does that for us:
spec.add_dependency("file_exists", "~> 0.2")
or
gem "file_exists", "~> 0.2"
And then (before all other requires):
require 'file_exists'
benburkert commented
thanks for investigating @pboling, mind submitting a PR with your preferred fix?
pboling commented
Will do!