Class: Daemons::Rails::Monitoring
- Inherits:
-
Object
- Object
- Daemons::Rails::Monitoring
- Extended by:
- Forwardable
- Defined in:
- lib/daemons/rails/monitoring.rb
Class Method Summary collapse
Instance Method Summary collapse
- #controller(app_name) ⇒ Object
- #controllers ⇒ Object
- #daemons_path ⇒ Object
- #daemons_path=(value) ⇒ Object
-
#initialize(daemons_path = nil) ⇒ Monitoring
constructor
A new instance of Monitoring.
- #start(app_name) ⇒ Object
- #statuses ⇒ Object
- #stop(app_name) ⇒ Object
Constructor Details
#initialize(daemons_path = nil) ⇒ Monitoring
Returns a new instance of Monitoring.
18 19 20 |
# File 'lib/daemons/rails/monitoring.rb', line 18 def initialize(daemons_path = nil) @daemons_path = daemons_path end |
Class Method Details
.daemons_directory ⇒ Object
28 29 30 |
# File 'lib/daemons/rails/monitoring.rb', line 28 def self.daemons_directory self.daemons_path end |
.daemons_directory=(value) ⇒ Object
23 24 25 |
# File 'lib/daemons/rails/monitoring.rb', line 23 def self.daemons_directory=(value) self.daemons_path = value end |
.default ⇒ Object
14 15 16 |
# File 'lib/daemons/rails/monitoring.rb', line 14 def self.default @default ||= self.new end |
Instance Method Details
#controller(app_name) ⇒ Object
40 41 42 |
# File 'lib/daemons/rails/monitoring.rb', line 40 def controller(app_name) controllers.find { |controller| controller.app_name == app_name } end |
#controllers ⇒ Object
44 45 46 |
# File 'lib/daemons/rails/monitoring.rb', line 44 def controllers Pathname.glob(daemons_path.join('*_ctl')).map { |path| Daemons::Rails::Controller.new(path) } end |
#daemons_path ⇒ Object
36 37 38 |
# File 'lib/daemons/rails/monitoring.rb', line 36 def daemons_path @daemons_path || Daemons::Rails.configuration.daemons_path end |
#daemons_path=(value) ⇒ Object
32 33 34 |
# File 'lib/daemons/rails/monitoring.rb', line 32 def daemons_path=(value) @daemons_path = value end |
#start(app_name) ⇒ Object
52 53 54 |
# File 'lib/daemons/rails/monitoring.rb', line 52 def start(app_name) controller(app_name).start end |
#statuses ⇒ Object
48 49 50 |
# File 'lib/daemons/rails/monitoring.rb', line 48 def statuses controllers.each_with_object({}) { |controller, statuses| statuses[controller.app_name] = controller.status } end |
#stop(app_name) ⇒ Object
56 57 58 |
# File 'lib/daemons/rails/monitoring.rb', line 56 def stop(app_name) controller(app_name).stop end |