Module: OverseerHelper
- Defined in:
- lib/robot_sweatshop/overseer.rb
Overview
Helper methods for the Overseer Sinatra server
Instance Method Summary collapse
Instance Method Details
#frontpage ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/robot_sweatshop/overseer.rb', line 15 def frontpage context = { jobs: job_list, logs: log_list, api_url: configatron.api_url } template = File.read "#{__dir__}/templates/index.html.eruby" eruby = Erubis::Eruby.new template eruby.result context end |
#job_list ⇒ Object
10 11 12 13 |
# File 'lib/robot_sweatshop/overseer.rb', line 10 def job_list job_path = File. "#{configatron.job_path}" Dir.glob("#{job_path}/*.yaml").map { |path| File.basename path, '.yaml' } end |
#log_list ⇒ Object
5 6 7 8 |
# File 'lib/robot_sweatshop/overseer.rb', line 5 def log_list log_path = File. "#{configatron.logfile_path}" Dir.glob("#{log_path}/*.log").map { |path| File.basename path, '.log' } end |
#log_page_for(process) ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/robot_sweatshop/overseer.rb', line 26 def log_page_for(process) context = { process: process, raw_log: File.read("#{configatron.logfile_path}/#{process}.log") } template = File.read "#{__dir__}/templates/log.html.eruby" eruby = Erubis::Eruby.new template eruby.result context end |