Class: Stable::Services::AppRemover

Inherits:
Object
  • Object
show all
Defined in:
lib/stable/services/app_remover.rb

Overview

Service for removing Rails applications

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ AppRemover

Returns a new instance of AppRemover.



7
8
9
# File 'lib/stable/services/app_remover.rb', line 7

def initialize(name)
  @name = name
end

Instance Method Details

#callObject



11
12
13
14
15
16
17
18
19
# File 'lib/stable/services/app_remover.rb', line 11

def call
  app = AppRegistry.fetch(@name)
  ProcessManager.stop(app)
  HostsManager.remove(app[:domain])
  CaddyManager.remove(app[:domain])
  AppRegistry.remove(@name)
  CaddyManager.reload
  puts "✔ #{@name} removed"
end