summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/bundler/gem_helper.rb6
-rw-r--r--spec/bundler/commands/clean_spec.rb14
-rw-r--r--spec/bundler/support/rubygems_ext.rb5
3 files changed, 16 insertions, 9 deletions
diff --git a/lib/bundler/gem_helper.rb b/lib/bundler/gem_helper.rb
index e7673cba88..55f484f723 100644
--- a/lib/bundler/gem_helper.rb
+++ b/lib/bundler/gem_helper.rb
@@ -74,7 +74,8 @@ module Bundler
def build_gem
file_name = nil
- sh("gem build -V '#{spec_path}'") do
+ gem = ENV["BUNDLE_GEM"] ? ENV["BUNDLE_GEM"] : "gem"
+ sh("#{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")
@@ -85,7 +86,8 @@ module Bundler
def install_gem(built_gem_path = nil, local = false)
built_gem_path ||= build_gem
- out, _ = sh_with_code("gem install '#{built_gem_path}'#{" --local" if local}")
+ gem = ENV["BUNDLE_GEM"] ? ENV["BUNDLE_GEM"] : "gem"
+ out, _ = sh_with_code("#{gem} install '#{built_gem_path}'#{" --local" if local}")
raise "Couldn't install gem, run `gem install #{built_gem_path}' for more detailed output" unless out[/Successfully installed/]
Bundler.ui.confirm "#{name} (#{version}) installed."
end
diff --git a/spec/bundler/commands/clean_spec.rb b/spec/bundler/commands/clean_spec.rb
index 158d58d67c..c18c7a195f 100644
--- a/spec/bundler/commands/clean_spec.rb
+++ b/spec/bundler/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(out).to include(system_gem_path.to_s)
expect(out).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/bundler/support/rubygems_ext.rb b/spec/bundler/support/rubygems_ext.rb
index c18f7650fc..42f887f268 100644
--- a/spec/bundler/support/rubygems_ext.rb
+++ b/spec/bundler/support/rubygems_ext.rb
@@ -59,10 +59,11 @@ module Spec
no_reqs.map!(&:first)
reqs.map! {|name, req| "'#{name}:#{req}'" }
deps = reqs.concat(no_reqs).join(" ")
+ gem = Spec::Path.ruby_core? ? ENV["BUNDLE_GEM"] : "gem"
cmd = if Gem::VERSION < "2.0.0"
- "gem install #{deps} --no-rdoc --no-ri --conservative"
+ "#{gem} install #{deps} --no-rdoc --no-ri --conservative"
else
- "gem install #{deps} --no-document --conservative"
+ "#{gem} install #{deps} --no-document --conservative"
end
puts cmd
system(cmd) || raise("Installing gems #{deps} for the tests to use failed!")