Application will be able to enable dualbooting with few lines of
code instead of having to monkeypatch their Gemfile directly.
To start with, how to enable dualbooting in your app:
# Gemfile
if Bundler::Plugin.installed?('bootboot')
$LOAD_PATH << Bundler::Plugin.index.plugin_path('bootboot').join('lib')
require 'bootboot/enable_dual_booting'
end
Now is the why.
Bootboot is a plugin, it doesn't behave like a regular gem,
so we need to make a concession to make it available on the LOAD_PATH
Plugins in Bundler are meant to be executed only in the context of
the Plugin#eval_gemfile which is done when installing gem (i.e.
when you call bundle install or bundle update...).
They aren't meant to be loaded in the $LOAD_PATH when Bundler.setup
gets called.
Making Bootboot a plugin is mandatory, we can't specify it as a gem,
as otherwise the "keep Gemfile_next in sync" feature can't work.
It's also impossible to have the Gemfile include a module, since
during Gemfile evaluation time, the $LOAD_PATH is completely empty.
Application will be able to enable dualbooting with few lines of code instead of having to monkeypatch their Gemfile directly.
To start with, how to enable dualbooting in your app:
Now is the why.
Bootboot
is a plugin, it doesn't behave like a regular gem, so we need to make a concession to make it available on the LOAD_PATHPlugins in Bundler are meant to be executed only in the context of the
Plugin#eval_gemfile
which is done when installing gem (i.e. when you callbundle install
orbundle update
...).They aren't meant to be loaded in the $LOAD_PATH when Bundler.setup gets called. Making Bootboot a plugin is mandatory, we can't specify it as a gem, as otherwise the "keep Gemfile_next in sync" feature can't work.
It's also impossible to have the Gemfile include a module, since during Gemfile evaluation time, the $LOAD_PATH is completely empty.