perf_check 0.1.9 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/perf_check +3 -1
  3. data/lib/perf_check.rb +16 -4
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c8c629b42f8b3ab57e8027bda25e17d25d0dbcc8
4
- data.tar.gz: c8d312841c669db61acb88c80f3c7675a32e65b1
3
+ metadata.gz: e6092360e95a8950b156ebc6790148b00b68f2b8
4
+ data.tar.gz: 98cd004e57313a8fd77e42e21ca05c4a9b538d3d
5
5
  SHA512:
6
- metadata.gz: 185c1dc6b2ec1ce123fea2e8f86aa99472d9a3268eacc93cdca46d6dd70c088cf81a9cb0413588d7758e1da836f4959cb490e30ca2f1c43df59317eb7b67744f
7
- data.tar.gz: 632a28d75daf13ed5db607ce03c8d9805ecd0bc273974f4a2cb09fc25de5477a804df24d5bfcdd245069604b272d5d17b0e9cbd815ebe678857a70170fb4e78f
6
+ metadata.gz: d36b10cc1a65320df58884ecdec5d832567cc664f5d091f88498ec10eec0e5a5477f2c9a50b1dbf074e577d84832e2bae89da0478b04b5b26237d36109e541b4
7
+ data.tar.gz: 7ee8ad0ee7ccb9209315fcc5930e3c11af9ed05781508e640c8ece3ebe45220f6014c0f471f8d20fec26e947f240e8778aa8374b53a4295cbba4fa0d5d65a400
@@ -131,6 +131,8 @@ if perf_check.test_cases.empty?
131
131
  abort(opts.help)
132
132
  end
133
133
 
134
+ perf_check.trigger_before_start_callback
135
+
134
136
  perf_check.sanity_check
135
137
  perf_check.run
136
138
 
@@ -140,7 +142,7 @@ else
140
142
  perf_check.print_results
141
143
  end
142
144
 
143
- perf_check.trigger_callback
145
+ perf_check.trigger_when_finished_callback
144
146
 
145
147
  # _______________________
146
148
  # < You made it faster!!! >
@@ -41,8 +41,16 @@ class PerfCheck
41
41
  @when_finished_callback = block
42
42
  end
43
43
 
44
- def self.callback
45
- @when_finished_callback
44
+ def self.when_finished_callback
45
+ @when_finished_callback || proc{ |*args| }
46
+ end
47
+
48
+ def self.before_start(&block)
49
+ @before_start = block
50
+ end
51
+
52
+ def self.before_start_callback
53
+ @before_start_callback || proc{ |*args| }
46
54
  end
47
55
 
48
56
  def initialize
@@ -97,14 +105,18 @@ class PerfCheck
97
105
  end
98
106
  end
99
107
 
100
- def trigger_callback
108
+ def trigger_before_start_callback
109
+ PerfCheck.before_start_callback.call(self)
110
+ end
111
+
112
+ def trigger_when_finished_callback
101
113
  results = OpenStruct.new(:current_branch => PerfCheck::Git.current_branch)
102
114
  results[:ARGV] = ORIGINAL_ARGV
103
115
  if test_cases.size == 1
104
116
  results.current_latency = test_cases.first.this_latency
105
117
  results.reference_latency = test_cases.first.reference_latency
106
118
  end
107
- PerfCheck.callback.call(results)
119
+ PerfCheck.when_finished_callback.call(results)
108
120
  end
109
121
 
110
122
  def print_diff_results(diff)
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.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - rubytune