milou 0.0.7 → 1.0.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: 687aec27808949b4cbc36912fb43a4da89914b0ee8615d654c9ef5cf7c154654
4
- data.tar.gz: d4592882c81da612bbc4c1957a56a744f8c864e14cc46e5b3340d61d4579952c
3
+ metadata.gz: 35c1b97511bd156f6c9f7fe78ae56c57548000ec02f9081ed9f71e1d5c71d84d
4
+ data.tar.gz: b6a63f15c3b513ab8810125b338487253281742de21c5c3ff81e24a5e16d721a
5
5
  SHA512:
6
- metadata.gz: 7664f8a943335848af0790f481085c0a4d8c5fcae055061fe03b9ccfc5daaa43606c88636e52813a74c674f8d776120b7d4c6fcc856fc3ad39ab86edecfbb2cd
7
- data.tar.gz: bce1b121bc7ff1a24c6edf2188d238cdf70b25f2249822a172be23bd3afc5eaa47bd02e74af5c4043d2f35e6933ab4891614f76b4eb184875e7c98725af895f5
6
+ metadata.gz: d3e4235616ed6020a1086101f55a9647212e8d7a3b5b7d41224a0f64a3294468b0d27af65459c1a71965fb9ca2ada113c14bdcea162a4bcadf80bbe5163584b1
7
+ data.tar.gz: 6652d5076db74480f1ddba263f706561b1009d1da7d0f724dfad5d350a9ff239481bcac32bc23aba04366728b7a74a019ecc4da6fd80863434d5950ea6b20f1e
@@ -10,15 +10,15 @@ module Watchdog
10
10
  def run
11
11
  build_detox
12
12
 
13
- detox_result = run_detox
13
+ detox_out, detox_err = run_detox
14
14
 
15
- run_watchdog(detox_result)
15
+ run_watchdog(detox_out, detox_err)
16
16
  end
17
17
 
18
18
  def build_detox
19
19
  detox_cmd = 'yarn run detox-build'
20
20
 
21
- Watchdog::Utils.run_cmd detox_cmd
21
+ Watchdog::Utils.run_cmd(detox_cmd)
22
22
 
23
23
  # %x[ #{detox_cmd} 2>&1 ]
24
24
  end
@@ -27,13 +27,13 @@ module Watchdog
27
27
  def run_detox
28
28
  detox_cmd = 'yarn run detox-test'
29
29
 
30
- Watchdog::Utils.run_cmd(detox_cmd).chomp
30
+ Watchdog::Utils.run_cmd(detox_cmd)
31
31
 
32
32
  # %x[ #{detox_cmd} 2>&1 ]
33
33
  end
34
34
 
35
35
  # Watchdog runner
36
- def run_watchdog(detox_result)
36
+ def run_watchdog(detox_out, detox_err)
37
37
 
38
38
  status_regex = /(FAIL|PASS) (.*\.js) \((.*)\)/
39
39
 
@@ -55,19 +55,23 @@ module Watchdog
55
55
  }
56
56
  }
57
57
 
58
- detox_result.each_line do |line|
59
- line_match = line.match(status_regex)
60
-
61
- if line_match
62
- run[:test_run][:test_results] << {
63
- status: line_match[1],
64
- test: line_match[2],
65
- time: line_match[3]
66
- }
67
- puts "Status: #{line_match[1]} | Test: #{line_match[2]} | Time: #{line_match[3]}"
58
+ [detox_out, detox_err].each do |output|
59
+ output&.chomp&.each_line do |line|
60
+ line_match = line.match(status_regex)
61
+
62
+ if line_match
63
+ run[:test_run][:test_results] << {
64
+ status: line_match[1],
65
+ test: line_match[2],
66
+ time: line_match[3]
67
+ }
68
+ puts "Status: #{line_match[1]} | Test: #{line_match[2]} | Time: #{line_match[3]}"
69
+ end
68
70
  end
69
71
  end
70
72
 
73
+
74
+
71
75
  headers = {
72
76
  'Content-Type' => 'application/json',
73
77
  'X-API-KEY' => ENV['WATCHDOG_AUTH_TOKEN']
@@ -1,15 +1,17 @@
1
+ require 'open3'
2
+
1
3
  module Watchdog
2
4
  class Utils
3
5
  def self.run_cmd(cmd)
4
6
  if $watchdog_relative_dir
5
7
  Dir.chdir($watchdog_relative_dir){
6
8
  # %x[ #{cmd} ]
7
- _out, err, _sts = Open3.capture3(cmd)
8
- return _out
9
+ out, err, _sts = Open3.capture3(cmd)
10
+ return out, err
9
11
  }
10
12
  else
11
- _out, err, _sts = Open3.capture3(cmd)
12
- return _out
13
+ out, err, _sts = Open3.capture3(cmd)
14
+ return out, err
13
15
  end
14
16
  end
15
17
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Watchdog
4
- VERSION = "0.0.7".freeze
4
+ VERSION = "1.0.0".freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: milou
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos Silva
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-30 00:00:00.000000000 Z
11
+ date: 2022-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.20.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: open3
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.1.1
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.1.1
41
55
  description: Watchdog SDK to communicate with the Watchdog API
42
56
  email:
43
57
  - ops@gaspardbruno.com