Class: MockWS::Configuration::Checker

Inherits:
Object
  • Object
show all
Extended by:
Carioca::Injector
Defined in:
lib/mockws/setup.rb

Class Method Summary collapse

Class Method Details

.sanitycheckObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/mockws/setup.rb', line 27

def self.sanitycheck
  global_status = []
  output.info "Checking path for #{Etc.getpwuid(Process.uid).name} : "
  status = { true => :ok, false => :error }
  [DEFAULT_PATH,DEFAULT_CONFIG_PATH,DEFAULT_LOGS_PATH].each do |path|
    res = status[File::exist?(File::expand_path(path))]
    output.send res, path
    global_status.push res
  end
  output.info "Checking file for #{Etc.getpwuid(Process.uid).name} : "
  
  ["#{DEFAULT_CONFIG_PATH}/#{DEFAULT_SETTINGS_FILENAME}","#{DEFAULT_LOGS_PATH}/#{DEFAULT_LOG_FILENAME}"].each do |file|
    res = status[File::exist?(File::expand_path(file))]
    output.send res, file
    global_status.push res

  end
  finisher.secure_raise error_case: :sanitycheck_error, 
                        message: "MocKWS configuration error for #{Etc.getpwuid(Process.uid).name}" if global_status.include? :error
  

end