gurke 2.0.0.dev.1.b23 → 2.0.0.dev.1.b24

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YTBkYzBmMmU5NzdhYzRhYzRiYmIwOTU1NWZjOWM0OTFiOTMzYTk2NQ==
4
+ ZTk5NTMwMzIxYWU5ZWU4NzM0ODk4YzFmZTczYTZkMjQ2YzRhMzVjZg==
5
5
  data.tar.gz: !binary |-
6
- ODM1MDFmOTkzYmNmMzYwZWQ4NGE5NGE5YzQyZmM3ODc3ZjhmMTc0ZQ==
6
+ N2RjYTQxMjE3YmRkMjE1ZjBlZThlOGI0ZjA0OTMwNTFjN2ViOWEzMQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ODgyZmE5NDgzYzllNjQ2YjhiNDFlYTA1NjYzZGE2ODc5ODhlZTM2YWY5ODFm
10
- ZmY4ODZkMjQ0NDY1NjhjNmNjNjdlZWY2YzhkZWUxYTJhY2IzZTdkNWRiZmVm
11
- YThhZGUxNDQwNjg4NjcyNDMwNWZmNzI0N2M0NWYwNzk1NWY5ZjY=
9
+ YzM5NDlkMzg4NTQyZThmZTY4YzNiZTNjZGZmMWJiOWM3YjYzYTY4MDQ3YWE3
10
+ ZDUyOWM2OWRlMzJkYjI0ZTY0ZDgxNThkYmVlN2M4NzdjYzAyNzczODcyNjZi
11
+ M2ExNTFjMzQxZjIzZmRiZjAxYWU4YzNlNDI3NzY3YjNlMTVlZmE=
12
12
  data.tar.gz: !binary |-
13
- ODI2ZWVmODVmYjUyZTIzNTQ2MDNjZTEzZTczYjg5ODcxNjA2ZTM5ZDQxOTM5
14
- MDJhNmI3MjNiOGMyZTAxMDc5ZmJkNGRhOTY5NjY1Njk3NjgyYWUyYmMxMjdm
15
- OWU0NGFmZWUzZGEzMjUxNzdhMzQ0M2JmZWNiOWJiNDI1NzhkY2I=
13
+ ZjAwOTNhMDQyOTQ0M2ZkZWIzZmExY2FmYmExOGIxZjJjYjk4N2U5MzhlNmI2
14
+ OTI0ODQ0YzJhYWE0MDY2OWY1YWIwMzBhOTE5ZmVhMzAwMmJiNTgzYWQwMzhh
15
+ YTExYzAxODVhMDk3NGE1MjlmZTRiNTk3OTE4ZTQ4NGJjZTk5MDY=
data/lib/gurke/cli.rb CHANGED
@@ -29,9 +29,17 @@ module Gurke
29
29
  end if options[:require].any?
30
30
 
31
31
  files = Dir[options[:pattern].to_s] if files.empty? && options[:pattern]
32
- status = Runner.new(Gurke.config, files, options).run
32
+ files.map!{|f| File.expand_path(f) }
33
33
 
34
- Kernel.exit(status)
34
+ runner = if options[:drb_server]
35
+ Runner::DRbServer
36
+ elsif options[:drb]
37
+ Runner::DRbClient
38
+ else
39
+ Runner::LocalRunner
40
+ end.new Gurke.config, options
41
+
42
+ Kernel.exit runner.run files
35
43
  end
36
44
 
37
45
  def print_version
@@ -61,6 +69,8 @@ module Gurke
61
69
  'filtering expression. TODO: Description.',
62
70
  default: ['~wip'],
63
71
  multi: true
72
+ opt :drb_server
73
+ opt :drb
64
74
  end
65
75
  end
66
76
  end
@@ -68,10 +68,11 @@ module Gurke
68
68
  features: HookSet.new,
69
69
  feature: HookSet.new,
70
70
  scenario: HookSet.new,
71
- step: HookSet.new
71
+ step: HookSet.new,
72
+ system: HookSet.new
72
73
  }
73
74
 
74
- hooks.merge each: hooks[:scenario]
75
+ hooks.merge! each: hooks[:scenario]
75
76
  hooks
76
77
  end
77
78
  end
@@ -14,6 +14,11 @@ module Gurke::Reporters
14
14
  # That includes colorized step results reports etc.
15
15
  #
16
16
  class DefaultReporter < NullReporter
17
+ attr_reader :io
18
+ def initialize(io = $stdout)
19
+ @io = io
20
+ end
21
+
17
22
  def before_feature(feature)
18
23
  io.puts "#{yellow('Feature')}: #{feature.name}"
19
24
  io.puts ' ' + light_black(feature.description.split("\n").join("\n "))
@@ -22,10 +27,13 @@ module Gurke::Reporters
22
27
 
23
28
  def before_scenario(scenario)
24
29
  io.puts " #{yellow('Scenario')}: #{scenario.name}"
25
- io.puts light_black(' Background:') if scenario.backgrounds.any?
26
30
  end
27
31
 
28
32
  def start_background(*)
33
+ unless @background
34
+ io.puts light_black(' Background:')
35
+ end
36
+
29
37
  @background = true
30
38
  end
31
39
 
@@ -84,10 +92,6 @@ module Gurke::Reporters
84
92
  io.puts red(" #{step.exception.backtrace.join("\n ")}")
85
93
  end
86
94
 
87
- def io
88
- $stdout
89
- end
90
-
91
95
  [:black, :red, :green, :yellow, :blue,
92
96
  :magenta, :cyan, :white, :default, :light_black,
93
97
  :light_red, :light_green, :light_yellow, :light_blue,
data/lib/gurke/runner.rb CHANGED
@@ -1,26 +1,26 @@
1
1
  module Gurke
2
2
  class Runner
3
- attr_reader :builder
4
- attr_reader :files
5
- attr_reader :options
6
- attr_reader :config
3
+ attr_reader :config, :options
7
4
 
8
- def initialize(config, files, options = {})
5
+ def initialize(config, options = {})
9
6
  @config = config
10
7
  @options = options
11
- @files = files
12
- @builder = Builder.new options
13
8
  end
14
9
 
15
10
  def reporter
16
11
  @reporter ||= Reporters::DefaultReporter.new
17
12
  end
18
13
 
19
- def run
14
+ def load_feature_set(files)
15
+ builder = Builder.new options
20
16
  files.each{|f| builder.parse(f) }
17
+
21
18
  features = builder.features
22
19
  features.freeze
20
+ end
23
21
 
22
+ def run(files, reporter = self.reporter)
23
+ features = load_feature_set files
24
24
  features.run self, reporter
25
25
  end
26
26
 
@@ -37,5 +37,53 @@ module Gurke
37
37
  end
38
38
  raise
39
39
  end
40
+
41
+ class LocalRunner < Runner
42
+ def run(files, reporter = self.reporter)
43
+ features = load_feature_set files
44
+
45
+ hook :system, nil do
46
+ features.run self, reporter
47
+ end
48
+ end
49
+ end
50
+
51
+ class DRbServer < Runner
52
+ URI = 'druby://localhost:8789'
53
+
54
+ def run(files)
55
+ require 'drb'
56
+
57
+ hook :system, nil do
58
+ DRb.start_service URI, self
59
+ $stdout.puts 'DRb Server running...'
60
+
61
+ begin
62
+ DRb.thread.join
63
+ rescue Interrupt
64
+ $stdout.puts
65
+ $stdout.puts 'Exiting...'
66
+ end
67
+
68
+ 0
69
+ end
70
+ end
71
+
72
+ def run_remote(options, files, reporter)
73
+ Runner.new(config, options).run files, reporter
74
+ end
75
+ end
76
+
77
+ class DRbClient < Runner
78
+ def run(files)
79
+ require 'drb'
80
+
81
+ DRb.start_service
82
+ $stdout.puts 'Connect to DRb server...'
83
+
84
+ srv = DRbObject.new_with_uri DRbServer::URI
85
+ srv.run_remote options, files, reporter
86
+ end
87
+ end
40
88
  end
41
89
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gurke
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.dev.1.b23
4
+ version: 2.0.0.dev.1.b24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Graichen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-03 00:00:00.000000000 Z
11
+ date: 2014-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: trollop