Module: Gauge::Executor Private

Defined in:
lib/executor.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Class Method Summary collapse

Class Method Details

.execute_hooks(hooks, currentExecutionInfo, should_filter) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/executor.rb', line 61

def self.execute_hooks(hooks, currentExecutionInfo, should_filter)
  begin
    hooks.each do |hook|
      if !should_filter || hook[:options][:tags].length == 0
        next hook[:block].call(currentExecutionInfo)
      end
      tags = currentExecutionInfo.currentSpec.tags + currentExecutionInfo.currentScenario.tags
      intersection = (tags & hook[:options][:tags])
      if (hook[:options][:operator] == 'OR' && intersection.length > 0) ||
          (hook[:options][:operator] == 'AND' && intersection.length == hook[:options][:tags].length)
        hook[:block].call(currentExecutionInfo)
      end
    end
    return nil
  rescue Exception => e
    return e
  end
end

.execute_step(step, args) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



52
53
54
55
56
57
58
59
# File 'lib/executor.rb', line 52

def self.execute_step(step, args)
  si = MethodCache.get_step_info step
  if args.size == 1
    si[:block].call(args[0])
  else
    si[:block].call(args)
  end
end

.load_steps(dir) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/executor.rb', line 29

def self.load_steps(dir)
  start_debugger
  Dir["#{dir}/**/*.rb"].each do |x|
    begin
      ENV['GAUGE_STEP_FILE'] = x
      require x
    rescue Exception => e
      Gauge::Log.error "[ERROR] Cannot import #{x}. Reason: #{e.message}"
    end
  end
end

.start_debuggerObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



41
42
43
44
45
46
47
48
49
50
# File 'lib/executor.rb', line 41

def self.start_debugger
  if ENV['DEBUGGING']
    options = DebugOptions.new
    options.host = '127.0.0.1'
    options.port = ENV["DEBUG_PORT"].to_i
    options.notify_dispatcher = false
    Gauge::Log.info ATTACH_DEBUGGER_EVENT
    Debugger.prepare_debugger(options)
  end
end