Skip to content

Commit c2aafcf

Browse files
committed
Fix another loading problem
Issue #390. We can't rely on ENV["GEM_PATH"] to be set. Also, the spring gem will not necessarily exist in the bundle path, so we need to fall back to other paths.
1 parent 4fb34dd commit c2aafcf

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## Next version
2+
3+
* Fix yet another problem with loading spring which seems to affect
4+
some/all rbenv users. Issue #390.
5+
16
## 1.3.2
27

38
* Fix another problem with gems bundled from git repositories. This

lib/spring/client/binstub.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class Binstub < Command
3737
require "bundler"
3838
3939
if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m)
40-
Gem.paths = { "GEM_PATH" => Bundler.bundle_path.to_s }
40+
Gem.paths = { "GEM_PATH" => [Bundler.bundle_path.to_s, *Gem.path].uniq }
4141
gem "spring", match[1]
4242
require "spring/binstub"
4343
end

lib/spring/client/run.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ def boot_server
8181

8282
def gem_env
8383
bundle = Bundler.bundle_path.to_s
84-
paths = ENV["GEM_PATH"].to_s.split(File::PATH_SEPARATOR)
84+
paths = Gem.path + ENV["GEM_PATH"].to_s.split(File::PATH_SEPARATOR)
8585

8686
{
87-
"GEM_PATH" => [bundle, *paths].join(File::PATH_SEPARATOR),
87+
"GEM_PATH" => [bundle, *paths].uniq.join(File::PATH_SEPARATOR),
8888
"GEM_HOME" => bundle
8989
}
9090
end

0 commit comments

Comments
 (0)