dotpretty 0.4.0 → 0.5.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
  SHA256:
3
- metadata.gz: 4eb5b101ffb92e9cbcee0ba034ea86fe9558be0a622a0f09d86daad232eb9c30
4
- data.tar.gz: ebbe3d7304a2656a87c3a06d3259ee783f7b5ae21c9e47db5537c0eb50069e79
3
+ metadata.gz: 02a933610d0d442dae61cf120172123ab0a49f2b064a91564e56a3b87d421391
4
+ data.tar.gz: 59de42feb963165f9b095c854e5e5d544f2a5d853768ce704a6901d4ee56cee7
5
5
  SHA512:
6
- metadata.gz: bbaadd206dc0a184f4a2550d31252b045b4c6aff8c0c6b2902891c8654b948f997e8978aa152110943e199c15c585457d5250ed486fd676116d74d40af35b63d
7
- data.tar.gz: c3f6d72224d41857ba2e2311290d597eb819404a63c21e8bc4651876bfd392f48bc4e833bd6afb8c9ec58b9d9f8f3c972589a6998e7c701dc11e7bbbc0e7ca8e
6
+ metadata.gz: 0eed2de212ec74010573226d7c87e028bfc6e94f0c6c21f24ab0765462370d95ccea240fc1cf0d7e2dd1871ef6aea1444d000c64760f0337e2166145eb1960ac
7
+ data.tar.gz: ca522cd11c6da7ee7f0ebb2cf9d9516c9a09945334cf31e21488f4cb99de8542f01224173a2a390bc3066a62070961880bacd3bdeff3f7d6757a6710bd159f01
data/bin/dotpretty CHANGED
@@ -40,3 +40,4 @@ runner = Dotpretty::Runner.new({
40
40
  reporter_name: options[:reporter_name]
41
41
  })
42
42
  STDIN.each_line { |line| runner.parse_line(line) }
43
+ runner.done_with_input
@@ -2,6 +2,7 @@ module Dotpretty
2
2
  class Aggregator
3
3
 
4
4
  BUILD_COMPLETED = /^Build completed/
5
+ BUILD_FAILED = /^Build FAILED.$/
5
6
  TEST_FAILED = /^Failed/
6
7
  TEST_PASSED = /^Passed/
7
8
  TEST_SUMMARY = /^Total tests/
@@ -18,9 +19,11 @@ module Dotpretty
18
19
  when :waiting
19
20
  state_machine.trigger(:build_started)
20
21
  when :build_in_progress
21
- state_machine.trigger(:build_completed) if input_line.match(BUILD_COMPLETED)
22
+ state_machine.trigger(:received_build_input, input_line)
23
+ when :reading_build_failure_details
24
+ state_machine.trigger(:received_build_failure_details, input_line)
22
25
  when :ready_to_run_tests
23
- state_machine.trigger(:tests_started) if input_line.match(TESTS_STARTED)
26
+ state_machine.trigger(:received_input_line, input_line)
24
27
  when :waiting_for_test_input
25
28
  state_machine.trigger(:test_input_received, input_line)
26
29
  when :waiting_for_failure_details
@@ -30,6 +33,24 @@ module Dotpretty
30
33
  end
31
34
  end
32
35
 
36
+ def parse_build_input(input_line)
37
+ if input_line.match(BUILD_COMPLETED)
38
+ state_machine.trigger(:build_completed)
39
+ elsif input_line.match(BUILD_FAILED)
40
+ state_machine.trigger(:build_failed)
41
+ else
42
+ state_machine.trigger(:received_build_input)
43
+ end
44
+ end
45
+
46
+ def determine_if_tests_started(input_line)
47
+ if input_line.match(TESTS_STARTED)
48
+ state_machine.trigger(:tests_started)
49
+ else
50
+ state_machine.trigger(:tests_did_not_start)
51
+ end
52
+ end
53
+
33
54
  def parse_test_input(input_line)
34
55
  if input_line.match(TEST_PASSED)
35
56
  match = input_line.match(/^Passed\s+(.+)$/)
@@ -52,6 +73,18 @@ module Dotpretty
52
73
  reporter.build_started
53
74
  end
54
75
 
76
+ def reset_build_failure_details
77
+ self.build_failure_details = []
78
+ end
79
+
80
+ def track_build_failure_details(input_line)
81
+ build_failure_details << input_line
82
+ end
83
+
84
+ def report_failing_build
85
+ reporter.build_failed(build_failure_details)
86
+ end
87
+
55
88
  def track_failure_details(details)
56
89
  current_failing_test[:details] << details.rstrip if details.rstrip != ""
57
90
  end
@@ -99,7 +132,7 @@ module Dotpretty
99
132
 
100
133
  private
101
134
 
102
- attr_accessor :current_failing_test, :reporter
135
+ attr_accessor :build_failure_details, :current_failing_test, :reporter
103
136
 
104
137
  end
105
138
  end
@@ -12,10 +12,25 @@ module Dotpretty
12
12
  transition :build_started, :build_in_progress, :build_started
13
13
  end
14
14
  state :build_in_progress do
15
+ transition :received_build_input, :parsing_build_input
16
+ end
17
+ state :parsing_build_input do
18
+ on_entry :parse_build_input
15
19
  transition :build_completed, :ready_to_run_tests, :build_completed
20
+ transition :build_failed, :reading_build_failure_details, :reset_build_failure_details
21
+ transition :received_build_input, :build_in_progress
22
+ end
23
+ state :reading_build_failure_details do
24
+ transition :received_build_failure_details, :reading_build_failure_details, :track_build_failure_details
25
+ transition :end_of_input, :done, :report_failing_build
16
26
  end
17
27
  state :ready_to_run_tests do
28
+ transition :received_input_line, :determining_if_tests_started
29
+ end
30
+ state :determining_if_tests_started do
31
+ on_entry :determine_if_tests_started
18
32
  transition :tests_started, :waiting_for_test_input, :starting_tests
33
+ transition :tests_did_not_start, :ready_to_run_tests
19
34
  end
20
35
  state :waiting_for_test_input do
21
36
  transition :test_input_received, :parsing_test_input
@@ -48,6 +63,10 @@ module Dotpretty
48
63
  aggregator.parse_line(input_line)
49
64
  end
50
65
 
66
+ def done_with_input
67
+ state_machine.trigger(:end_of_input)
68
+ end
69
+
51
70
  private
52
71
 
53
72
  attr_accessor :aggregator, :output, :state_machine
@@ -16,6 +16,13 @@ module Dotpretty
16
16
  output.puts("")
17
17
  end
18
18
 
19
+ def build_failed(failure_details)
20
+ output.puts("Build failed")
21
+ failure_details.each do |detail|
22
+ output.puts(detail)
23
+ end
24
+ end
25
+
19
26
  def starting_tests
20
27
  output.puts("Starting test execution...")
21
28
  end
@@ -15,6 +15,9 @@ module Dotpretty
15
15
  def build_completed
16
16
  end
17
17
 
18
+ def build_failed(failure_details)
19
+ end
20
+
18
21
  def starting_tests
19
22
  end
20
23
 
@@ -17,6 +17,13 @@ module Dotpretty
17
17
  output.puts("Build started")
18
18
  end
19
19
 
20
+ def build_failed(failure_details)
21
+ output.puts("Build failed")
22
+ failure_details.each do |detail|
23
+ output.puts(detail)
24
+ end
25
+ end
26
+
20
27
  def show_test_summary(summary)
21
28
  output.puts("")
22
29
  output.puts("")
@@ -16,6 +16,10 @@ module Dotpretty
16
16
  parser.parse_line(line)
17
17
  end
18
18
 
19
+ def done_with_input
20
+ parser.done_with_input
21
+ end
22
+
19
23
  private
20
24
 
21
25
  attr_accessor :parser
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dotpretty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Meyer