dry-system icon indicating copy to clipboard operation
dry-system copied to clipboard

Fix Bootsnap to work with Ruby 3.0

Open RicardoTrindade opened this issue 2 years ago • 1 comments

Due to the changes in keyword arguments for Ruby 3.0 I believe the bootsnap integration stopped working. This PR updates the Bootsnap.setup method call to use ** operator and get around the initialization issue. Since dry-system requires ruby 3.0 or higher I've updated the condition to check if bootsnap was available. Also uncommented a test for bootsnap. I've added an empty file to get the test working but I'm open to other suggestions

Stacktrace from an example repo I created to show the issue https://github.com/RicardoTrindade/Bootsnap-example

Users/ricardot/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.15.0/lib/bootsnap.rb:38:in `setup': wrong number of arguments (given 1, expected 0; required keyword: cache_dir) (ArgumentError)
	from /Users/ricardot/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/dry-system-1.0.1/lib/dry/system/plugins/bootsnap.rb:35:in `setup_bootsnap'
	from /Users/ricardot/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/dry-system-1.0.1/lib/dry/system/container.rb:129:in `instance_eval'
	from /Users/ricardot/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/dry-system-1.0.1/lib/dry/system/container.rb:129:in `block in configured!'
	from /Users/ricardot/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/dry-system-1.0.1/lib/dry/system/container.rb:129:in `each'
	from /Users/ricardot/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/dry-system-1.0.1/lib/dry/system/container.rb:129:in `configured!'
	from /Users/ricardot/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/dry-system-1.0.1/lib/dry/system/container.rb:108:in `configure'
	from /Users/ricardot/Documents/github/forks/Bootsnap-example/lib/app.rb:10:in `<class:App>'
	from /Users/ricardot/Documents/github/forks/Bootsnap-example/lib/app.rb:5:in `<top (required)>'
	from /Users/ricardot/Documents/github/forks/Bootsnap-example/config.ru:6:in `require_relative'
	from /Users/ricardot/Documents/github/forks/Bootsnap-example/config.ru:6:in `block in <main>'

RicardoTrindade avatar Jan 05 '23 19:01 RicardoTrindade

@RicardoTrindade something's broken in CI? Mind to take a look?

flash-gordon avatar Feb 14 '23 10:02 flash-gordon