Class: ExecutionChecker

Inherits:
Object
  • Object
show all
Defined in:
lib/execution_checker.rb

Instance Method Summary collapse

Constructor Details

#initialize(dxfile, sps_address: 'sps', verbose: true) ⇒ ExecutionChecker

Returns a new instance of ExecutionChecker.



11
12
13
14
15
16
17
# 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

Instance Method Details

#check(tag) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# 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