pjstadig-metric_fu 1.1.4.2 → 1.1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY +4 -0
- data/lib/base/configuration.rb +3 -1
- data/lib/generators/dcov.rb +105 -0
- data/lib/templates/awesome/dcov.html.erb +27 -0
- data/lib/templates/awesome/index.html.erb +3 -0
- data/lib/templates/standard/dcov.html.erb +38 -0
- data/lib/templates/standard/index.html.erb +4 -1
- metadata +9 -4
data/HISTORY
CHANGED
data/lib/base/configuration.rb
CHANGED
@@ -6,7 +6,7 @@ module MetricFu
|
|
6
6
|
# course, in order to use these metrics, their respective gems must
|
7
7
|
# be installed on the system.
|
8
8
|
AVAILABLE_METRICS = [:churn, :flog, :flay, :reek,
|
9
|
-
:roodi, :saikuro, :rcov]
|
9
|
+
:roodi, :saikuro, :rcov, :dcov]
|
10
10
|
|
11
11
|
AVAILABLE_GRAPHS = [:flog, :flay, :reek, :roodi, :rcov]
|
12
12
|
|
@@ -130,6 +130,8 @@ module MetricFu
|
|
130
130
|
"--profile",
|
131
131
|
"--rails",
|
132
132
|
"--exclude /gems/,/Library/,/usr/,spec"]}
|
133
|
+
@dcov = {:test_files => ['app/**/*.rb', 'lib/**/*.rb'],
|
134
|
+
:dcov_opts => ["-p tmp/metric_fu/scratch/dcov"]}
|
133
135
|
|
134
136
|
@graph_theme = { :colors => %w(orange purple green white red blue pink yellow),
|
135
137
|
:marker_color => 'blue',
|
@@ -0,0 +1,105 @@
|
|
1
|
+
require 'enumerator'
|
2
|
+
|
3
|
+
module MetricFu
|
4
|
+
|
5
|
+
class Dcov < Generator
|
6
|
+
|
7
|
+
def self.verify_dependencies!
|
8
|
+
`dcov --help`
|
9
|
+
raise 'sudo gem install dcov # if you want the dcov tasks' unless $?.success?
|
10
|
+
end
|
11
|
+
|
12
|
+
#search through resource path and rub dcov on all .rb files, abstract method override
|
13
|
+
def emit
|
14
|
+
#Clean up file system before we start
|
15
|
+
FileUtils.rm_rf(MetricFu::Dcov.metric_directory, :verbose => false)
|
16
|
+
Dir.mkdir(MetricFu::Dcov.metric_directory)
|
17
|
+
|
18
|
+
#what files are we going to test
|
19
|
+
test_files = MetricFu.dcov[:test_files].join(' ')
|
20
|
+
|
21
|
+
|
22
|
+
#set Dcov Options (See dcov rdocs)
|
23
|
+
dcov_opts = MetricFu.dcov[:dcov_opts].nil? ? "" : MetricFu.dcov[:dcov_opts].join(' ')
|
24
|
+
|
25
|
+
#setup place to store output
|
26
|
+
output = "> #{MetricFu::Dcov.metric_directory}/dcov.txt 2>/dev/null"
|
27
|
+
|
28
|
+
#actually do the test
|
29
|
+
`dcov #{dcov_opts} #{test_files} #{output}`
|
30
|
+
end
|
31
|
+
|
32
|
+
# Parses the output file into a hash for use by template, abstract method override
|
33
|
+
def analyze
|
34
|
+
#get the logged output
|
35
|
+
output1 = File.open(MetricFu::Dcov.metric_directory + '/dcov.txt').read
|
36
|
+
|
37
|
+
#turn it into something easier to work with
|
38
|
+
output1 = output1.split("\n")
|
39
|
+
|
40
|
+
#parse output
|
41
|
+
output_hash = {} #somewhere to keep our parsed data
|
42
|
+
sub_section_sym = "" #aid for parsing sub sections
|
43
|
+
item_name = "" #aid for parsing sub sections
|
44
|
+
output1.map! do |line| #parse each line for essential data (totals, coverage percentage)
|
45
|
+
next if line.blank? #skip blank lines
|
46
|
+
next if !line[/Not covered:/].nil? #skip these lines
|
47
|
+
next if line[/Generating report/] #skip these lines
|
48
|
+
next if line[/Writing report/] #skip these lines
|
49
|
+
|
50
|
+
#typically the first line, total files checked
|
51
|
+
if line[/\AFiles:/]
|
52
|
+
output_hash[:file_count] = line[/\d+/]
|
53
|
+
next
|
54
|
+
end
|
55
|
+
|
56
|
+
#These are the totals for each section
|
57
|
+
if line[/\ATotal \w+/]
|
58
|
+
output_hash[underscore(line[/\ATotal \w+/]).to_sym] = line[/\d+/]
|
59
|
+
next
|
60
|
+
end
|
61
|
+
|
62
|
+
#Actual coverages and list of uncovered items, marks start of item list
|
63
|
+
if line[/\A\w+ coverage/]
|
64
|
+
sub_section_sym = underscore(line[/\A\w+ coverage/]).to_sym
|
65
|
+
#output_hash[sub_section_sym] = line[/\d+%/]
|
66
|
+
output_hash= output_hash.merge(sub_section_sym=>{})
|
67
|
+
output_hash[sub_section_sym] = output_hash[sub_section_sym].merge({:coverage => line[/\d+%/]})
|
68
|
+
next
|
69
|
+
end
|
70
|
+
|
71
|
+
#if it hasn't been caught by now, it's an item...
|
72
|
+
if item_name == ""
|
73
|
+
#get Item name
|
74
|
+
item_name = line.strip
|
75
|
+
else
|
76
|
+
#get item data and store pair
|
77
|
+
if output_hash[sub_section_sym][:not_covored].nil?
|
78
|
+
output_hash[sub_section_sym] = output_hash[sub_section_sym].merge(:not_covored=>{})
|
79
|
+
end
|
80
|
+
output_hash[sub_section_sym][:not_covored] = output_hash[sub_section_sym][:not_covored].merge({item_name=>line.strip})
|
81
|
+
item_name = ""
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
@dcov = output_hash
|
86
|
+
end
|
87
|
+
|
88
|
+
#abstract method override
|
89
|
+
def to_h
|
90
|
+
{:dcov=> @dcov}
|
91
|
+
end
|
92
|
+
|
93
|
+
def underscore(camel_cased_word)
|
94
|
+
camel_cased_word.to_s.gsub(/::/, '/').
|
95
|
+
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
|
96
|
+
gsub(/([a-z\d])([A-Z])/,'\1_\2').
|
97
|
+
tr("-", "_").
|
98
|
+
tr(" ", "_").
|
99
|
+
downcase
|
100
|
+
end
|
101
|
+
|
102
|
+
|
103
|
+
end
|
104
|
+
|
105
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<h2>Dcov Results</h2>
|
2
|
+
<h3>Documentation coverage information.</h3>
|
3
|
+
<p>
|
4
|
+
Total Files: <%=@dcov[:file_count]%><br />
|
5
|
+
<% ["Module","Class","Method"].each do |t| %>
|
6
|
+
Total <%=t.pluralize%>: <%=@dcov["total_#{t.pluralize.downcase}".to_sym]%> with <%=@dcov["#{t.downcase}_coverage".to_sym][:coverage]%> coverage.<br />
|
7
|
+
<% end %>
|
8
|
+
</P>
|
9
|
+
<br/>
|
10
|
+
|
11
|
+
<% ["Module","Class","Method"].each do |t| %>
|
12
|
+
<h3>Undocumented <%=t.pluralize%>:</h3>
|
13
|
+
<table>
|
14
|
+
<tr>
|
15
|
+
<th><%= t%></th>
|
16
|
+
<th>Location</th>
|
17
|
+
</tr>
|
18
|
+
<%@dcov["#{t.downcase}_coverage".to_sym][:not_covored].each_pair do |k,v| %>
|
19
|
+
<tr>
|
20
|
+
<td><%= k%></td>
|
21
|
+
<td><%= v%></td>
|
22
|
+
</tr>
|
23
|
+
<% end %>
|
24
|
+
</table>
|
25
|
+
<% end %>
|
26
|
+
|
27
|
+
<p>Generated on <%= Time.now.localtime %></p>
|
@@ -3,6 +3,9 @@
|
|
3
3
|
<% if @churn %>
|
4
4
|
<li class='even failure'><a href="churn.html">Churn</a></li>
|
5
5
|
<% end %>
|
6
|
+
<% if @dcov %>
|
7
|
+
<li class='even failure'><a href="dcov.html">Dcov</a></li>
|
8
|
+
<% end %>
|
6
9
|
<% if @flay %>
|
7
10
|
<li class='even failure'><a href="flay.html">Flay</a></li>
|
8
11
|
<% end %>
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title>Dcov Code Coverage Results</title>
|
4
|
+
<style>
|
5
|
+
<%= inline_css("default.css") %>
|
6
|
+
</style>
|
7
|
+
</head>
|
8
|
+
|
9
|
+
<body>
|
10
|
+
<h2>Dcov Results</h2>
|
11
|
+
<h3>Documentation coverage information.</h3>
|
12
|
+
<p>
|
13
|
+
Total Files: <%=@dcov[:file_count]%><br />
|
14
|
+
<% ["Module","Class","Method"].each do |t| %>
|
15
|
+
Total <%=t.pluralize%>: <%=@dcov["total_#{t.pluralize.downcase}".to_sym]%> with <%=@dcov["#{t.downcase}_coverage".to_sym][:coverage]%> coverage.<br />
|
16
|
+
<% end %>
|
17
|
+
</P>
|
18
|
+
<br/>
|
19
|
+
|
20
|
+
<% ["Module","Class","Method"].each do |t| %>
|
21
|
+
<h3>Undocumented <%=t.pluralize%>:</h3>
|
22
|
+
<table>
|
23
|
+
<tr>
|
24
|
+
<th><%= t%></th>
|
25
|
+
<th>Location</th>
|
26
|
+
</tr>
|
27
|
+
<%@dcov["#{t.downcase}_coverage".to_sym][:not_covored].each_pair do |k,v| %>
|
28
|
+
<tr>
|
29
|
+
<td><%= k%></td>
|
30
|
+
<td><%= v%></td>
|
31
|
+
</tr>
|
32
|
+
<% end %>
|
33
|
+
</table>
|
34
|
+
<% end %>
|
35
|
+
|
36
|
+
<p>Generated on <%= Time.now.localtime %></p>
|
37
|
+
</body>
|
38
|
+
</html>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<html>
|
1
|
+
<html>
|
2
2
|
<head>
|
3
3
|
<title>Metric Fu Results</title>
|
4
4
|
<style>
|
@@ -11,6 +11,9 @@
|
|
11
11
|
<% if @churn %>
|
12
12
|
<p><a href="churn.html">Churn report</a></p>
|
13
13
|
<% end %>
|
14
|
+
<% if @dcov %>
|
15
|
+
<p><a href="dcov.html">Dcov report</a></p>
|
16
|
+
<% end %>
|
14
17
|
<% if @flay %>
|
15
18
|
<p><a href="flay.html">Flay report</a></p>
|
16
19
|
<% end %>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pjstadig-metric_fu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jake Scruggs
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2009-
|
18
|
+
date: 2009-12-01 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -124,9 +124,14 @@ files:
|
|
124
124
|
- tasks/metric_fu.rake
|
125
125
|
- vendor/_fonts/monaco.ttf
|
126
126
|
- vendor/saikuro/saikuro.rb
|
127
|
+
- lib/generators/dcov.rb
|
128
|
+
- lib/templates/awesome/dcov.html.erb
|
129
|
+
- lib/templates/standard/dcov.html.erb
|
127
130
|
- Manifest.txt
|
128
131
|
has_rdoc: true
|
129
132
|
homepage: http://metric-fu.rubyforge.org/
|
133
|
+
licenses: []
|
134
|
+
|
130
135
|
post_install_message:
|
131
136
|
rdoc_options:
|
132
137
|
- --main
|
@@ -148,9 +153,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
153
|
requirements: []
|
149
154
|
|
150
155
|
rubyforge_project:
|
151
|
-
rubygems_version: 1.
|
156
|
+
rubygems_version: 1.3.5
|
152
157
|
signing_key:
|
153
|
-
specification_version:
|
158
|
+
specification_version: 3
|
154
159
|
summary: A fistful of code metrics, with awesome templates and graphs
|
155
160
|
test_files:
|
156
161
|
- spec/base/base_template_spec.rb
|