Class: Stable::Commands::Remove

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

Overview

Remove command - removes a Rails application

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Remove

Returns a new instance of Remove.



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

def initialize(name)
  @name = name
end

Instance Method Details

#callObject



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

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