summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSHIBATA Hiroshi <hsbt@ruby-lang.org>2019-02-19 22:41:56 +0900
committerSHIBATA Hiroshi <hsbt@ruby-lang.org>2019-02-19 22:41:56 +0900
commit48c0ed4480c6fd1c3f35e9e808e84cfeecc9a97b (patch)
tree6154f3d15c48cdd1458b519e4577cc5bd1a71aaf
parent0f3375ea81406e0e6ecca20d775c7a4d8ab9ebfd (diff)
downloadbundler-48c0ed4480c6fd1c3f35e9e808e84cfeecc9a97b.tar.gz
Use ENV["BUNDLE_GEM"] instead of gem command provided by system ruby.
It break the examples of bundler. Because some examples detect the different version of system ruby than test target version like trunk.
-rw-r--r--lib/bundler/gem_helper.rb6
-rw-r--r--spec/commands/clean_spec.rb14
-rw-r--r--spec/support/rubygems_ext.rb3
3 files changed, 15 insertions, 8 deletions
diff --git a/lib/bundler/gem_helper.rb b/lib/bundler/gem_helper.rb
index ca39f122e9..e9ee03b8a2 100644
--- a/lib/bundler/gem_helper.rb
+++ b/lib/bundler/gem_helper.rb
@@ -75,7 +75,8 @@ module Bundler
def build_gem
file_name = nil
- sh(%W[gem build -V #{spec_path}]) do
+ gem = ENV["BUNDLE_GEM"] ? ENV["BUNDLE_GEM"] : "gem"
+ sh(%W[#{gem} build -V #{spec_path}]) do
file_name = File.basename(built_gem_path)
SharedHelpers.filesystem_access(File.join(base, "pkg")) {|p| FileUtils.mkdir_p(p) }
FileUtils.mv(built_gem_path, "pkg")
@@ -86,7 +87,8 @@ module Bundler
def install_gem(built_gem_path = nil, local = false)
built_gem_path ||= build_gem
- cmd = %W[gem install #{built_gem_path}]
+ gem = ENV["BUNDLE_GEM"] ? ENV["BUNDLE_GEM"] : "gem"
+ cmd = %W[#{gem} install #{built_gem_path}]
cmd << "--local" if local
out, status = sh_with_status(cmd)
unless status.success? && out[/Successfully installed/]
diff --git a/spec/commands/clean_spec.rb b/spec/commands/clean_spec.rb
index 2ed8b36a85..7e5da90473 100644
--- a/spec/commands/clean_spec.rb
+++ b/spec/commands/clean_spec.rb
@@ -339,7 +339,8 @@ RSpec.describe "bundle clean" do
gem "rack"
G
- sys_exec! "gem list"
+ gem = ruby_core? ? ENV["BUNDLE_GEM"] : "gem"
+ sys_exec! "#{gem} list"
expect(out).to include("rack (1.0.0)").and include("thin (1.0)")
end
@@ -461,8 +462,9 @@ RSpec.describe "bundle clean" do
end
bundle! :update, :all => bundle_update_requires_all?
- sys_exec! "gem list"
- expect(out).to include("foo (1.0.1, 1.0)")
+ gem = ruby_core? ? ENV["BUNDLE_GEM"] : "gem"
+ sys_exec! "#{gem} list"
+ expect(out).to include("foo (1.0.1, 1.0)")
end
it "cleans system gems when --force is used" do
@@ -485,7 +487,8 @@ RSpec.describe "bundle clean" do
bundle "clean --force"
expect(out).to include("Removing foo (1.0)")
- sys_exec "gem list"
+ gem = ruby_core? ? ENV["BUNDLE_GEM"] : "gem"
+ sys_exec "#{gem} list"
expect(out).not_to include("foo (1.0)")
expect(out).to include("rack (1.0.0)")
end
@@ -519,7 +522,8 @@ RSpec.describe "bundle clean" do
expect(err).to include(system_gem_path.to_s)
expect(err).to include("grant write permissions")
- sys_exec "gem list"
+ gem = ruby_core? ? ENV["BUNDLE_GEM"] : "gem"
+ sys_exec "#{gem} list"
expect(out).to include("foo (1.0)")
expect(out).to include("rack (1.0.0)")
end
diff --git a/spec/support/rubygems_ext.rb b/spec/support/rubygems_ext.rb
index c13ed35413..478cd12eb5 100644
--- a/spec/support/rubygems_ext.rb
+++ b/spec/support/rubygems_ext.rb
@@ -52,7 +52,8 @@ module Spec
no_reqs.map!(&:first)
reqs.map! {|name, req| "'#{name}:#{req}'" }
deps = reqs.concat(no_reqs).join(" ")
- cmd = "#{Gem.ruby} -S gem install #{deps} --no-document --conservative"
+ gem = Spec::Path.ruby_core? ? ENV["BUNDLE_GEM"] : "#{Gem.ruby} -S gem"
+ cmd = "#{gem} install #{deps} --no-document --conservative"
puts cmd
system(cmd) || raise("Installing gems #{deps} for the tests to use failed!")
end