Class: Caruso::Remover

Inherits:
Object
  • Object
show all
Defined in:
lib/caruso/remover.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config_manager) ⇒ Remover

Returns a new instance of Remover.



10
11
12
# File 'lib/caruso/remover.rb', line 10

def initialize(config_manager)
  @config_manager = config_manager
end

Instance Attribute Details

#config_manager ⇒ Object (readonly)

Returns the value of attribute config_manager.



8
9
10
# File 'lib/caruso/remover.rb', line 8

def config_manager
  @config_manager
end

Instance Method Details

#remove_marketplace(name) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/caruso/remover.rb', line 14

def remove_marketplace(name)
  # 1. Remove from config and get associated plugin files/hooks
  result = config_manager.remove_marketplace_with_plugins(name)

  # 2. Delete the actual files and remove hooks
  delete_files(result[:files])
  remove_plugin_hooks(result[:hooks]) if result[:hooks] && !result[:hooks].empty?

  # 3. Clean up registry cache
  remove_from_registry(name)
end

#remove_plugin(name) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/caruso/remover.rb', line 26

def remove_plugin(name)
  # 1. Remove from config
  result = config_manager.remove_plugin(name)

  # 2. Delete files and remove hooks
  delete_files(result[:files])
  remove_plugin_hooks(result[:hooks]) if result[:hooks] && !result[:hooks].empty?
end