Skip to content

Commit cee61e3

Browse files
committed
Specify path which we'll load bundler from
Fixes rails#456. See my analysis at rails#456 (comment) Previously we were implicitly relying on Bundler setting RUBYLIB so that we'd be able to find Bundler in the child process. Bundler 1.11 no longer does that for us, so we need to explicitly do it ourselves (it was a bug that Bundle.with_clean_env didn't clear it).
1 parent 522aad2 commit cee61e3

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.6.3
2+
3+
* Fix problem with using Bundler 1.11 with a custom `BUNDLE_PATH` (#456)
4+
15
## 1.6.2
26

37
* Fix problems with the implementation of the new "Running via Spring preloader"

lib/spring/application_manager.rb

+1
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ def start_child(preload = false)
101101
"SPRING_PRELOAD" => preload ? "1" : "0"
102102
},
103103
"ruby",
104+
"-I", File.expand_path("../..", $LOADED_FEATURES.grep(/bundler\/setup\.rb$/).first),
104105
"-I", File.expand_path("../..", __FILE__),
105106
"-e", "require 'spring/application/boot'",
106107
3 => child_socket

lib/spring/test/acceptance_test.rb

+13
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,19 @@ def exec_name
495495
expr = "p Kernel.private_instance_methods.include?(:raise)"
496496
assert_success %(bin/rails runner '#{expr}'), stdout: "true"
497497
end
498+
499+
test "custom bundle path" do
500+
bundle_path = app.path(".bundle/#{Bundler.ruby_scope}")
501+
bundle_path.dirname.mkpath
502+
503+
FileUtils.cp_r "#{app.gem_home}/", bundle_path.to_s
504+
505+
app.run! "bundle install --path .bundle --clean --local"
506+
507+
assert_speedup do
508+
2.times { assert_success "bundle exec rails runner ''" }
509+
end
510+
end
498511
end
499512
end
500513
end

0 commit comments

Comments
 (0)