summaryrefslogtreecommitdiff
path: root/spec/bundler/support/helpers.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/bundler/support/helpers.rb')
-rw-r--r--spec/bundler/support/helpers.rb23
1 files changed, 11 insertions, 12 deletions
diff --git a/spec/bundler/support/helpers.rb b/spec/bundler/support/helpers.rb
index b5648b84a8..c4018eb818 100644
--- a/spec/bundler/support/helpers.rb
+++ b/spec/bundler/support/helpers.rb
@@ -290,26 +290,30 @@ module Spec
gems = gems.flatten
options = gems.last.is_a?(Hash) ? gems.pop : {}
path = options.fetch(:path, system_gem_path)
+ default = options.fetch(:default, false)
with_gem_path_as(path) do
gem_repo = options.fetch(:gem_repo, gem_repo1)
gems.each do |g|
gem_name = g.to_s
if gem_name.start_with?("bundler")
version = gem_name.match(/\Abundler-(?<version>.*)\z/)[:version] if gem_name != "bundler"
- with_built_bundler(version) {|gem_path| install_gem(gem_path) }
+ with_built_bundler(version) {|gem_path| install_gem(gem_path, default) }
elsif gem_name =~ %r{\A(?:[a-zA-Z]:)?/.*\.gem\z}
- install_gem(gem_name)
+ install_gem(gem_name, default)
else
- install_gem("#{gem_repo}/gems/#{gem_name}.gem")
+ install_gem("#{gem_repo}/gems/#{gem_name}.gem", default)
end
end
end
end
- def install_gem(path)
+ def install_gem(path, default = false)
raise "OMG `#{path}` does not exist!" unless File.exist?(path)
- gem_command "install --no-document --ignore-dependencies '#{path}'"
+ args = "--no-document --ignore-dependencies"
+ args += " --default --install-dir #{system_gem_path}" if default
+
+ gem_command "install #{args} '#{path}'"
end
def with_built_bundler(version = nil)
@@ -330,12 +334,7 @@ module Spec
replace_version_file(version, dir: build_path) # rubocop:disable Style/HashSyntax
- build_metadata = {
- :built_at => loaded_gemspec.date.utc.strftime("%Y-%m-%d"),
- :git_commit_sha => git_commit_sha,
- }
-
- replace_build_metadata(build_metadata, dir: build_path) # rubocop:disable Style/HashSyntax
+ Spec::BuildMetadata.write_build_metadata(dir: build_path) # rubocop:disable Style/HashSyntax
gem_command "build #{relative_gemspec}", :dir => build_path
@@ -570,7 +569,7 @@ module Spec
port
end
- private
+ private
def git_root_dir?
root.to_s == `git rev-parse --show-toplevel`.chomp