res 1.2.9 → 1.2.10

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
  SHA1:
3
- metadata.gz: e9de4ed8f0de1b609819a546d41a75519667ccb8
4
- data.tar.gz: a2be68478e937ff44dfdde6f525bebe2d85666e9
3
+ metadata.gz: b986b0f17b7b9aad06b6e35f9418670af1bbdb11
4
+ data.tar.gz: 8a5332a148de9511660da0b0a9455bbb14e5727d
5
5
  SHA512:
6
- metadata.gz: 75889fec1660375681a80fffe8490cb9c03b9d6fe3e0fb9ab40b3da852cbe79b896a1079bcb0a9ba1b938d827ab1615beff3ee64be53a0d0d19fdbd2df217ec0
7
- data.tar.gz: ab54551c0fc918f84e4740d14d629305c21f475a466e4d1726785d475833b6944a71910ba0a11109d1e79b7f89a150421a1c3c5f79000b55fe0d1fb82ca990cd
6
+ metadata.gz: 69894b149c73ac34a736452fe3ef8c2e16b8d9f1f9858fd4b05c793a4ce7303ad98525f89c8095011255a947c71c6e84b05fc53955c55fb494f5db93c3298ca1
7
+ data.tar.gz: 1121aa1fc81a2795f19e600426b389447647853aa9af49efa4e4c1aabe8277429da32b76477ad2b58904452f69bd5c9a53b58ab6f648b08b3ee2f380c4ce4adb
@@ -2,7 +2,7 @@ require 'json'
2
2
 
3
3
  module Res
4
4
  class IR
5
- attr_accessor :hash, :results, :type, :start_time, :end_time, :world
5
+ attr_accessor :hash, :results, :type, :start_time, :end_time, :world, :values
6
6
  attr_accessor :project, :suite, :target, :hive_job_id
7
7
 
8
8
  def self.load(file)
@@ -21,8 +21,28 @@ module Res
21
21
  @type = options[:type] or raise "No type provided (e.g. 'Cucumber')"
22
22
  @started = options[:started] or raise "Need to provide a start time"
23
23
  @finished = options[:finished] or raise "Need to provide an end time"
24
+ @values = initialize_values( options[:values], options[:results] )
24
25
  end
25
-
26
+
27
+ def initialize_values( initial_values, results_hash )
28
+ h = {}
29
+ if initial_values && !initial_values.empty?
30
+ initial_values.each do |k,v|
31
+ h[k.to_s] = v
32
+ end
33
+ end
34
+
35
+ IR.find_values( results_hash ).each do |i|
36
+ if !i.empty?
37
+ i.each do |k,v|
38
+ h[k.to_s] = v
39
+ end
40
+ end
41
+ end
42
+
43
+ h
44
+ end
45
+
26
46
  # Dump as json
27
47
  def json
28
48
  hash = {
@@ -60,6 +80,20 @@ module Res
60
80
 
61
81
  private
62
82
 
83
+ # Recursive function for retrieving values in nodes
84
+ def self.find_values(nodes)
85
+ value_hashes = []
86
+ nodes.each do |n|
87
+ if n[:values]
88
+ value_hashes << n[:values]
89
+ end
90
+ if n[:children]
91
+ value_hashes += IR.find_values(n[:children])
92
+ end
93
+ end
94
+ value_hashes
95
+ end
96
+
63
97
  # Recursive function for retrieving test nodes
64
98
  def self.find_tests(nodes)
65
99
  tests = []
@@ -18,22 +18,6 @@ module Res
18
18
  status = "failed"
19
19
  status = "passed" if ir.tests.count == ir.count(:passed)
20
20
 
21
- count = 0
22
- values = Array.new
23
- while count < ir.tests.count
24
- values[count] = ir.tests[count][:values]
25
- count += 1
26
- end
27
-
28
- perf_values = {}
29
- ir.tests.collect do |t|
30
- if values = t[:values]
31
- values.each do |k,v|
32
- perf_values[k] = v if v.is_a? Numeric
33
- end
34
- end
35
- end
36
-
37
21
  # Set Lion Data
38
22
  lion_data = {
39
23
  :app_name => config.app_name,
@@ -44,7 +28,7 @@ module Res
44
28
  :started => ir.results.first[:started],
45
29
  :finished => ir.results.last[:finished],
46
30
  :status => status,
47
- :measures => perf_values
31
+ :measures => ir.values
48
32
  }
49
33
 
50
34
 
@@ -1,3 +1,3 @@
1
1
  module Res
2
- VERSION = '1.2.9'
2
+ VERSION = '1.2.10'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: res
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.9
4
+ version: 1.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - BBC