semaphore_test_boosters 1.5.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 727d7c5926285ec72949d51f143c2088b761b7d1
4
- data.tar.gz: 44d8f18eb76dd4048b47a24389f137f63e18826b
3
+ metadata.gz: 6bff6de7b2b6b825256febbd7216cbc9c04aa975
4
+ data.tar.gz: d09cebc9ccf010b681e0ff029e50cbb40b917821
5
5
  SHA512:
6
- metadata.gz: e0627ba6468d637e49ea736d1f177097effa556d8a0ed57b77101eda851c7df13b50395f039d40a89107c7dc1677bf5520c281db68ac31d870283103fbb7c709
7
- data.tar.gz: b1c33fffe27780b1678f029d8ddff3fde04f9b324e85a6170cea38cc51496f989cec38682f9214c4b799d7554fbb2a5e795de7859a6c3d5890621fa2de1b5f87
6
+ metadata.gz: f9b2e14becb7b8c927abab15f9e28bac3e37792a5f05be90a80a77ac3d8355faaa50ceaf0682d61031eabe252dae5756824b04c11b89b591a3dd044c9fcc7ee6
7
+ data.tar.gz: 43f80ca1454e626136765aef6617ac0be6e1d09e30513b8ea98125dcefb888c90352bb0da0dcd00bd8b38f3be4f304991ccf1692d170fe7d4f8d0c3a3fc50ea6
data/README.md CHANGED
@@ -7,14 +7,14 @@ Auto Parallelization — runs test files in multiple threads.
7
7
  ## Installation
8
8
 
9
9
  ``` bash
10
- gem install test_boosters
10
+ gem install semaphore_test_boosters
11
11
  ````
12
12
 
13
13
  ## Usage
14
14
 
15
15
  ### RSpec Booster
16
16
 
17
- The RSpec booster command allows you to run one out of several parallel rspec
17
+ The RSpec booster command allows you to run one out of several parallel RSpec
18
18
  threads.
19
19
 
20
20
  ``` bash
@@ -32,9 +32,9 @@ directory with the following content:
32
32
 
33
33
  ``` json
34
34
  [
35
- { :files => ["spec/a_spec.rb", "spec/b_spec.rb"] },
36
- { :files => ["spec/c_spec.rb", "spec/d_spec.rb"] },
37
- { :files => ["spec/e_spec.rb"] }
35
+ { "files": ["spec/a_spec.rb", "spec/b_spec.rb"] },
36
+ { "files": ["spec/c_spec.rb", "spec/d_spec.rb"] },
37
+ { "files": ["spec/e_spec.rb"] }
38
38
  ]
39
39
  ```
40
40
 
@@ -54,9 +54,9 @@ For example, if you have the following split configuration:
54
54
 
55
55
  ``` json
56
56
  [
57
- { :files => ["spec/a_spec.rb"] }
58
- { :files => ["spec/b_spec.rb"] }
59
- { :files => ["spec/c_spec.rb"] }
57
+ { "files": ["spec/a_spec.rb"] }
58
+ { "files": ["spec/b_spec.rb"] }
59
+ { "files": ["spec/c_spec.rb"] }
60
60
  ]
61
61
  ```
62
62
 
@@ -3,7 +3,10 @@
3
3
  require "test_boosters"
4
4
 
5
5
  cli_options = TestBoosters::CliParser.parse
6
- thread_index = cli_options[:index] - 1
7
- cucumber_booster = TestBoosters::Cucumber::Booster.new(thread_index)
6
+
7
+ thread_index = cli_options[:thread_index] - 1
8
+ thread_count = cli_options[:thread_count]
9
+
10
+ cucumber_booster = TestBoosters::Cucumber::Booster.new(thread_index, thread_count)
8
11
 
9
12
  exit(cucumber_booster.run)
@@ -2,8 +2,11 @@
2
2
 
3
3
  require "test_boosters"
4
4
 
5
- cli_options = TestBoosters::CliParser.parse
6
- thread_index = cli_options[:index] - 1
7
- rspec_booster = TestBoosters::Rspec::Booster.new(thread_index)
5
+ cli_options = TestBoosters::CliParser.parse
6
+
7
+ thread_index = cli_options[:thread_index] - 1
8
+ thread_count = cli_options[:thread_count]
9
+
10
+ rspec_booster = TestBoosters::Rspec::Booster.new(thread_index, thread_count)
8
11
 
9
12
  exit(rspec_booster.run)
@@ -6,7 +6,12 @@ module TestBoosters
6
6
  options = {}
7
7
 
8
8
  parser = OptionParser.new do |opts|
9
- opts.on("--thread INDEX") { |index| options[:index] = index.to_i }
9
+ opts.on("--thread INDEX") do |parameter|
10
+ thread_index, thread_count, _rest = parameter.split("/")
11
+
12
+ options[:thread_index] = thread_index.to_i
13
+ options[:thread_count] = thread_count.to_i
14
+ end
10
15
  end
11
16
 
12
17
  parser.parse!
@@ -2,8 +2,12 @@ module TestBoosters
2
2
  module Cucumber
3
3
  class Booster
4
4
 
5
- def initialize(thread_index)
5
+ attr_reader :thread_index
6
+ attr_reader :thread_count
7
+
8
+ def initialize(thread_index, thread_count)
6
9
  @thread_index = thread_index
10
+ @thread_count = thread_count
7
11
  end
8
12
 
9
13
  def run
@@ -18,12 +22,8 @@ module TestBoosters
18
22
  threads[@thread_index].run
19
23
  end
20
24
 
21
- def thread_count
22
- @thread_count ||= split_configuration.thread_count
23
- end
24
-
25
25
  def threads
26
- @threads ||= Array.new(thread_count) do |thread_index|
26
+ @threads ||= Array.new(@thread_count) do |thread_index|
27
27
  known_files = all_specs & split_configuration.files_for_thread(thread_index)
28
28
  leftover_files = TestBoosters::LeftoverFiles.select(all_leftover_specs, thread_count, thread_index)
29
29
 
@@ -2,8 +2,12 @@ module TestBoosters
2
2
  module Rspec
3
3
  class Booster
4
4
 
5
- def initialize(thread_index)
5
+ attr_reader :thread_index
6
+ attr_reader :thread_count
7
+
8
+ def initialize(thread_index, thread_count)
6
9
  @thread_index = thread_index
10
+ @thread_count = thread_count
7
11
  end
8
12
 
9
13
  def run
@@ -18,12 +22,8 @@ module TestBoosters
18
22
  threads[@thread_index].run
19
23
  end
20
24
 
21
- def thread_count
22
- @thread_count ||= split_configuration.thread_count
23
- end
24
-
25
25
  def threads
26
- @threads ||= Array.new(thread_count) do |thread_index|
26
+ @threads ||= Array.new(@thread_count) do |thread_index|
27
27
  known_files = all_specs & split_configuration.files_for_thread(thread_index)
28
28
  leftover_files = TestBoosters::LeftoverFiles.select(all_leftover_specs, thread_count, thread_index)
29
29
 
@@ -32,10 +32,6 @@ module TestBoosters
32
32
  end
33
33
  end
34
34
 
35
- def thread_count
36
- @thread_count ||= threads.count
37
- end
38
-
39
35
  private
40
36
 
41
37
  def load_data
@@ -1,3 +1,3 @@
1
1
  module TestBoosters
2
- VERSION = "1.5.0".freeze
2
+ VERSION = "1.6.0".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: semaphore_test_boosters
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Developers at Rendered Text