cukeforker 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f0a71153dc8250ce79cb7ed2b93ed9bc153f1adb
4
- data.tar.gz: a509ebde9c5946ddd5bc51e0175a9afedbadf632
3
+ metadata.gz: c97c06d29ce5a9948bf8cd30b8a7a8685aee2596
4
+ data.tar.gz: 8b9f43ba7f53e6501a896fd924d39812e1392440
5
5
  SHA512:
6
- metadata.gz: da6c6dca2c50581ba380f3be11031561e72c8c7eaf424e6ad15c2c91b2a80cf4c6ae2abdc93ae5a2432afc4dd24ccb316b2a9adc136f228c3c3a0cb4541d75c6
7
- data.tar.gz: 3f0381d1203723e7962a0c9aa4f5e7895a8978acc3be1ed5cac55f0d0f0f97989fb7c6bf7fd296d033c58611b619d044845db08f066841ce3c57e0df6d4770c0
6
+ metadata.gz: 192e850138726137effab9b5cc07e8149dd0b1730b9eb19a27aa9ed9ee3fc04a253938c2e1e9ffe776d3ce153a1892b3805dd96d932303ad85731c98ae84d2e2
7
+ data.tar.gz: 26639c5e02f9dc75e28748880897d928be38a9501351dbfaa7fd2763cfe7d030f95983c01177df49e35f08b04a97d73a1f659b73f327765b3485014b60fa2cad
data/.gitignore CHANGED
@@ -5,3 +5,4 @@ Gemfile.lock
5
5
  \#*
6
6
  .\#*
7
7
  .idea
8
+ .ruby-version
data/.travis.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  rvm:
2
- - 1.8.7
3
2
  - 1.9.2
4
- - 1.9.3
3
+ - 1.9.3
4
+ - 2.0.0
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2011-2013 Jari Bakken
1
+ Copyright (c) 2011-2014 Jari Bakken
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.mdown CHANGED
@@ -7,6 +7,7 @@ Forking cukes and VNC displays.
7
7
 
8
8
  Usage
9
9
  =============
10
+
10
11
  ```ruby
11
12
  # parallelize per feature
12
13
  CukeForker::Runner.run Dir['features/**/*.feature'],
@@ -15,7 +16,7 @@ Usage
15
16
  :format => :html # passed to `cucumber --format`,
16
17
  :extra_args => %w[--extra arguments] # passed to cucumber,
17
18
  :vnc => true # manage a pool of VNC displays, assign one per worker.
18
-
19
+
19
20
  # parallelize per scenario, with one JUnit XML file per scenario.
20
21
  CukeForker::Runner.run CukeForker::Scenarios.tagged(%W[@edition ~@wip])
21
22
  :extra_args => %W[-f CukeForker::Formatters::JunitScenarioFormatter --out results/junit]
@@ -35,5 +36,5 @@ Note on Patches/Pull Requests
35
36
  Copyright
36
37
  =========
37
38
 
38
- Copyright (c) 2011-2013 Jari Bakken. See LICENSE for details.
39
+ Copyright (c) 2011-2014 Jari Bakken. See LICENSE for details.
39
40
 
@@ -18,6 +18,7 @@ module CukeForker
18
18
  # :log => true/false wether or not to log to stdout (default: true)
19
19
  # :format => Symbol format passed to `cucumber --format` (default: html)
20
20
  # :extra_args => Array extra arguments passed to cucumber
21
+ # :delay => Numeric seconds to sleep between each worker is started (default: 0)
21
22
  #
22
23
 
23
24
  class Runner
@@ -30,7 +31,8 @@ module CukeForker
30
31
  :notify => nil,
31
32
  :out => Dir.pwd,
32
33
  :log => true,
33
- :format => :html
34
+ :format => :html,
35
+ :delay => 0
34
36
  }
35
37
 
36
38
  def self.run(features, opts = {})
@@ -45,6 +47,7 @@ module CukeForker
45
47
  out = File.join opts[:out]
46
48
  listeners = Array(opts[:notify])
47
49
  extra_args = Array(opts[:extra_args])
50
+ delay = opts[:delay]
48
51
 
49
52
  if opts[:log]
50
53
  listeners << LoggingListener.new
@@ -70,7 +73,7 @@ module CukeForker
70
73
  end
71
74
  end
72
75
 
73
- queue = WorkerQueue.new max
76
+ queue = WorkerQueue.new max, delay
74
77
  features.each do |feature|
75
78
  queue.add Worker.new(feature, format, out, extra_args)
76
79
  end
@@ -1,3 +1,3 @@
1
1
  module CukeForker
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -82,6 +82,10 @@ module CukeForker
82
82
  $stderr.reopen stderr
83
83
 
84
84
  failed = Cucumber::Cli::Main.execute args
85
+
86
+ $stdout.flush
87
+ $stderr.flush
88
+
85
89
  exit failed ? 1 : 0
86
90
  end
87
91
 
@@ -2,13 +2,18 @@ module CukeForker
2
2
  class WorkerQueue
3
3
  include Observable
4
4
 
5
- def initialize(max)
5
+ def initialize(max, delay)
6
6
  @max = max
7
+ @delay = delay
7
8
 
8
9
  if @max < 0
9
10
  raise ArgumentError, "max workers cannot be negative, got #{@max.inspect}"
10
11
  end
11
12
 
13
+ unless @delay.kind_of?(Numeric)
14
+ raise ArgumentError, "delay must be Numeric, got #{@delay.inspect}:#{@delay.class}"
15
+ end
16
+
12
17
  @pending = []
13
18
  @running = []
14
19
  @finished = []
@@ -108,6 +113,8 @@ module CukeForker
108
113
 
109
114
  worker.start
110
115
  @running << worker
116
+
117
+ sleep @delay
111
118
  end
112
119
 
113
120
  def finish(worker)
@@ -13,13 +13,14 @@ module CukeForker
13
13
  listeners = [double(AbstractListener, :update => nil)]
14
14
  log = false
15
15
  features = %w[a b]
16
+ delay = 1
16
17
 
17
18
  mock_queue = double(WorkerQueue)
18
19
  mock_workers = Array.new(2) { |n| double("Worker-#{n}") }
19
20
 
20
21
  Process.stub(:pid => 1234)
21
22
 
22
- WorkerQueue.should_receive(:new).with(max).and_return mock_queue
23
+ WorkerQueue.should_receive(:new).with(max, 1).and_return mock_queue
23
24
  Worker.should_receive(:new).with("a", :json, "/tmp", []).and_return mock_workers[0]
24
25
  Worker.should_receive(:new).with("b", :json, "/tmp", []).and_return mock_workers[1]
25
26
 
@@ -32,7 +33,8 @@ module CukeForker
32
33
  :notify => listeners,
33
34
  :format => format,
34
35
  :log => false,
35
- :out => out
36
+ :out => out,
37
+ :delay => 1
36
38
  ).should be_kind_of(Runner)
37
39
  end
38
40
 
@@ -3,7 +3,7 @@ require File.expand_path("../../spec_helper", __FILE__)
3
3
  module CukeForker
4
4
  describe WorkerQueue do
5
5
  let(:workers) { Array.new(5) { |n| double("Worker-#{n}") } }
6
- let(:queue) { WorkerQueue.new(3) }
6
+ let(:queue) { WorkerQueue.new(3, 0) }
7
7
 
8
8
  it "adds an item to the queue" do
9
9
  queue.should_not be_backed_up
@@ -29,7 +29,7 @@ module CukeForker
29
29
  end
30
30
 
31
31
  it "is unlimited if max workers = 0" do
32
- unlimited_queue = WorkerQueue.new(0)
32
+ unlimited_queue = WorkerQueue.new(0, 0)
33
33
 
34
34
  workers.each { |w| queue.add double.as_null_object }
35
35
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cukeforker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jari Bakken
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-11 00:00:00.000000000 Z
11
+ date: 2014-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber
@@ -138,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
138
  version: '0'
139
139
  requirements: []
140
140
  rubyforge_project: cukeforker
141
- rubygems_version: 2.0.0
141
+ rubygems_version: 2.1.10
142
142
  signing_key:
143
143
  specification_version: 4
144
144
  summary: Library to maintain a forking queue of Cucumber processes