Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions bundler/spec/runtime/setup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ def clean_load_path(lp)
end
G

install_gems "activesupport-2.3.5"
system_gems "activesupport-2.3.5"

expect(the_bundle).to include_gems "activesupport 2.3.2", :groups => :default
end
Expand All @@ -618,7 +618,7 @@ def clean_load_path(lp)
end
G

install_gems "activesupport-2.3.5"
system_gems "activesupport-2.3.5"

expect(the_bundle).to include_gems "activesupport 2.3.2"
end
Expand Down Expand Up @@ -765,7 +765,7 @@ def clean_load_path(lp)
full_gem_name = gem_name + "-1.0"
ext_dir = File.join(tmp("extensions", full_gem_name))

install_gems full_gem_name
system_gems full_gem_name

install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
Expand Down
40 changes: 18 additions & 22 deletions bundler/spec/support/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -264,18 +264,22 @@ def lock_gemfile(*args)
bundle :lock, opts
end

def install_gems(*gems)
def system_gems(*gems)
gems = gems.flatten
options = gems.last.is_a?(Hash) ? gems.pop : {}
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) }
elsif gem_name =~ %r{\A(?:[a-zA-Z]:)?/.*\.gem\z}
install_gem(gem_name)
else
install_gem("#{gem_repo}/gems/#{gem_name}.gem")
path = options.fetch(:path, system_gem_path)
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) }
elsif gem_name =~ %r{\A(?:[a-zA-Z]:)?/.*\.gem\z}
install_gem(gem_name)
else
install_gem("#{gem_repo}/gems/#{gem_name}.gem")
end
end
end
end
Expand Down Expand Up @@ -384,20 +388,12 @@ def pristine_system_gems(*gems)
system_gems(*gems)
end

def system_gems(*gems)
opts = gems.last.is_a?(Hash) ? gems.last : {}
path = opts.fetch(:path, system_gem_path)
gems = gems.flatten

with_gem_path_as(path) do
install_gems(*gems)
end
end

def realworld_system_gems(*gems)
gems = gems.flatten
opts = gems.last.is_a?(Hash) ? gems.pop : {}
path = opts.fetch(:path, system_gem_path)

with_gem_path_as(system_gem_path) do
with_gem_path_as(path) do
gems.each do |gem|
gem_command "install --no-document #{gem}"
end
Expand Down