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.



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/executor.rb', line 36

def self.execute_hooks(hooks, currentExecutionInfo, should_filter)
  hooks.each do |hook|
    if !should_filter || hook[:options][:tags].empty?
      next hook[:block].call(currentExecutionInfo)
    end
    tags = currentExecutionInfo.currentSpec.tags + get_scenario_tags(currentExecutionInfo)
    intersection = (tags & hook[:options][:tags])
    if (hook[:options][:operator] == 'OR' && !intersection.empty?) ||
       (hook[:options][:operator] == 'AND' && intersection.length == hook[:options][:tags].length)
      hook[:block].call(currentExecutionInfo)
    end
  end
  nil
rescue Exception => e
  e
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.



27
28
29
30
31
32
33
34
# File 'lib/executor.rb', line 27

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

.get_scenario_tags(info) ⇒ 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.



53
54
55
# File 'lib/executor.rb', line 53

def self.get_scenario_tags(info)
  !info.currentScenario.nil? ? info.currentScenario.tags : []
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.



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/executor.rb', line 15

def self.load_steps(dir)
  Dir["#{dir}/**/*.rb"].each do |x|
    begin
      GaugeLog.debug "Loading step implementations from #{x} dirs"
      ENV['GAUGE_STEP_FILE'] = x
      require x
    rescue Exception => e
      GaugeLog.error "Cannot import #{x}. Reason: #{e.message}"
    end
  end
end