Class: Kontena::PluginManager::Cleaner

Inherits:
Object
  • Object
show all
Includes:
Common
Defined in:
lib/kontena/plugin_manager/cleaner.rb

Constant Summary

Constants included from Common

Kontena::PluginManager::Common::KRATES_PLUGIN

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Common

dummy_ui, gem_versions, install_dir, installed, installed?, plugin_debug?, plugins, prefix, rubygems_client, search_plugins, use_dummy_ui

Constructor Details

#initialize(plugin_name) ⇒ Cleaner

Returns a new instance of Cleaner.



11
12
13
# File 'lib/kontena/plugin_manager/cleaner.rb', line 11

def initialize(plugin_name)
  @plugin_name = plugin_name
end

Instance Attribute Details

#plugin_nameObject (readonly)

Returns the value of attribute plugin_name.



9
10
11
# File 'lib/kontena/plugin_manager/cleaner.rb', line 9

def plugin_name
  @plugin_name
end

Instance Method Details

#cleanupObject

Runs gem cleanup, removes remains from previous versions

Parameters:



21
22
23
24
25
26
27
28
29
30
# File 'lib/kontena/plugin_manager/cleaner.rb', line 21

def cleanup
  options = []
  options += ['-q', '--no-verbose'] unless Kontena.debug?
  command.handle_options options
  command.execute
  true
rescue Gem::SystemExitException => e
  raise unless e.exit_code.zero?
  true
end

#commandObject



15
16
17
# File 'lib/kontena/plugin_manager/cleaner.rb', line 15

def command
  @command ||= Gem::Commands::CleanupCommand.new
end