Class: Heartcheck::Checks::WatchFile

Inherits:
Base
  • Object
show all
Defined in:
lib/heartcheck/checks/watch_file.rb

Instance Attribute Summary

Attributes inherited from Base

#dev, #doc_url, #functional, #name, #timeout

Instance Method Summary collapse

Methods inherited from Base

#check, #informations, #initialize, #inspect, #on_error, #register_dynamic_services, #services, #to_validate, #uri_info

Constructor Details

This class inherits a constructor from Heartcheck::Checks::Base

Instance Method Details

#add_service(options) ⇒ Object



6
7
8
# File 'lib/heartcheck/checks/watch_file.rb', line 6

def add_service(options)
  services << options.merge(runtime: installed(options[:file]))
end

#infoObject



18
19
20
21
22
# File 'lib/heartcheck/checks/watch_file.rb', line 18

def info
  services.collect do |service|
    { runtime: service[:runtime], installed: installed(service[:file]) }
  end
end

#validateObject



10
11
12
13
14
15
16
# File 'lib/heartcheck/checks/watch_file.rb', line 10

def validate
  services.each do |service|
    if not service[:runtime].eql? installed(service[:file])
      @errors << "App outdated, check /monitoring/info for more details!"
    end
  end
end