teststats 0.1.0 → 0.1.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
  SHA1:
3
- metadata.gz: 643dbc4cf307a2725c80e4269cf9447c25ccc518
4
- data.tar.gz: 231167f3e71f14c8bc51aaa78c2b18b30769e120
3
+ metadata.gz: 876b1230bf41b41ae993f09846d383902166aa03
4
+ data.tar.gz: 574c6f0eef881744b6b1a63405b6bd4997c16f1f
5
5
  SHA512:
6
- metadata.gz: 7185d310751ba49eadd014f341539fa416b41f6543dda07bf05b0b4034ff1b15f1b920831e72652235fd5feca385933594d7ee0550ca748607430394685e66fa
7
- data.tar.gz: 578d989ac8867828d428ec428b42b50422dff5277839d699ecc701b6975ebb8532fd981c3f731e88a4f6c40abfbd6b52ed335e02d5ebcb3d963592f16e66bfb3
6
+ metadata.gz: 13288f750d7f097a931b752e3c0eb65d15c16ab22e099f5790043c6a1199707bc7e3bf9c2b3dcb8b875fbdd4828d6c5655ef497a9c7e9758ddf7f828861f67ee
7
+ data.tar.gz: 02e759b5cfaf8b0f1f412bd4625f23e58e439072ed715a7d5bc2904545f645888fd5f5d7d700a8f11e0235ad47cd3ceff3918c07072c1779d50795b29768ee4c
data/lib/teststats/cli.rb CHANGED
@@ -8,13 +8,11 @@ module Teststats
8
8
  DEFAULTS = {
9
9
  'test_unit' => {
10
10
  :pattern => '*_test.rb',
11
- :directory => 'test',
12
- :test_regex => /^\s+def test_/
11
+ :directory => 'test'
13
12
  },
14
13
  'rspec' => {
15
14
  :pattern => '*_spec.rb',
16
- :directory => 'spec',
17
- :test_regex => /^\s+it ["']/
15
+ :directory => 'spec'
18
16
  }
19
17
  }
20
18
  desc "count", "Test count growing stats. Notice, this command will checkout old revisions to count tests, recommend a clean repository to avoid problem."
@@ -57,12 +55,13 @@ module Teststats
57
55
  puts "Unsupported framework #{name.inspect}, options: #{DEFAULTS.keys.inspect}"
58
56
  exit(1)
59
57
  end
58
+ test_regex = /^\s+(def\s+test_|test\s+['"]|it\s+['"])/
60
59
  f = {:name => name}
61
60
  DEFAULTS[name].each do |k, v|
62
61
  f[k] = options[k] || v
63
62
  end
64
63
  f[:test_files] = [f[:directory], '**', f[:pattern]].join("/")
65
- f[:count] = lambda {|file| File.read(file).split("\n").map {|l| l =~ f[:test_regex] ? 1 : 0}.reduce(:+).to_i}
64
+ f[:count] = lambda {|file| File.read(file).split("\n").map {|l| l =~ test_regex ? 1 : 0}.reduce(:+).to_i}
66
65
  OpenStruct.new(f)
67
66
  end
68
67
 
@@ -32,9 +32,9 @@ body {
32
32
  <script>
33
33
  var yAxisLabel = 'Test Count';
34
34
  var data = <%= data.to_json %>;
35
- var margin = {top: 20, right: 50, bottom: 30, left: 50},
36
- width = window.innerWidth - margin.left - margin.right,
37
- height = 500 - margin.top - margin.bottom;
35
+ var margin = {top: 20, right: 50, bottom: 150, left: 50},
36
+ width = window.innerWidth - 20 - margin.left - margin.right,
37
+ height = window.innerHeight - 20 - margin.top - margin.bottom;
38
38
 
39
39
  var parseDate = d3.time.format("%Y-%m-%d").parse;
40
40
 
@@ -1,3 +1,3 @@
1
1
  module Teststats
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teststats
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Xiao Li