Class: Stable::Commands::Remove

Inherits:
Object
  • Object
show all
Defined in:
lib/stable/commands/remove.rb

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Remove

Returns a new instance of Remove.



6
7
8
# File 'lib/stable/commands/remove.rb', line 6

def initialize(name)
  @name = name
end

Instance Method Details

#callObject



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/stable/commands/remove.rb', line 10

def call
  app = Services::AppRegistry.find(@name)
  abort 'App not found' unless app

  Services::ProcessManager.stop(app)
  Services::HostsManager.remove(app[:domain])
  Services::CaddyManager.remove(app[:domain])
  Services::AppRegistry.remove(@name)
  Services::CaddyManager.reload

  puts "Removed #{@name}"
end