mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[bundler/bundler] Extract a with_root_gemspec
helper
https://github.com/bundler/bundler/commit/f20c2bdf6a
This commit is contained in:
parent
20c5154f0b
commit
09455301ef
3 changed files with 14 additions and 14 deletions
|
@ -225,13 +225,7 @@ RSpec.describe "The library itself" do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "can still be built" do
|
it "can still be built" do
|
||||||
if ruby_core?
|
with_root_gemspec do |gemspec|
|
||||||
spec = Gem::Specification.load(gemspec.to_s)
|
|
||||||
spec.bindir = "libexec"
|
|
||||||
File.open(root.join("bundler.gemspec").to_s, "w") {|f| f.write spec.to_ruby }
|
|
||||||
Dir.chdir(root) { gem_command! :build, root.join("bundler.gemspec") }
|
|
||||||
FileUtils.rm(root.join("bundler.gemspec"))
|
|
||||||
else
|
|
||||||
Dir.chdir(root) { gem_command! :build, gemspec }
|
Dir.chdir(root) { gem_command! :build, gemspec }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -298,13 +298,7 @@ module Spec
|
||||||
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
|
path = if g == :bundler
|
||||||
if ruby_core?
|
with_root_gemspec do |gemspec|
|
||||||
spec = Gem::Specification.load(gemspec.to_s)
|
|
||||||
spec.bindir = "libexec"
|
|
||||||
File.open(root.join("bundler.gemspec").to_s, "w") {|f| f.write spec.to_ruby }
|
|
||||||
Dir.chdir(root) { gem_command! :build, root.join("bundler.gemspec") }
|
|
||||||
FileUtils.rm(root.join("bundler.gemspec"))
|
|
||||||
else
|
|
||||||
Dir.chdir(root) { gem_command! :build, gemspec }
|
Dir.chdir(root) { gem_command! :build, gemspec }
|
||||||
end
|
end
|
||||||
bundler_path = root.join("bundler-#{Bundler::VERSION}.gem")
|
bundler_path = root.join("bundler-#{Bundler::VERSION}.gem")
|
||||||
|
|
|
@ -132,6 +132,18 @@ module Spec
|
||||||
tmp "tmpdir", *args
|
tmp "tmpdir", *args
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def with_root_gemspec
|
||||||
|
if ruby_core?
|
||||||
|
spec = Gem::Specification.load(gemspec.to_s)
|
||||||
|
spec.bindir = "libexec"
|
||||||
|
File.open(root.join("bundler.gemspec").to_s, "w") {|f| f.write spec.to_ruby }
|
||||||
|
yield(root.join("bundler.gemspec"))
|
||||||
|
FileUtils.rm(root.join("bundler.gemspec"))
|
||||||
|
else
|
||||||
|
yield(gemspec)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def ruby_core?
|
def ruby_core?
|
||||||
# avoid to wornings
|
# avoid to wornings
|
||||||
@ruby_core ||= nil
|
@ruby_core ||= nil
|
||||||
|
|
Loading…
Add table
Reference in a new issue