Class: Stable::Services::AppStopper

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

Overview

Service for stopping Rails applications

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ AppStopper

Returns a new instance of AppStopper.



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

def initialize(name)
  @app = AppRegistry.fetch(name)
end

Instance Method Details

#callObject



11
12
13
14
15
# File 'lib/stable/services/app_stopper.rb', line 11

def call
  ProcessManager.stop(@app)
  AppRegistry.mark_stopped(@app[:name])
  puts "#{@app[:name]} stopped"
end