summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2019-07-23 18:25:14 +0200
committerDavid Rodríguez <deivid.rodriguez@riseup.net>2019-07-23 23:14:52 +0200
commit8ae54c95713b2aefd9f33f199523d9e403503d04 (patch)
tree4b9c134c6aeb3e3e458ecec411f38f2fc1d348b6
parent5ca2dc737fcda83e625290e29cf1baf0c6cc2fd3 (diff)
downloadbundler-8ae54c95713b2aefd9f33f199523d9e403503d04.tar.gz
Another try
-rw-r--r--Rakefile1
-rw-r--r--spec/support/helpers.rb13
-rw-r--r--spec/support/rubygems_ext.rb25
3 files changed, 25 insertions, 14 deletions
diff --git a/Rakefile b/Rakefile
index 0c5be783db..06780ac246 100644
--- a/Rakefile
+++ b/Rakefile
@@ -35,6 +35,7 @@ namespace :spec do
desc "Ensure spec dependencies are installed"
task :deps do
Spec::Rubygems.dev_setup
+ Spec::Rubygems.build
end
namespace :travis do
diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb
index 922555ff60..a6541445a2 100644
--- a/spec/support/helpers.rb
+++ b/spec/support/helpers.rb
@@ -309,16 +309,7 @@ module Spec
gem_repo = options.fetch(:gem_repo) { gem_repo1 }
gems.each do |g|
path = if g == :bundler
- 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 }
- Dir.chdir(root) { gem_command! :build, root.join("bundler.gemspec").to_s }
- FileUtils.rm(root.join("bundler.gemspec"))
- else
- Dir.chdir(root) { gem_command! :build, gemspec.to_s }
- end
- bundler_path = root + "bundler-#{Bundler::VERSION}.gem"
+ root + "pkg/bundler-#{Bundler::VERSION}.gem"
elsif g.to_s =~ %r{\A(?:[A-Z]:)?/.*\.gem\z}
g
else
@@ -328,8 +319,6 @@ module Spec
raise "OMG `#{path}` does not exist!" unless File.exist?(path)
gem_command! :install, "--no-document --ignore-dependencies '#{path}'"
-
- bundler_path && bundler_path.rmtree
end
end
diff --git a/spec/support/rubygems_ext.rb b/spec/support/rubygems_ext.rb
index 2342870276..c94de86460 100644
--- a/spec/support/rubygems_ext.rb
+++ b/spec/support/rubygems_ext.rb
@@ -54,6 +54,24 @@ module Spec
require gem_name
end
+ def self.build
+ root = Path.root
+ gemspec = Path.gemspec.to_s
+ if Path.ruby_core?
+ spec = Gem::Specification.load(gemspec)
+ spec.bindir = "libexec"
+ File.open(root.join("bundler.gemspec").to_s, "w") {|f| f.write spec.to_ruby }
+ cmd = "#{gem_cmd} build #{root.join("bundler.gemspec")}"
+ system(cmd) || raise("Building bundler gem failed!")
+ FileUtils.rm(root.join("bundler.gemspec"))
+ else
+ cmd = "#{gem_cmd} build #{gemspec}"
+ system(cmd) || raise("Building bundler gem failed!")
+ end
+
+ FileUtils.mv(root.join("bundler-#{Bundler::VERSION}.gem"), "pkg")
+ end
+
def self.setup
Gem.clear_paths
@@ -83,10 +101,13 @@ 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.ruby} -S gem"
- cmd = "#{gem} install #{deps} --no-document --conservative"
+ cmd = "#{gem_cmd} install #{deps} --no-document --conservative"
puts cmd
system(cmd) || raise("Installing gems #{deps} for the tests to use failed!")
end
+
+ def self.gem_cmd
+ Path.ruby_core? ? ENV["BUNDLE_GEM"] : "#{Gem.ruby} -S gem"
+ end
end
end