Update local usage to env_local for clarity

This commit is contained in:
Chris Roberts 2018-06-25 15:57:32 -07:00
parent 84c0aafe71
commit b71054502e
7 changed files with 21 additions and 20 deletions

View File

@ -121,9 +121,10 @@ module Vagrant
# Installs the list of plugins. # Installs the list of plugins.
# #
# @param [Hash] plugins # @param [Hash] plugins
# @param [Boolean] env_local Environment local plugin install
# @return [Array<Gem::Specification>] # @return [Array<Gem::Specification>]
def install(plugins, local=false) def install(plugins, env_local=false)
internal_install(plugins, nil, local: local) internal_install(plugins, nil, env_local: env_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.
@ -140,7 +141,7 @@ module Vagrant
} }
} }
@logger.debug("Installing local plugin - #{plugin_info}") @logger.debug("Installing local plugin - #{plugin_info}")
internal_install(plugin_info, nil, local: opts[:local]) internal_install(plugin_info, nil, env_local: opts[:env_local])
plugin_source.spec plugin_source.spec
end end
@ -206,7 +207,7 @@ module Vagrant
if env_plugin_gem_path if env_plugin_gem_path
# If we are cleaning locally, remove any global specs. If # If we are cleaning locally, remove any global specs. If
# not, remove any local specs # not, remove any local specs
if opts[:local] if opts[:env_local]
@logger.debug("Removing specifications that are not environment local") @logger.debug("Removing specifications that are not environment local")
plugin_specs.delete_if do |spec| plugin_specs.delete_if do |spec|
spec.full_gem_path.to_s.include?(plugin_gem_path.realpath.to_s) spec.full_gem_path.to_s.include?(plugin_gem_path.realpath.to_s)
@ -361,7 +362,7 @@ module Vagrant
# as we know the dependencies are satisfied and it will attempt to validate a gem's # as we know the dependencies are satisfied and it will attempt to validate a gem's
# dependencies are satisfied by gems in the install directory (which will likely not # dependencies are satisfied by gems in the install directory (which will likely not
# be true) # be true)
install_path = extra[:local] ? env_plugin_gem_path : plugin_gem_path install_path = extra[:env_local] ? env_plugin_gem_path : plugin_gem_path
result = request_set.install_into(install_path.to_s, true, result = request_set.install_into(install_path.to_s, true,
ignore_dependencies: true, ignore_dependencies: true,
prerelease: Vagrant.prerelease?, prerelease: Vagrant.prerelease?,

View File

@ -46,7 +46,7 @@ module VagrantPlugins
dirs = [] dirs = []
# Do not include global paths if local only # Do not include global paths if local only
if !env[:local] if !env[:env_local]
files << Vagrant::Plugin::Manager.instance.user_file files << Vagrant::Plugin::Manager.instance.user_file
dirs << Vagrant::Bundler.instance.plugin_gem_path dirs << Vagrant::Bundler.instance.plugin_gem_path
end end

View File

@ -18,7 +18,7 @@ module VagrantPlugins
plugin_name = env[:plugin_name] plugin_name = env[:plugin_name]
sources = env[:plugin_sources] sources = env[:plugin_sources]
version = env[:plugin_version] version = env[:plugin_version]
local = env[:plugin_local] env_local = env[:plugin_env_local]
# Install the gem # Install the gem
plugin_name_label = plugin_name plugin_name_label = plugin_name
@ -33,7 +33,7 @@ module VagrantPlugins
require: entrypoint, require: entrypoint,
sources: sources, sources: sources,
verbose: !!env[:plugin_verbose], verbose: !!env[:plugin_verbose],
local: local env_local: env_local
) )
# Record it so we can uninstall if something goes wrong # Record it so we can uninstall if something goes wrong

View File

@ -15,7 +15,7 @@ module VagrantPlugins
name: env[:plugin_name])) name: env[:plugin_name]))
manager = Vagrant::Plugin::Manager.instance manager = Vagrant::Plugin::Manager.instance
manager.uninstall_plugin(env[:plugin_name], local: env[:local]) manager.uninstall_plugin(env[:plugin_name], env_local: env[:env_local])
@app.call(env) @app.call(env)
end end

View File

@ -17,7 +17,7 @@ module VagrantPlugins
end end
o.on("--local", "Remove local project plugins only") do |l| o.on("--local", "Remove local project plugins only") do |l|
options[:local] = l options[:env_local] = l
end end
o.on("--reinstall", "Reinstall current plugins after expunge") do |reinstall| o.on("--reinstall", "Reinstall current plugins after expunge") do |reinstall|

View File

@ -20,7 +20,7 @@ module VagrantPlugins
build_install_opts(o, options) build_install_opts(o, options)
o.on("--local", "Install plugin for local project only") do |l| o.on("--local", "Install plugin for local project only") do |l|
options[:local] = l options[:env_local] = l
end end
o.on("--verbose", "Enable verbose output for plugin installation") do |v| o.on("--verbose", "Enable verbose output for plugin installation") do |v|
@ -33,7 +33,7 @@ module VagrantPlugins
return if !argv return if !argv
if argv.length < 1 if argv.length < 1
raise Vagrant::Errors::CLIInvalidUsage, help: opts.help.chomp if !options[:local] raise Vagrant::Errors::CLIInvalidUsage, help: opts.help.chomp if !options[:env_local]
errors = @env.vagrantfile.config.vagrant.validate(nil) errors = @env.vagrantfile.config.vagrant.validate(nil)
if !errors["vagrant"].empty? if !errors["vagrant"].empty?
@ -61,7 +61,7 @@ module VagrantPlugins
plugin_version: info[:version], plugin_version: info[:version],
plugin_sources: info[:sources] || Vagrant::Bundler::DEFAULT_GEM_SOURCES.dup, plugin_sources: info[:sources] || Vagrant::Bundler::DEFAULT_GEM_SOURCES.dup,
plugin_name: name, plugin_name: name,
plugin_local: true plugin_env_local: true
) )
end end
else else
@ -73,7 +73,7 @@ module VagrantPlugins
plugin_sources: options[:plugin_sources], plugin_sources: options[:plugin_sources],
plugin_name: name, plugin_name: name,
plugin_verbose: options[:verbose], plugin_verbose: options[:verbose],
plugin_local: options[:local] plugin_env_local: options[:env_local]
) )
end end
end end

View File

@ -12,7 +12,7 @@ module VagrantPlugins
o.banner = "Usage: vagrant plugin uninstall <name> [<name2> <name3> ...] [-h]" o.banner = "Usage: vagrant plugin uninstall <name> [<name2> <name3> ...] [-h]"
o.on("--local", "Remove plugin from local project") do |l| o.on("--local", "Remove plugin from local project") do |l|
options[:local] = l options[:env_local] = l
end end
end end
@ -23,7 +23,7 @@ module VagrantPlugins
# Uninstall the gems # Uninstall the gems
argv.each do |gem| argv.each do |gem|
action(Action.action_uninstall, plugin_name: gem, local: options[:local]) action(Action.action_uninstall, plugin_name: gem, env_local: options[:env_local])
end end
# Success, exit status 0 # Success, exit status 0