[bundler/bundler] Extract yet another helper method
https://github.com/bundler/bundler/commit/948a863bd8
This commit is contained in:
parent
4318405609
commit
a2d7c97a91
@ -225,16 +225,8 @@ RSpec.describe "The library itself" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "can still be built" do
|
it "can still be built" do
|
||||||
with_root_gemspec do |gemspec|
|
with_built_bundler do |_gem_path|
|
||||||
Dir.chdir(root) { gem_command! :build, gemspec }
|
|
||||||
end
|
|
||||||
|
|
||||||
bundler_path = root.join("bundler-#{Bundler::VERSION}.gem")
|
|
||||||
|
|
||||||
begin
|
|
||||||
expect(err).to be_empty, "bundler should build as a gem without warnings, but\n#{err}"
|
expect(err).to be_empty, "bundler should build as a gem without warnings, but\n#{err}"
|
||||||
ensure
|
|
||||||
bundler_path.rmtree
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -297,20 +297,13 @@ module Spec
|
|||||||
options = gems.last.is_a?(Hash) ? gems.pop : {}
|
options = gems.last.is_a?(Hash) ? gems.pop : {}
|
||||||
gem_repo = options.fetch(:gem_repo) { gem_repo1 }
|
gem_repo = options.fetch(:gem_repo) { gem_repo1 }
|
||||||
gems.each do |g|
|
gems.each do |g|
|
||||||
path = if g == :bundler
|
if g == :bundler
|
||||||
with_root_gemspec do |gemspec|
|
with_built_bundler {|gem_path| install_gem(gem_path) }
|
||||||
Dir.chdir(root) { gem_command! :build, gemspec }
|
|
||||||
end
|
|
||||||
bundler_path = root.join("bundler-#{Bundler::VERSION}.gem")
|
|
||||||
elsif g.to_s =~ %r{\A(?:[A-Z]:)?/.*\.gem\z}
|
elsif g.to_s =~ %r{\A(?:[A-Z]:)?/.*\.gem\z}
|
||||||
g
|
install_gem(g)
|
||||||
else
|
else
|
||||||
"#{gem_repo}/gems/#{g}.gem"
|
install_gem("#{gem_repo}/gems/#{g}.gem")
|
||||||
end
|
end
|
||||||
|
|
||||||
install_gem(path)
|
|
||||||
|
|
||||||
bundler_path && bundler_path.rmtree
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -320,6 +313,20 @@ module Spec
|
|||||||
gem_command! :install, "--no-document --ignore-dependencies '#{path}'"
|
gem_command! :install, "--no-document --ignore-dependencies '#{path}'"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def with_built_bundler
|
||||||
|
with_root_gemspec do |gemspec|
|
||||||
|
Dir.chdir(root) { gem_command! :build, gemspec.to_s }
|
||||||
|
end
|
||||||
|
|
||||||
|
bundler_path = root + "bundler-#{Bundler::VERSION}.gem"
|
||||||
|
|
||||||
|
begin
|
||||||
|
yield(bundler_path)
|
||||||
|
ensure
|
||||||
|
bundler_path.rmtree
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def with_gem_path_as(path)
|
def with_gem_path_as(path)
|
||||||
backup = ENV.to_hash
|
backup = ENV.to_hash
|
||||||
ENV["GEM_HOME"] = path.to_s
|
ENV["GEM_HOME"] = path.to_s
|
||||||
|
Loading…
x
Reference in New Issue
Block a user