Skip to content

Commit

Permalink
remove setup! and add :clean to uninstall
Browse files Browse the repository at this point in the history
  • Loading branch information
colinsurprenant committed Apr 22, 2015
1 parent b4c3d1e commit f8f2609
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
4 changes: 1 addition & 3 deletions lib/logstash/pluginmanager/uninstall.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -30,7 +28,7 @@ def execute

# 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
Expand Down
5 changes: 2 additions & 3 deletions lib/logstash/pluginmanager/update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def execute
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!
Expand Down Expand Up @@ -52,7 +52,7 @@ def update_gems!
# 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
Expand Down Expand Up @@ -95,7 +95,6 @@ def display_updated_plugins(previous_gem_specs_map)
# 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
Expand Down

0 comments on commit f8f2609

Please sign in to comment.