Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatible with Ruby 3.2 #22

Open
pboling opened this issue Oct 26, 2023 · 3 comments
Open

Incompatible with Ruby 3.2 #22

pboling opened this issue Oct 26, 2023 · 3 comments

Comments

@pboling
Copy link

pboling commented Oct 26, 2023

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
Copy link
Author

pboling commented Oct 26, 2023

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'

Ref: https://github.com/Largo/file_exists

@benburkert
Copy link
Owner

thanks for investigating @pboling, mind submitting a PR with your preferred fix?

@pboling
Copy link
Author

pboling commented Oct 30, 2023

Will do!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants