Class: Gurke::Runner
- Inherits:
-
Object
show all
- Defined in:
- lib/gurke/runner.rb
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
#config ⇒ Object
Returns the value of attribute config.
3
4
5
|
# File 'lib/gurke/runner.rb', line 3
def config
@config
end
|
#options ⇒ Object
Returns the value of attribute options.
3
4
5
|
# File 'lib/gurke/runner.rb', line 3
def options
@options
end
|
Instance Method Details
#builder ⇒ Object
17
18
19
|
# File 'lib/gurke/runner.rb', line 17
def builder
@builder ||= Builder.new
end
|
#hook(scope, world, context, &block) ⇒ Object
31
32
33
|
# File 'lib/gurke/runner.rb', line 31
def hook(scope, world, context, &block)
config.hooks[scope].run world, context, &block
end
|
#reporter ⇒ Object
10
11
12
13
14
15
|
# File 'lib/gurke/runner.rb', line 10
def reporter
@reporter ||= begin
r = (options[:formatter] + '_reporter').split('_').map(&:capitalize).join
Reporters.const_get(r).new
end
end
|
#run(files, reporter = self.reporter) ⇒ Object
21
22
23
24
25
26
27
28
29
|
# File 'lib/gurke/runner.rb', line 21
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_backtrace ⇒ Object
35
36
37
38
39
40
41
42
43
|
# File 'lib/gurke/runner.rb', line 35
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
|