core: when installig local plugins, don't fetch remote
This commit is contained in:
parent
5197d3d86f
commit
3cefcda1e3
|
@ -58,8 +58,8 @@ module Vagrant
|
||||||
#
|
#
|
||||||
# @param [Hash] plugins
|
# @param [Hash] plugins
|
||||||
# @return [Array<Gem::Specification>]
|
# @return [Array<Gem::Specification>]
|
||||||
def install(plugins)
|
def install(plugins, local=false)
|
||||||
internal_install(plugins, nil)
|
internal_install(plugins, nil, local: local)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Installs a local '*.gem' file so that Bundler can find it.
|
# Installs a local '*.gem' file so that Bundler can find it.
|
||||||
|
@ -180,12 +180,13 @@ module Vagrant
|
||||||
# @param [Hash, Boolean] update If true, updates all plugins, otherwise
|
# @param [Hash, Boolean] update If true, updates all plugins, otherwise
|
||||||
# can be a hash of options. See Bundler.definition.
|
# can be a hash of options. See Bundler.definition.
|
||||||
# @return [Array<Gem::Specification>]
|
# @return [Array<Gem::Specification>]
|
||||||
def internal_install(plugins, update)
|
def internal_install(plugins, update, **extra)
|
||||||
gemfile = build_gemfile(plugins)
|
gemfile = build_gemfile(plugins)
|
||||||
lockfile = "#{gemfile.path}.lock"
|
lockfile = "#{gemfile.path}.lock"
|
||||||
definition = ::Bundler::Definition.build(gemfile, lockfile, update)
|
definition = ::Bundler::Definition.build(gemfile, lockfile, update)
|
||||||
root = File.dirname(gemfile.path)
|
root = File.dirname(gemfile.path)
|
||||||
opts = {}
|
opts = {}
|
||||||
|
opts["local"] = true if extra[:local]
|
||||||
|
|
||||||
with_isolated_gem do
|
with_isolated_gem do
|
||||||
::Bundler::Installer.install(root, definition, opts)
|
::Bundler::Installer.install(root, definition, opts)
|
||||||
|
|
|
@ -29,11 +29,13 @@ module Vagrant
|
||||||
# @param [String] name Name of the plugin (gem)
|
# @param [String] name Name of the plugin (gem)
|
||||||
# @return [Gem::Specification]
|
# @return [Gem::Specification]
|
||||||
def install_plugin(name, **opts)
|
def install_plugin(name, **opts)
|
||||||
|
local = false
|
||||||
if name =~ /\.gem$/
|
if name =~ /\.gem$/
|
||||||
# If this is a gem file, then we install that gem locally.
|
# 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)
|
||||||
name = local_spec.name
|
name = local_spec.name
|
||||||
opts[:version] = "= #{local_spec.version}"
|
opts[:version] = "= #{local_spec.version}"
|
||||||
|
local = true
|
||||||
end
|
end
|
||||||
|
|
||||||
plugins = installed_plugins
|
plugins = installed_plugins
|
||||||
|
@ -45,7 +47,7 @@ module Vagrant
|
||||||
|
|
||||||
result = nil
|
result = nil
|
||||||
install_lambda = lambda do
|
install_lambda = lambda do
|
||||||
Vagrant::Bundler.instance.install(plugins).each do |spec|
|
Vagrant::Bundler.instance.install(plugins, local).each do |spec|
|
||||||
next if spec.name != name
|
next if spec.name != name
|
||||||
next if result && result.version >= spec.version
|
next if result && result.version >= spec.version
|
||||||
result = spec
|
result = spec
|
||||||
|
|
Loading…
Reference in New Issue