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

Ruby 3.2 support (File.exists? has been removed) #164

Open
amiel opened this issue Apr 26, 2023 · 1 comment
Open

Ruby 3.2 support (File.exists? has been removed) #164

amiel opened this issue Apr 26, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@amiel
Copy link

amiel commented Apr 26, 2023

Describe the bug

Ruby 3.2 removes File.exists?. File.exist? should be used instead.

To Reproduce

Run sord defs.rbs with ruby 3.2.

Expected behavior

I expected no exception.

Actual behavior

I get the following error:

[ERROR] undefined method `exists?' for File:Class                                                                                                                                                            
         /opt/homebrew/Cellar/rbenv/1.2.0/versions/3.2.2/lib/ruby/gems/3.2.0/gems/commander-4.6.0/lib/commander/user_interaction.rb:364:in `method_missing'                                                  
         /opt/homebrew/Cellar/rbenv/1.2.0/versions/3.2.2/lib/ruby/gems/3.2.0/gems/sord-5.0.0/lib/sord/resolver.rb:35:in `block in load_gem_objects'                                                          
         /opt/homebrew/Cellar/rbenv/1.2.0/versions/3.2.2/lib/ruby/gems/3.2.0/gems/sord-5.0.0/lib/sord/resolver.rb:34:in `each'                                                                               
         /opt/homebrew/Cellar/rbenv/1.2.0/versions/3.2.2/lib/ruby/gems/3.2.0/gems/sord-5.0.0/lib/sord/resolver.rb:34:in `load_gem_objects'                                                                   
         /opt/homebrew/Cellar/rbenv/1.2.0/versions/3.2.2/lib/ruby/gems/3.2.0/gems/sord-5.0.0/lib/sord/resolver.rb:13:in `prepare'                                                                            
         /opt/homebrew/Cellar/rbenv/1.2.0/versions/3.2.2/lib/ruby/gems/3.2.0/gems/sord-5.0.0/lib/sord/resolver.rb:83:in `paths_for'                                                                          
         /opt/homebrew/Cellar/rbenv/1.2.0/versions/3.2.2/lib/ruby/gems/3.2.0/gems/sord-5.0.0/lib/sord/resolver.rb:95:in `path_for'                                                                           
         /opt/homebrew/Cellar/rbenv/1.2.0/versions/3.2.2/lib/ruby/gems/3.2.0/gems/sord-5.0.0/lib/sord/type_converter.rb:162:in `yard_to_parlour'                                                             
         /opt/homebrew/Cellar/rbenv/1.2.0/versions/3.2.2/lib/ruby/gems/3.2.0/gems/sord-5.0.0/lib/sord/type_converter.rb:139:in `block in yard_to_parlour'                                                    
         /opt/homebrew/Cellar/rbenv/1.2.0/versions/3.2.2/lib/ruby/gems/3.2.0/gems/sord-5.0.0/lib/sord/type_converter.rb:139:in `map'                                                                         
         /opt/homebrew/Cellar/rbenv/1.2.0/versions/3.2.2/lib/ruby/gems/3.2.0/gems/sord-5.0.0/lib/sord/type_converter.rb:139:in `yard_to_parlour'                                                             
         /opt/homebrew/Cellar/rbenv/1.2.0/versions/3.2.2/lib/ruby/gems/3.2.0/gems/sord-5.0.0/lib/sord/generator.rb:394:in `block in add_methods'                                                             
         /opt/homebrew/Cellar/rbenv/1.2.0/versions/3.2.2/lib/ruby/gems/3.2.0/gems/sord-5.0.0/lib/sord/generator.rb:282:in `each'                                                                             
         /opt/homebrew/Cellar/rbenv/1.2.0/versions/3.2.2/lib/ruby/gems/3.2.0/gems/sord-5.0.0/lib/sord/generator.rb:282:in `add_methods'                                                                      
         /opt/homebrew/Cellar/rbenv/1.2.0/versions/3.2.2/lib/ruby/gems/3.2.0/gems/sord-5.0.0/lib/sord/generator.rb:586:in `add_namespace'                                                                    
         /opt/homebrew/Cellar/rbenv/1.2.0/versions/3.2.2/lib/ruby/gems/3.2.0/gems/sord-5.0.0/lib/sord/generator.rb:603:in `block in populate'                                                                
         /opt/homebrew/Cellar/rbenv/1.2.0/versions/3.2.2/lib/ruby/gems/3.2.0/gems/sord-5.0.0/lib/sord/generator.rb:603:in `each'                                                                             
         /opt/homebrew/Cellar/rbenv/1.2.0/versions/3.2.2/lib/ruby/gems/3.2.0/gems/sord-5.0.0/lib/sord/generator.rb:603:in `populate'                                                                         
         /opt/homebrew/Cellar/rbenv/1.2.0/versions/3.2.2/lib/ruby/gems/3.2.0/gems/sord-5.0.0/lib/sord/generator.rb:623:in `run'                                                                              
         /opt/homebrew/Cellar/rbenv/1.2.0/versions/3.2.2/lib/ruby/gems/3.2.0/gems/sord-5.0.0/lib/sord/parlour_plugin.rb:77:in `generate'                                                                     
         /opt/homebrew/Cellar/rbenv/1.2.0/versions/3.2.2/lib/ruby/gems/3.2.0/gems/sord-5.0.0/exe/sord:92:in `block (2 levels) in <top (required)>'
         /opt/homebrew/Cellar/rbenv/1.2.0/versions/3.2.2/lib/ruby/gems/3.2.0/gems/commander-4.6.0/lib/commander/command.rb:187:in `call'
         /opt/homebrew/Cellar/rbenv/1.2.0/versions/3.2.2/lib/ruby/gems/3.2.0/gems/commander-4.6.0/lib/commander/command.rb:157:in `run'
         /opt/homebrew/Cellar/rbenv/1.2.0/versions/3.2.2/lib/ruby/gems/3.2.0/gems/commander-4.6.0/lib/commander/runner.rb:444:in `run_active_command'
         /opt/homebrew/Cellar/rbenv/1.2.0/versions/3.2.2/lib/ruby/gems/3.2.0/gems/commander-4.6.0/lib/commander/runner.rb:58:in `run!'
         /opt/homebrew/Cellar/rbenv/1.2.0/versions/3.2.2/lib/ruby/gems/3.2.0/gems/commander-4.6.0/lib/commander/delegates.rb:18:in `run!'
         /opt/homebrew/Cellar/rbenv/1.2.0/versions/3.2.2/lib/ruby/gems/3.2.0/gems/commander-4.6.0/lib/commander/import.rb:7:in `block in <top (required)>'

Additional information

File.exists? was removed here: ruby/ruby@bf97415.

I haven't provided a ton of extra detail in reproduction steps because I believe this is a straight-forward case. Please let me know if it's not so straight-forward and I can provide more specific information.

@amiel amiel added the bug Something isn't working label Apr 26, 2023
@AaronC81 AaronC81 mentioned this issue May 2, 2023
@Bo98
Copy link

Bo98 commented Nov 4, 2023

This is partially fixed in Sord 5.0.1, but 5.0.1 and later still have a restriction to only allow Parlour v5, and Ruby 3.2 support there was only added in Parlour 8.1, so using Sord as a Parlour plugin is still broken as a result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants