Skip to content

Commit 28c591e

Browse files
committed
Don't use spring if it's not in the lockfile
This only applies to binstubs - it's still possible to use spring via "spring ..." when not using binstubs.
1 parent 91d5d12 commit 28c591e

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

lib/spring/client/binstub.rb

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,14 @@ class Binstub < Command
3636
require "rubygems"
3737
require "bundler"
3838
39-
match = Bundler.default_lockfile.read.match(/^GEM$.*?^ spring \((.*?)\)$.*?^$/m)
40-
version = match && match[1]
39+
if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ spring \((.*?)\)$.*?^$/m)
40+
ENV["GEM_PATH"] = ([Bundler.bundle_path.to_s] + Gem.path).join(File::PATH_SEPARATOR)
41+
ENV["GEM_HOME"] = ""
42+
Gem.paths = ENV
4143
42-
ENV["GEM_PATH"] = ([Bundler.bundle_path.to_s] + Gem.path).join(File::PATH_SEPARATOR)
43-
ENV["GEM_HOME"] = ""
44-
Gem.paths = ENV
45-
46-
gem "spring", version
47-
require "spring/binstub"
44+
gem "spring", match[1]
45+
require "spring/binstub"
46+
end
4847
end
4948
CODE
5049

0 commit comments

Comments
 (0)