milou 0.0.9 → 1.0.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
  SHA256:
3
- metadata.gz: b91e278dc1d209668ca72eab28abd1fdad87d343fe5f741f1b9aae21f6688066
4
- data.tar.gz: cffbed557d71045ca7d3ec6264c24ea49821f2cedf15a46c721734fc3974fbf6
3
+ metadata.gz: 4be82578a6455e2a956a342787142d11877e559ebe7470131b0d3dc5f8817c7e
4
+ data.tar.gz: 16e13904db4cfdd71cf56f902d8b5ce54b9fabe45e55590d8e0a4fc901295419
5
5
  SHA512:
6
- metadata.gz: 896af371c5aa516d979dfe5b9406fda18883c461cc4bae0dd544da0dea9968e2326d8af78b99de8098ea9e88304e5d93db614640dc1f4f2a481338a3af17dd6f
7
- data.tar.gz: 6423b6b1238ae97f152489c605692b648a55b99bc655a5ea5958cc2fa1c617037f11ee713493f5409b7e363b8520089f7407a5eabd0d5f5391cba771eb7f4753
6
+ metadata.gz: 4300c4c297c0066c6702a011b66f8e5ed6af9993605f08d3f7fc9e4c69e66e2a4db996a68b98b41a8e3a8a9708f3f2f8de9d00527cb6b650080b99c4ec31ff18
7
+ data.tar.gz: 5b424fd13b097eefc374555f015c35471b1741c5425332654214b69ad1eab5665f862afc3916b737b2ca76e0da928e6df19a3838f17e0f4d69b9b4d521e34ce4
@@ -10,40 +10,32 @@ 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
22
-
23
- # %x[ #{detox_cmd} 2>&1 ]
21
+ Watchdog::Utils.run_cmd(detox_cmd)
24
22
  end
25
23
 
26
24
  # Detox runner
27
25
  def run_detox
28
26
  detox_cmd = 'yarn run detox-test'
29
27
 
30
- Watchdog::Utils.run_cmd(detox_cmd).chomp
31
-
32
- # %x[ #{detox_cmd} 2>&1 ]
28
+ Watchdog::Utils.run_cmd(detox_cmd)
33
29
  end
34
30
 
35
31
  # Watchdog runner
36
- def run_watchdog(detox_result)
32
+ def run_watchdog(detox_out, detox_err)
37
33
 
38
34
  status_regex = /(FAIL|PASS) (.*\.js) \((.*)\)/
39
35
 
40
- commit_branch = Watchdog::Utils.run_cmd('git symbolic-ref --short HEAD').chomp
41
- commit_sha = Watchdog::Utils.run_cmd('git --no-pager show -s --format=%H').chomp
42
- commit_timestamp = Watchdog::Utils.run_cmd('git --no-pager log -1 --format=%cd').chomp
43
-
44
- # commit_branch = %x[ #{'git symbolic-ref --short HEAD'} 2>&1 ]
45
- # commit_sha = %x[ #{'git --no-pager show -s --format=%H'} 2>&1 ]
46
- # commit_timestamp = %x[ #{'git --no-pager log -1 --format=%cd'} 2>&1 ]
36
+ commit_branch = Watchdog::Utils.run_cmd('git symbolic-ref --short HEAD')[0].chomp
37
+ commit_sha = Watchdog::Utils.run_cmd('git --no-pager show -s --format=%H')[0].chomp
38
+ commit_timestamp = Watchdog::Utils.run_cmd('git --no-pager log -1 --format=%cd')[0].chomp
47
39
 
48
40
  run = {
49
41
  test_run: {
@@ -55,16 +47,18 @@ module Watchdog
55
47
  }
56
48
  }
57
49
 
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]}"
50
+ [detox_out, detox_err].each do |output|
51
+ output&.chomp&.each_line do |line|
52
+ line_match = line.match(status_regex)
53
+
54
+ if line_match
55
+ run[:test_run][:test_results] << {
56
+ status: line_match[1],
57
+ test: line_match[2],
58
+ time: line_match[3]
59
+ }
60
+ puts "Status: #{line_match[1]} | Test: #{line_match[2]} | Time: #{line_match[3]}"
61
+ end
68
62
  end
69
63
  end
70
64
 
@@ -72,8 +66,7 @@ module Watchdog
72
66
  'Content-Type' => 'application/json',
73
67
  'X-API-KEY' => ENV['WATCHDOG_AUTH_TOKEN']
74
68
  }
75
- puts "run"
76
- puts run
69
+
77
70
  response = HTTParty.post(
78
71
  ENV['WATCHDOG_API_URL'],
79
72
  :body => run.to_json,
@@ -6,12 +6,12 @@ module Watchdog
6
6
  if $watchdog_relative_dir
7
7
  Dir.chdir($watchdog_relative_dir){
8
8
  # %x[ #{cmd} ]
9
- _out, err, _sts = Open3.capture3(cmd)
10
- return _out
9
+ out, err, _sts = Open3.capture3(cmd)
10
+ return out, err
11
11
  }
12
12
  else
13
- _out, err, _sts = Open3.capture3(cmd)
14
- return _out
13
+ out, err, _sts = Open3.capture3(cmd)
14
+ return out, err
15
15
  end
16
16
  end
17
17
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Watchdog
4
- VERSION = "0.0.9".freeze
4
+ VERSION = "1.0.1".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.9
4
+ version: 1.0.1
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-09-01 00:00:00.000000000 Z
11
+ date: 2022-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv
@@ -85,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
85
  - !ruby/object:Gem::Version
86
86
  version: '0'
87
87
  requirements: []
88
- rubygems_version: 3.3.7
88
+ rubygems_version: 3.0.6
89
89
  signing_key:
90
90
  specification_version: 4
91
91
  summary: Watchdog SDK