perf_check 0.1.7 → 0.1.8

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: 55dd84ea36a6406e768ed5581acf65b9f4b6aa50
4
- data.tar.gz: fb5b16a1aea5f51c75af09c9843d4bd3a063ff30
3
+ metadata.gz: 939ed2568e6f37048787e9548970ebf399344133
4
+ data.tar.gz: 20ba90e0a2186d797ad4bbffe67c06292e89b53f
5
5
  SHA512:
6
- metadata.gz: 1377387b9ef80a3bbbc9128b4461bf89ffb189fcbee5f2f685becee729681affb51a193725a5bcc414f0ac9eb57176c010fb89bd4a1a403ee8194f33aadbabc0
7
- data.tar.gz: 64d8c600ad45a422698f31717e0612a150f7899d7252cf60c4c9c9fb70f531e13445605a9783c126dcaa1c30b06d9c5706ccf19bab9651c1e612aa24b7f78ba5
6
+ metadata.gz: 85f978097f52963d7a370baf0c81c18988d3eb6f3f365158f4719080d4da39ced9ec4e953d1728621922880ba4b2a45a3fbfe40e50dee545e4e6a941746b615b
7
+ data.tar.gz: 2897e7dae4cc2db59c22f926b2bf88616770f8bba043987dfde4ef260b665437ca6c1708ff05688c1474c48488c7976f6d71cf1b398bc16ee7a8b827aa2125bd
data/bin/perf_check CHANGED
@@ -138,6 +138,8 @@ else
138
138
  perf_check.print_results
139
139
  end
140
140
 
141
+ perf_check.trigger_callback
142
+
141
143
  # _______________________
142
144
  # < You made it faster!!! >
143
145
  # -----------------------
@@ -85,6 +85,7 @@ class PerfCheck
85
85
  end
86
86
 
87
87
  def reference_latency
88
+ return nil if reference_profiles.empty?
88
89
  reference_profiles.map(&:latency).inject(0.0, :+) / reference_profiles.size
89
90
  end
90
91
 
data/lib/perf_check.rb CHANGED
@@ -37,6 +37,14 @@ class PerfCheck
37
37
  require "#{app_root}/config/environment"
38
38
  end
39
39
 
40
+ def self.when_finished(&block)
41
+ @when_finished_callback = block
42
+ end
43
+
44
+ def self.callback
45
+ @when_finished_callback
46
+ end
47
+
40
48
  def initialize
41
49
  self.options = OpenStruct.new
42
50
  self.server = Server.new
@@ -89,6 +97,14 @@ class PerfCheck
89
97
  end
90
98
  end
91
99
 
100
+ def trigger_callback
101
+ results = OpenStruct.new(:current_branch => PerfCheck::Git.current_branch)
102
+ if test_cases.size == 1
103
+ results.current_latency = test_cases.first.this_latency
104
+ results.reference_latency = test_cases.first.reference_latency
105
+ end
106
+ PerfCheck.callback.call(results)
107
+ end
92
108
 
93
109
  def print_diff_results(diff)
94
110
  if diff.changed?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: perf_check
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - rubytune