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.



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/executor.rb', line 42

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.



33
34
35
36
37
38
39
40
# File 'lib/executor.rb', line 33

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

.load_steps(steps_implementation_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.



23
24
25
26
27
28
29
30
31
# File 'lib/executor.rb', line 23

def self.load_steps(steps_implementation_dir)
  Dir["#{steps_implementation_dir}/**/*.rb"].each { |x|
    begin
      require x
    rescue Exception => e
      puts "[ERROR] Cannot import #{x}. Reason: #{e.message}"
    end
  }
end