Class: Checker

Inherits:
Object
  • Object
show all
Includes:
CheckDSL, DSL
Defined in:
lib/teuton/check/checker.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from CheckDSL

#expect, #expect_exit, #expect_fail, #expect_first, #expect_last, #expect_none, #expect_nothing, #expect_ok, #expect_one, #expect_sequence, #get, #gett, #goto, #log, #readme, #run, #run_script, #service, #set, #target, #unique, #unset, #upload

Methods included from DSL

#expect, #expect2, #expect_any, #expect_exit, #expect_fail, #expect_first, #expect_last, #expect_none, #expect_nothing, #expect_ok, #expect_one, #expect_sequence, #get, #get_host, #gett, #goto, #log, #macro, #method_missing, #readme, #remote_tempdir, #remote_tempfile, #respond_to_missing?, #run, #run_script, #send, #set, #target, #tempdir, #tempfile, #unique, #unset, #upload, #upload_one, #weight

Constructor Details

#initialize(script_path, config_path) ⇒ Checker

Returns a new instance of Checker.



16
17
18
19
20
21
22
23
# File 'lib/teuton/check/checker.rb', line 16

def initialize(script_path, config_path)
  @path = {}
  @path[:script] = script_path
  @path[:dirname] = File.dirname(script_path)
  @path[:filename] = File.basename(script_path, ".rb")
  @path[:config] = config_path
  reset
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class DSL

Instance Attribute Details

#resultObject (readonly)

Returns the value of attribute result.



14
15
16
# File 'lib/teuton/check/checker.rb', line 14

def result
  @result
end

Instance Method Details

#resetObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/teuton/check/checker.rb', line 25

def reset
  @result = Result.new
  @targetid = 0
  @stats = {
    groups: 0,
    targets: 0,
    logs: 0,
    readmes: 0,
    uniques: 0,
    hosts: {},
    gets: {},
    sets: [],
    uploads: []
  }
  @target_begin = nil
end

#showObject



42
43
44
45
46
47
48
# File 'lib/teuton/check/checker.rb', line 42

def show
  Logger.verbose = true
  process_content
  cs = ShowCheck.new(stats: @stats, path: @path)
  cs.show_stats
  cs.revise_config_content
end

#show_onlyconfigObject



50
51
52
53
54
55
56
# File 'lib/teuton/check/checker.rb', line 50

def show_onlyconfig
  Logger.verbose = false
  process_content
  Logger.verbose = true
  cs = ShowCheck.new(stats: @stats, path: @path)
  cs.suggest_config_content
end