Class: Kontena::PluginManager::Uninstaller

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

Constant Summary

Constants included from Common

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) ⇒ Uninstaller

Returns a new instance of Uninstaller.



10
11
12
# File 'lib/kontena/plugin_manager/uninstaller.rb', line 10

def initialize(plugin_name)
  @plugin_name = plugin_name
end

Instance Attribute Details

#plugin_nameObject (readonly)

Returns the value of attribute plugin_name.



8
9
10
# File 'lib/kontena/plugin_manager/uninstaller.rb', line 8

def plugin_name
  @plugin_name
end

Instance Method Details

#command(spec) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/kontena/plugin_manager/uninstaller.rb', line 14

def command(spec)
  @command ||= Gem::Uninstaller.new(
    spec.name,
    all: true,
    executables: true,
    force: true,
    install_dir: spec.base_dir
  )
end

#uninstallObject

Uninstall a plugin

Parameters:



26
27
28
29
30
31
# File 'lib/kontena/plugin_manager/uninstaller.rb', line 26

def uninstall
  installed = installed(plugin_name)
  raise "Plugin #{plugin_name} not installed" unless installed

  command(installed).uninstall
end