Class: Gurke::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/gurke/runner.rb

Direct Known Subclasses

DRbClient, DRbServer, LocalRunner

Defined Under Namespace

Classes: DRbClient, DRbServer, LocalRunner

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config, options = {}) ⇒ Runner

Returns a new instance of Runner.



5
6
7
8
# File 'lib/gurke/runner.rb', line 5

def initialize(config, options = {})
  @config  = config
  @options = options
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



3
4
5
# File 'lib/gurke/runner.rb', line 3

def config
  @config
end

#optionsObject (readonly)

Returns the value of attribute options.



3
4
5
# File 'lib/gurke/runner.rb', line 3

def options
  @options
end

Instance Method Details

#builderObject



14
15
16
# File 'lib/gurke/runner.rb', line 14

def builder
  @builder ||= Builder.new
end

#hook(scope, world, &block) ⇒ Object



28
29
30
# File 'lib/gurke/runner.rb', line 28

def hook(scope, world, &block)
  config.hooks[scope].run world, &block
end

#reporterObject



10
11
12
# File 'lib/gurke/runner.rb', line 10

def reporter
  @reporter ||= Reporters::DefaultReporter.new
end

#run(files, reporter = self.reporter) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/gurke/runner.rb', line 18

def run(files, reporter = self.reporter)
  files.map! do |file|
    split = file.split(':')
    [split[0], split[1..-1].map{|i| Integer(i) }]
  end

  features = builder.load files.map{|file, _| file }
  features.filter(options, files).run self, reporter
end

#with_filtered_backtraceObject



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

def with_filtered_backtrace
  yield
rescue => e
  unless options[:backtrace]
    base = File.expand_path(Gurke.root.dirname)
    e.backtrace.select!{|l| File.expand_path(l)[0...base.size] == base }
  end
  raise
end