Closed jacobthemyth closed 4 years ago
I'm not sure why the build it failing, I think it must be something to do with the bundler version on Travis, but the tests all pass locally 🤔.
@Edouard-chin I'm not sure if you monitor this repo regularly, so just want to ping you directly 😊.
Hey, thanks for the PR ❤️ . I think this feature make sense. I don't have the bandwidth to do a proper review now, but I'll try to take some time next week to look.
Sure, thanks! I'm okay if you end up deciding it's not a good fit, but I'm using it already so figured I'd upstream it if possible.
I think the additions made to README.md
also address #28
Instead of just adding an error message assertion, I actually reimplemented the patch to add Ruby to the Metadata source instead of overriding RubyVersion.system
. The main reason is that when you asked for a test against the error message, I realized with the original implementation, the error message was pretty cryptic:
Could not find gem 'Ruby (~> x.x.x.x)' in the local ruby installation.
The source contains 'Ruby' at: x.x.x.x
Your Ruby version is x.x.x, but your Gemfile specified x.x.x
is a better message, but required a different patch in order for the Bundler code to get that far. I tried to implement the feature using Bundler::Plugin::API::Source
but as far as I could tell, Bundler has a hard coded "rule" that Ruby must come from the Metadata source, so I still had to use a patch instead of the Plugin
API unfortunately.
After reviewing my previous commit, I realized that patching Metadata
was too tightly coupled to the internals of Bundler. I reimplemented the Ruby dual booting again using Bundler::Plugin::API::Source
instead. Even though it still requires patching Bundler::Definition
, it seems far less coupled to the internals this way.
Also, overriding Bundler::RubyVersion.system
turns out to be required because even though Metadata
is used for resolution, system
is used for writing the lock file. I've modified the tests to correctly inspect the locked Ruby version.
Thanks for taking the time to review and give feedback!
This allows using bootboot for dual booting different versions of Ruby. For example:
I updated the env var from
SKIP_BUNDLER_PATCH
toBOOTBOOT_UPDATING_ALTERNATE_LOCKFILE
because I thought it would be confusing if theRubyVersion
patch took effect when that var was present, which is what needs to happen.