Shopify / bootboot

Dualboot your Ruby app made easy
MIT License
416 stars 35 forks source link

Fix Bundler::Plugin.load_plugin on first install #35

Closed jacobthemyth closed 3 years ago

jacobthemyth commented 4 years ago

If bundle install is run before bootboot has been installed, Gemfile_next.lock is not correctly synced.

There is currently a bug (which is reproducible by running the test included on master) where if the Gemfile is changed before bootboot has been installed, Gemfile_next.lock doesn't get updated. In other words, if someone clones a project that already uses bootboot and has a Gemfile_next.lock, then they add a gem to Gemfile without first running bundle install, when they then run bundle install (for the first time), the added gem will not appear in Gemfile_next.lock. The issue is that Bundler expects to be able to load plugins.rb multiple times, first in register_plugin and again in load_plugin and it erases state in between, but bootboot uses require in plugins.rb so the hooks are removed in register_plugin but not re-added in load_plugin since require does not reload bootboot.rb. The sequence diagrams below demonstrate simplified "before" and "after" call sequences.

Before

before

After

after
jacobthemyth commented 3 years ago

I haven't had any time to look at this and likely won't since it's pretty niche, so I'm going to close for now.