From b71054502e41f840bc61d30b1b38017d78048382 Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Mon, 25 Jun 2018 15:57:32 -0700 Subject: [PATCH] Update local usage to env_local for clarity --- lib/vagrant/bundler.rb | 11 ++++++----- plugins/commands/plugin/action/expunge_plugins.rb | 2 +- plugins/commands/plugin/action/install_gem.rb | 12 ++++++------ plugins/commands/plugin/action/uninstall_plugin.rb | 2 +- plugins/commands/plugin/command/expunge.rb | 2 +- plugins/commands/plugin/command/install.rb | 8 ++++---- plugins/commands/plugin/command/uninstall.rb | 4 ++-- 7 files changed, 21 insertions(+), 20 deletions(-) diff --git a/lib/vagrant/bundler.rb b/lib/vagrant/bundler.rb index 18b734064..4f1d145d2 100644 --- a/lib/vagrant/bundler.rb +++ b/lib/vagrant/bundler.rb @@ -121,9 +121,10 @@ module Vagrant # Installs the list of plugins. # # @param [Hash] plugins + # @param [Boolean] env_local Environment local plugin install # @return [Array] - def install(plugins, local=false) - internal_install(plugins, nil, local: local) + def install(plugins, env_local=false) + internal_install(plugins, nil, env_local: env_local) end # Installs a local '*.gem' file so that Bundler can find it. @@ -140,7 +141,7 @@ module Vagrant } } @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 end @@ -206,7 +207,7 @@ module Vagrant if env_plugin_gem_path # If we are cleaning locally, remove any global specs. If # not, remove any local specs - if opts[:local] + if opts[:env_local] @logger.debug("Removing specifications that are not environment local") plugin_specs.delete_if do |spec| 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 # dependencies are satisfied by gems in the install directory (which will likely not # 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, ignore_dependencies: true, prerelease: Vagrant.prerelease?, diff --git a/plugins/commands/plugin/action/expunge_plugins.rb b/plugins/commands/plugin/action/expunge_plugins.rb index 8347a9eef..97d5e907c 100644 --- a/plugins/commands/plugin/action/expunge_plugins.rb +++ b/plugins/commands/plugin/action/expunge_plugins.rb @@ -46,7 +46,7 @@ module VagrantPlugins dirs = [] # Do not include global paths if local only - if !env[:local] + if !env[:env_local] files << Vagrant::Plugin::Manager.instance.user_file dirs << Vagrant::Bundler.instance.plugin_gem_path end diff --git a/plugins/commands/plugin/action/install_gem.rb b/plugins/commands/plugin/action/install_gem.rb index 2612a4db4..6ffabb5ab 100644 --- a/plugins/commands/plugin/action/install_gem.rb +++ b/plugins/commands/plugin/action/install_gem.rb @@ -18,7 +18,7 @@ module VagrantPlugins plugin_name = env[:plugin_name] sources = env[:plugin_sources] version = env[:plugin_version] - local = env[:plugin_local] + env_local = env[:plugin_env_local] # Install the gem plugin_name_label = plugin_name @@ -29,11 +29,11 @@ module VagrantPlugins manager = Vagrant::Plugin::Manager.instance plugin_spec = manager.install_plugin( plugin_name, - version: version, - require: entrypoint, - sources: sources, - verbose: !!env[:plugin_verbose], - local: local + version: version, + require: entrypoint, + sources: sources, + verbose: !!env[:plugin_verbose], + env_local: env_local ) # Record it so we can uninstall if something goes wrong diff --git a/plugins/commands/plugin/action/uninstall_plugin.rb b/plugins/commands/plugin/action/uninstall_plugin.rb index 8e988d1aa..5518581f0 100644 --- a/plugins/commands/plugin/action/uninstall_plugin.rb +++ b/plugins/commands/plugin/action/uninstall_plugin.rb @@ -15,7 +15,7 @@ module VagrantPlugins name: env[:plugin_name])) 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) end diff --git a/plugins/commands/plugin/command/expunge.rb b/plugins/commands/plugin/command/expunge.rb index a59b68a7f..afe4e12ea 100644 --- a/plugins/commands/plugin/command/expunge.rb +++ b/plugins/commands/plugin/command/expunge.rb @@ -17,7 +17,7 @@ module VagrantPlugins end o.on("--local", "Remove local project plugins only") do |l| - options[:local] = l + options[:env_local] = l end o.on("--reinstall", "Reinstall current plugins after expunge") do |reinstall| diff --git a/plugins/commands/plugin/command/install.rb b/plugins/commands/plugin/command/install.rb index 6e9ae9428..3e3e907ac 100644 --- a/plugins/commands/plugin/command/install.rb +++ b/plugins/commands/plugin/command/install.rb @@ -20,7 +20,7 @@ module VagrantPlugins build_install_opts(o, options) o.on("--local", "Install plugin for local project only") do |l| - options[:local] = l + options[:env_local] = l end o.on("--verbose", "Enable verbose output for plugin installation") do |v| @@ -33,7 +33,7 @@ module VagrantPlugins return if !argv 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) if !errors["vagrant"].empty? @@ -61,7 +61,7 @@ module VagrantPlugins plugin_version: info[:version], plugin_sources: info[:sources] || Vagrant::Bundler::DEFAULT_GEM_SOURCES.dup, plugin_name: name, - plugin_local: true + plugin_env_local: true ) end else @@ -73,7 +73,7 @@ module VagrantPlugins plugin_sources: options[:plugin_sources], plugin_name: name, plugin_verbose: options[:verbose], - plugin_local: options[:local] + plugin_env_local: options[:env_local] ) end end diff --git a/plugins/commands/plugin/command/uninstall.rb b/plugins/commands/plugin/command/uninstall.rb index 57534358f..341f4f893 100644 --- a/plugins/commands/plugin/command/uninstall.rb +++ b/plugins/commands/plugin/command/uninstall.rb @@ -12,7 +12,7 @@ module VagrantPlugins o.banner = "Usage: vagrant plugin uninstall [ ...] [-h]" o.on("--local", "Remove plugin from local project") do |l| - options[:local] = l + options[:env_local] = l end end @@ -23,7 +23,7 @@ module VagrantPlugins # Uninstall the gems 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 # Success, exit status 0