class ExecutionChecker

Public Class Methods

new(dxfile, sps_address: 'sps', verbose: true) click to toggle source
# File lib/execution_checker.rb, line 11
def initialize(dxfile, sps_address: 'sps', verbose: true)

  @dx = Dynarex.new dxfile
  @sps = SPSPub.new host: sps_address
  @verbose = verbose

end

Public Instance Methods

check(tag) click to toggle source
# File lib/execution_checker.rb, line 19
def check(tag)

  rx = @dx.find_by_tag tag

  puts 'checking ...'

  if rx then

    if File.exists? rx.filepath then

      if File.mtime(rx.filepath).to_date == Date.today then

        puts 'success: ' + rx.filepath.inspect if @verbose
        @sps.notice rx.success unless rx.success.empty?

      else
        @sps.notice rx.failure unless rx.failure.empty?
      end

    end

  else

    puts 'execution_checker warning: tag '  + tag + ' not found'

  end

end