corn 0.0.7 → 0.0.8

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/corn.rb +6 -7
  3. data/lib/corn/test_unit.rb +13 -0
  4. metadata +5 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8772493b9949b6c7b4867b7c7f2c3c7efa8b5ab5
4
- data.tar.gz: 6dc258e0d06b44a8548b6b2a9efb8e1a9daf253f
3
+ metadata.gz: 8cc6871550ffd52bc9016143f8eac2ef5d0f78c4
4
+ data.tar.gz: e51b371d3fbd0ef91c10f7fefe759207d093e542
5
5
  SHA512:
6
- metadata.gz: db292f19239353bc7eb1abc990dbd4a88f48e9afdf922d4a4833e0b7568aaa61a10d5a64bfd7ea723682e1c272c5de28a9dc306ae01a2bc786bb156b62dd605c
7
- data.tar.gz: 2141b7349b808cef1a5e74e79096cf798e3483deb98ffa0fde3f8c22d6017026338ac1d576593345b90144f7cce257a118d5adb0d32e95a088aa8dd9ec0f0ef2
6
+ metadata.gz: 9db883303d9b5b38b9952b9cb851f437490236dd5735be51b4e80505decbf69a9962ef7f5a99a4760ceb99c3ab61625b7969aa7fdaceb32cb80023dd78585b1d
7
+ data.tar.gz: 54e826a75871535d535a1f1a151a00d6a4796c33b2b13cc45edd1cb78e89e9f9e06ec5a33d4a831dea92b38db34f989c1a44165ee44d8390c42a9453e6d4de48
@@ -30,10 +30,12 @@ module Corn
30
30
  if RUBY_VERSION =~ /^1.8/
31
31
  if defined?(Test::Unit::TestCase)
32
32
  Test::Unit::TestCase.send(:include, TestUnit18)
33
+ Test::Unit::UI::TestRunnerMediator.send(:include, TestRunnerMediator)
33
34
  end
34
35
  end
35
36
  if defined?(::MiniTest::Unit::TestCase)
36
37
  ::MiniTest::Unit::TestCase.send(:include, Corn::MiniTest)
38
+ ::MiniTest::Unit.after_tests { submit }
37
39
  end
38
40
  end
39
41
 
@@ -42,19 +44,16 @@ module Corn
42
44
  @report.record(label, &block)
43
45
  end
44
46
 
45
- def exit_submit_hook
46
- at_exit { submit }
47
- end
48
-
49
- def submit(report=@report)
50
- return if report.empty?
47
+ def submit
48
+ return if @report.nil? || @report.empty?
51
49
  log_error do
52
50
  data = {
53
51
  :client_id => client_id,
54
52
  :build_label => build_label,
55
- :reports => report.to_csv
53
+ :reports => @report.to_csv
56
54
  }
57
55
  http_post(File.join(host, 'benchmarks'), data)
56
+ @report = nil
58
57
  end
59
58
  end
60
59
 
@@ -39,4 +39,17 @@ module Corn
39
39
  yield(Test::Unit::TestCase::FINISHED, name)
40
40
  end
41
41
  end
42
+
43
+ module TestRunnerMediator
44
+ def self.included(base)
45
+ base.send(:alias_method, :run_suite_without_corn, :run_suite)
46
+ base.send(:alias_method, :run_suite, :run_suite_with_corn)
47
+ end
48
+
49
+ def run_suite_with_corn
50
+ run_suite_without_corn.tap do |r|
51
+ Corn.submit
52
+ end
53
+ end
54
+ end
42
55
  end
metadata CHANGED
@@ -1,16 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: corn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Xiao Li
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-30 00:00:00.000000000 Z
11
+ date: 2014-01-31 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: TBD
13
+ description: |
14
+ Corn injects hook to test frameworks for collecting test running benchmark reports. It submits reports to Corn Server after all tests finished.
14
15
  email:
15
16
  - swing1979@gmail.com
16
17
  executables: []
@@ -46,5 +47,5 @@ rubyforge_project:
46
47
  rubygems_version: 2.2.0
47
48
  signing_key:
48
49
  specification_version: 4
49
- summary: TBD
50
+ summary: Corn is a test benchmarking tool.
50
51
  test_files: []