Last active
February 13, 2020 15:46
-
-
Save zdennis/58265f0b7f113d9274610194dcb330fe to your computer and use it in GitHub Desktop.
bootboot-lite: dual boot without bootboot!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Require this from your Gemfile | |
| # - Adds support for programmatically setting the cache path | |
| Bundler::Settings.class_eval do | |
| attr_writer :app_cache_path | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| source "https://rubygems.org" | |
| ruby "~> " + File.read("#{Bundler.root}/.ruby-version").strip | |
| require_relative 'dual_boot/bootboot-lite' | |
| if ENV['DEPENDENCIES_NEXT'] | |
| Bundler.settings.app_cache_path = "vendor/cache-rails_5.0" | |
| # Add any gem you want here, they will be loaded only when running | |
| # bundler command prefixed with `DEPENDENCIES_NEXT=1`. | |
| eval_gemfile File.dirname(__FILE__) + "/gemfiles/rails5.0.gemfile" | |
| else | |
| eval_gemfile File.dirname(__FILE__) + "/gemfiles/rails4.2.gemfile" | |
| end | |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The earlier revisions of this did not work consistently with bundler 1.17.x. In some cases the bundler would take a code path that let the patches take affect before it tried to read the lock file, e.g.
DEPENDENCIES_NEXT=1 bundle install. However, it failed when running commands throughbundle exec ...because it tried to read the lockfile before processing the Gemfile or any extensions loaded in it.The latest revision (revision 4 at the time of this writing) essentially removes all of the bootboot patches and only leaves in the attr_writer for
app_cache_path.If you symlink
Gemfile_nexttoGemfileand useBUNDLE_GEMFILE=Gemfile_nextthen everything will work across bundler invocations.It's possible to remove the
app_cache_pathwriter and just rely on BUNDLE_CACHE_PATH but it's left in place as a way to not require that env var to be set and to rely onDEPENDENCIES_NEXTto always set the cache path appropriately.