semaphore_test_boosters 1.6.2 → 1.7.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: df85dec09c1a32896336062203c66c589f66812e
4
- data.tar.gz: 4a9c3efd75db2ff2374a0888476b4c329a2812e5
3
+ metadata.gz: d2d856d4423e513d330d8ac0e488916dd7086917
4
+ data.tar.gz: b75f81f4225d010278f15d2c6ac3261833dee343
5
5
  SHA512:
6
- metadata.gz: 91cae9271ceeb83e3e57f376a157917fbb71e179d337de6a07e001029c43244cdc6cba98bc8958bec4d6620e01a624fa257c14b1cd3c4be0015a1ffeff060f19
7
- data.tar.gz: 23285fca6e7c98434685aa03967b849adc2d19fa2448e3c0e831032e9fed0b6eb2035f00bb1e14a22a3ec100d7f8d7ba98991ca6b37aede537e6b3cf802eb22e
6
+ metadata.gz: 315807874e3dd7792d1bb3c52549667924e6a54974de2b1354c2b714469610a4c8d68813a72d96f076497e0bd1214eca462ad9dee8cdf074fbad9c8b6acdb9e6
7
+ data.tar.gz: 5040e37162ced1bbb7de4663070d36442e0e236699b2772e685716247ae4503de562054a324da415917eb0675b5c50b9ca451a1ea99bdbced17f092be5497e6d
data/.rubocop.yml CHANGED
@@ -90,3 +90,15 @@ RSpec/SubjectStub:
90
90
 
91
91
  RSpec/DescribeClass:
92
92
  Enabled: false
93
+
94
+ RSpec/LeadingSubject:
95
+ Enabled: false
96
+
97
+ Style/WordArray:
98
+ Enabled: false
99
+
100
+ RSpec/NotToNot:
101
+ Enabled: false
102
+
103
+ Metrics/MethodLength:
104
+ Enabled: false
@@ -11,24 +11,17 @@ module TestBoosters
11
11
  end
12
12
 
13
13
  def run
14
+ TestBoosters::Shell.display_title("Cucumber Booster v#{TestBoosters::VERSION}")
14
15
  display_system_info
15
16
 
16
- unless split_configuration.valid?
17
- puts "[ERROR] The split configuration file is malformed!"
18
-
19
- return 1 # failure exit status
20
- end
21
-
22
17
  threads[@thread_index].run
23
18
  end
24
19
 
25
20
  def display_system_info
26
- TestBoosters::Shell.display_title("Cucumber Booster v#{TestBoosters::VERSION}")
27
-
28
21
  TestBoosters::ProjectInfo.display_ruby_version
29
22
  TestBoosters::ProjectInfo.display_bundler_version
30
23
  TestBoosters::ProjectInfo.display_cucumber_version
31
-
24
+ TestBoosters::ProjectInfo.display_split_configuration_info(split_configuration)
32
25
  puts
33
26
  end
34
27
 
@@ -26,5 +26,11 @@ module TestBoosters
26
26
  puts "Cucumber Version: #{version}"
27
27
  end
28
28
 
29
+ def display_split_configuration_info(split_configuration)
30
+ puts "Split configuration present: #{split_configuration.present? ? "yes" : "no"}"
31
+ puts "Split configuration valid: #{split_configuration.valid? ? "yes" : "no"}"
32
+ puts "Split configuration file count: #{split_configuration.all_files.size}"
33
+ end
34
+
29
35
  end
30
36
  end
@@ -11,24 +11,17 @@ module TestBoosters
11
11
  end
12
12
 
13
13
  def run
14
+ TestBoosters::Shell.display_title("RSpec Booster v#{TestBoosters::VERSION}")
14
15
  display_system_info
15
16
 
16
- unless split_configuration.valid?
17
- puts "[ERROR] The split configuration file is malformed!"
18
-
19
- return 1 # failure exit status
20
- end
21
-
22
17
  threads[@thread_index].run
23
18
  end
24
19
 
25
20
  def display_system_info
26
- TestBoosters::Shell.display_title("RSpec Booster v#{TestBoosters::VERSION}")
27
-
28
21
  TestBoosters::ProjectInfo.display_ruby_version
29
22
  TestBoosters::ProjectInfo.display_bundler_version
30
23
  TestBoosters::ProjectInfo.display_rspec_version
31
-
24
+ TestBoosters::ProjectInfo.display_split_configuration_info(split_configuration)
32
25
  puts
33
26
  end
34
27
 
@@ -5,6 +5,7 @@ module TestBoosters
5
5
 
6
6
  def initialize(path)
7
7
  @path = path
8
+ @valid = true
8
9
  end
9
10
 
10
11
  def present?
@@ -13,9 +14,8 @@ module TestBoosters
13
14
 
14
15
  def valid?
15
16
  threads # try to load data into memory
16
- true
17
- rescue
18
- false
17
+
18
+ @valid
19
19
  end
20
20
 
21
21
  def all_files
@@ -23,23 +23,41 @@ module TestBoosters
23
23
  end
24
24
 
25
25
  def files_for_thread(thread_index)
26
- threads[thread_index].files
26
+ thread = threads[thread_index]
27
+
28
+ thread ? thread.files : []
27
29
  end
28
30
 
29
31
  def threads
30
- @threads ||= load_data.map.with_index do |raw_thread, index|
31
- TestBoosters::SplitConfiguration::Thread.new(raw_thread["files"].sort, index)
32
- end
32
+ @threads ||= present? ? load_data : []
33
33
  end
34
34
 
35
35
  private
36
36
 
37
+ # :reek:TooManyStatements
37
38
  def load_data
38
- if present?
39
- JSON.parse(File.read(@path))
40
- else
41
- []
39
+ @valid = false
40
+
41
+ content = JSON.parse(File.read(@path)).map.with_index do |raw_thread, index|
42
+ TestBoosters::SplitConfiguration::Thread.new(raw_thread.fetch("files").sort, index)
42
43
  end
44
+
45
+ @valid = true
46
+
47
+ content
48
+ rescue TypeError, KeyError => ex
49
+ log_error("Split Configuration has invalid structure", ex)
50
+
51
+ []
52
+ rescue JSON::ParserError => ex
53
+ log_error("Split Configuration is not parsable", ex)
54
+
55
+ []
56
+ end
57
+
58
+ def log_error(message, exception)
59
+ TestBoosters::Logger.error(message)
60
+ TestBoosters::Logger.error(exception.inspect)
43
61
  end
44
62
 
45
63
  end
@@ -1,3 +1,3 @@
1
1
  module TestBoosters
2
- VERSION = "1.6.2".freeze
2
+ VERSION = "1.7.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.6.2
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Developers at Rendered Text