remove setup! and add :clean to uninstall

This commit is contained in:
Colin Surprenant 2015-04-22 17:42:16 +02:00
parent b4c3d1ef33
commit f8f2609c1b
2 changed files with 3 additions and 6 deletions

View file

@ -13,8 +13,6 @@ class LogStash::PluginManager::Uninstall < LogStash::PluginManager::Command
parameter "PLUGIN", "plugin name"
def execute
LogStash::Bundler.setup!
signal_error("File #{LogStash::Environment::GEMFILE_PATH} does not exist or is not writable, aborting") unless File.writable?(LogStash::Environment::GEMFILE_PATH)
# make sure this is an installed plugin and present in Gemfile.
@ -30,7 +28,7 @@ class LogStash::PluginManager::Uninstall < LogStash::PluginManager::Command
# any errors will be logged to $stderr by invoke_bundler!
# output, exception = LogStash::Bundler.invoke_bundler!(:install => true, :clean => true)
output = LogStash::Bundler.invoke_bundler!(:install => true)
output = LogStash::Bundler.invoke_bundler!(:install => true, :clean => true)
remove_unused_locally_installed_gems!
end

View file

@ -18,7 +18,7 @@ class LogStash::PluginManager::Update < LogStash::PluginManager::Command
error_plugin_that_use_path!(local_gems)
else
plugins_with_path = plugins_arg & local_gems
error_plugin_that_use_path!(plugins_with_path) if plugins_with_path.size > 0
error_plugin_that_use_path!(plugins_with_path) if plugins_with_path.size > 0
end
update_gems!
@ -52,7 +52,7 @@ class LogStash::PluginManager::Update < LogStash::PluginManager::Command
# any errors will be logged to $stderr by invoke_bundler!
# Bundler cannot update and clean gems in one operation so we have to call the CLI twice.
output = LogStash::Bundler.invoke_bundler!(:update => plugins)
output = LogStash::Bundler.invoke_bundler!(:clean => true)
output = LogStash::Bundler.invoke_bundler!(:clean => true)
display_updated_plugins(previous_gem_specs_map)
rescue => exception
@ -95,7 +95,6 @@ class LogStash::PluginManager::Update < LogStash::PluginManager::Command
# retrieve only the latest spec for all locally installed plugins
# @return [Hash] result hash {plugin_name.downcase => plugin_spec}
def find_latest_gem_specs
LogStash::Bundler.setup!
LogStash::PluginManager.find_plugins_gem_specs.inject({}) do |result, spec|
previous = result[spec.name.downcase]
result[spec.name.downcase] = previous ? [previous, spec].max_by{|s| s.version} : spec