diff options
author | SHIBATA Hiroshi <hsbt@ruby-lang.org> | 2019-02-04 21:14:38 +0900 |
---|---|---|
committer | SHIBATA Hiroshi <hsbt@ruby-lang.org> | 2019-02-04 21:14:38 +0900 |
commit | 46ead942a907f954f8428eaf69deb891b81480dd (patch) | |
tree | b1dd800d35ea99217212633786eca92b3a576086 | |
parent | 66e4215dbf87fedf2fdff3532a0742340c4e02f2 (diff) | |
download | bundler-ignore-bundler-lib-ruby-lib.tar.gz |
Ignore to add bundler lib direcotry if it is same as RbConfig::CONFIG["rubylibdir"].ignore-bundler-lib-ruby-lib
https://bugs.ruby-lang.org/issues/15469
In ruby core, the bundled bundler was located same as rubylibdir.
When user used the specific version of default gems like json, Bundler
uses default gems under the rubylibdir, not specific version.
I avoid to add bundler directory from RUBYLIB enviromental variable,
Because its directory was already added $LOAD_PATH.
-rw-r--r-- | lib/bundler/shared_helpers.rb | 2 | ||||
-rw-r--r-- | spec/bundler/shared_helpers_spec.rb | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb index e09e5e8b74..dfa05c0de0 100644 --- a/lib/bundler/shared_helpers.rb +++ b/lib/bundler/shared_helpers.rb @@ -341,7 +341,7 @@ module Bundler def set_rubylib rubylib = (ENV["RUBYLIB"] || "").split(File::PATH_SEPARATOR) - rubylib.unshift bundler_ruby_lib + rubylib.unshift bundler_ruby_lib unless RbConfig::CONFIG["rubylibdir"] == bundler_ruby_lib Bundler::SharedHelpers.set_env "RUBYLIB", rubylib.uniq.join(File::PATH_SEPARATOR) end diff --git a/spec/bundler/shared_helpers_spec.rb b/spec/bundler/shared_helpers_spec.rb index b66c43fd92..fcac37b398 100644 --- a/spec/bundler/shared_helpers_spec.rb +++ b/spec/bundler/shared_helpers_spec.rb @@ -261,6 +261,15 @@ RSpec.describe Bundler::SharedHelpers do subject.set_bundle_environment end + it "ignores if bundler_ruby_lib is same as rubylibdir" do + allow(Bundler::SharedHelpers).to receive(:bundler_ruby_lib).and_return(RbConfig::CONFIG["rubylibdir"]) + + subject.set_bundle_environment + + paths = (ENV["RUBYLIB"]).split(File::PATH_SEPARATOR) + expect(paths.count(RbConfig::CONFIG["rubylibdir"])).to eq(0) + end + it "exits if bundle path contains the unix-like path separator" do if Gem.respond_to?(:path_separator) allow(Gem).to receive(:path_separator).and_return(":") |