Only use Gem sources that are provided
This commit is contained in:
parent
1691e3af58
commit
bd3f0c442c
|
@ -139,14 +139,15 @@ module Vagrant
|
|||
#
|
||||
# @param [String] path Path to a local gem file.
|
||||
# @return [Gem::Specification]
|
||||
def install_local(path)
|
||||
def install_local(path, opts={})
|
||||
plugin_source = Gem::Source::SpecificFile.new(path)
|
||||
plugin_info = {
|
||||
plugin_source.spec.name => {
|
||||
'local_source' => plugin_source
|
||||
"local_source" => plugin_source,
|
||||
"sources" => opts.fetch(:sources, Gem.sources.map(&:to_s))
|
||||
}
|
||||
}
|
||||
internal_install(plugin_info, {}, local_install: true)
|
||||
internal_install(plugin_info, {})
|
||||
plugin_source.spec
|
||||
end
|
||||
|
||||
|
@ -223,9 +224,8 @@ module Vagrant
|
|||
protected
|
||||
|
||||
def internal_install(plugins, update, **extra)
|
||||
|
||||
# Only clear Gem sources if not performing local install
|
||||
Gem.sources.clear if !extra[:local_install]
|
||||
# Only allow defined Gem sources
|
||||
Gem.sources.clear
|
||||
|
||||
update = {} unless update.is_a?(Hash)
|
||||
installer_set = Gem::Resolver::InstallerSet.new(:both)
|
||||
|
|
|
@ -44,7 +44,7 @@ module Vagrant
|
|||
local = false
|
||||
if name =~ /\.gem$/
|
||||
# If this is a gem file, then we install that gem locally.
|
||||
local_spec = Vagrant::Bundler.instance.install_local(name)
|
||||
local_spec = Vagrant::Bundler.instance.install_local(name, opts)
|
||||
name = local_spec.name
|
||||
opts[:version] = local_spec.version.to_s
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue