seattlerb / ruby_parser

ruby_parser is a ruby parser written in pure ruby. It outputs s-expressions which can be manipulated and converted back to ruby via the ruby2ruby gem.
http://www.zenspider.com/projects/ruby_parser.html
476 stars 100 forks source link

Make racc an explicit runtime dependency #341

Closed wildmaples closed 10 months ago

wildmaples commented 10 months ago

👋 Hello! I am not sure if this is the right change but figured I'd put up a PR anyway.

In Ruby 3.3, racc goes from a default gem to a bundled gem (release page), making it behave like a normal gem. I believe we should explicitly require racc as a runtime dependency.

We were seeing errors like these in libraries that uses ruby_parser on 3.3 that tries to load racc/parser but fails.

ngan commented 10 months ago

Here's a reproducible snippet:

Given this file (test.rb):

require "bundler/inline"
gemfile(true, quiet: true) do
  source "https://rubygems.org"
  gem "ruby_parser"
end
require "racc/parser"
puts Racc::Parser

With Ruby 3.2.2:

$ ruby test.rb
Racc::Parser

With Ruby 3.3.0-rc1:

$ ruby test.rb
/Users/foo/.rbenv/versions/3.3.0-rc1/lib/ruby/3.3.0+0/bundled_gems.rb:68:in `require': cannot load such file -- racc/parser (LoadError)
...
ngan commented 10 months ago

@zenspider 🙏 mind taking a look to see if this makes sense? Thank you

zenspider commented 10 months ago

Done! Will be released shortly. Thanks!