edouard-metric_fu 1.0.3.2 → 1.0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/base/base_template.rb +134 -0
- data/lib/base/configuration.rb +187 -0
- data/lib/base/generator.rb +147 -0
- data/lib/base/md5_tracker.rb +52 -0
- data/lib/base/report.rb +100 -0
- data/lib/generators/churn.rb +86 -0
- data/lib/generators/flay.rb +29 -0
- data/lib/generators/flog.rb +127 -0
- data/lib/generators/rcov.rb +77 -0
- data/lib/generators/reek.rb +32 -0
- data/lib/generators/roodi.rb +24 -0
- data/lib/generators/saikuro.rb +211 -0
- data/lib/generators/stats.rb +43 -0
- data/lib/metric_fu.rb +21 -0
- data/lib/templates/awesome/awesome_template.rb +30 -0
- data/lib/templates/awesome/churn.html.erb +19 -0
- data/lib/templates/awesome/default.css +62 -0
- data/lib/templates/awesome/flay.html.erb +22 -0
- data/lib/templates/awesome/flog.html.erb +42 -0
- data/lib/templates/awesome/index.html.erb +28 -0
- data/lib/templates/awesome/rcov.html.erb +32 -0
- data/lib/templates/awesome/reek.html.erb +30 -0
- data/lib/templates/awesome/roodi.html.erb +17 -0
- data/lib/templates/awesome/saikuro.html.erb +71 -0
- data/lib/templates/awesome/stats.html.erb +41 -0
- data/lib/templates/standard/churn.html.erb +30 -0
- data/lib/templates/standard/default.css +64 -0
- data/lib/templates/standard/flay.html.erb +33 -0
- data/lib/templates/standard/flog.html.erb +52 -0
- data/lib/templates/standard/index.html.erb +38 -0
- data/lib/templates/standard/rcov.html.erb +42 -0
- data/lib/templates/standard/reek.html.erb +41 -0
- data/lib/templates/standard/roodi.html.erb +28 -0
- data/lib/templates/standard/saikuro.html.erb +83 -0
- data/lib/templates/standard/standard_template.rb +26 -0
- data/lib/templates/standard/stats.html.erb +54 -0
- data/tasks/metric_fu.rake +15 -0
- data/tasks/railroad.rake +39 -0
- data/vendor/saikuro/saikuro.rb +1214 -0
- metadata +40 -1
@@ -0,0 +1,26 @@
|
|
1
|
+
class StandardTemplate < MetricFu::Template
|
2
|
+
|
3
|
+
|
4
|
+
def write
|
5
|
+
report.each_pair do |section, contents|
|
6
|
+
if template_exists?(section)
|
7
|
+
create_instance_var(section, contents)
|
8
|
+
html = erbify(section)
|
9
|
+
fn = output_filename(section)
|
10
|
+
MetricFu.report.save_output(html, MetricFu.output_directory, fn)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
# Instance variables we need should already be created from above
|
15
|
+
if template_exists?('index')
|
16
|
+
html = erbify('index')
|
17
|
+
fn = output_filename('index')
|
18
|
+
MetricFu.report.save_output(html, MetricFu.output_directory, fn)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def this_directory
|
23
|
+
File.dirname(__FILE__)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
@@ -0,0 +1,54 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title>Rake Stats Results</title>
|
4
|
+
<style>
|
5
|
+
<%= inline_css("default.css") %>
|
6
|
+
</style>
|
7
|
+
</head>
|
8
|
+
|
9
|
+
<body>
|
10
|
+
<h1>Rake Stats Results</h1>
|
11
|
+
<p>Rails rake stats results.</p>
|
12
|
+
<table>
|
13
|
+
<tr>
|
14
|
+
<th>Lines of Code</th>
|
15
|
+
<th>Lines of Test</th>
|
16
|
+
<th>Code to test ratio</th>
|
17
|
+
</tr>
|
18
|
+
<tr>
|
19
|
+
<td><%= @stats[:codeLOC] %></td>
|
20
|
+
<td><%= @stats[:testLOC] %></td>
|
21
|
+
<td>1:<%= @stats[:code_to_test_ratio] %></td>
|
22
|
+
</tr>
|
23
|
+
</table>
|
24
|
+
|
25
|
+
<table>
|
26
|
+
<tr>
|
27
|
+
<th>Name</th>
|
28
|
+
<th>Lines</th>
|
29
|
+
<th>LOC</th>
|
30
|
+
<th>Classes</th>
|
31
|
+
<th>Methods</th>
|
32
|
+
<th>Methods per class</th>
|
33
|
+
<th>LOC per method</th>
|
34
|
+
</tr>
|
35
|
+
<% count = 0 %>
|
36
|
+
<% @stats[:lines].each do |line| %>
|
37
|
+
<tr>
|
38
|
+
<td><%= line[:name] %></td>
|
39
|
+
<td><%= line[:lines] %></td>
|
40
|
+
<td><%= line[:loc] %></td>
|
41
|
+
<td><%= line[:classes] %></td>
|
42
|
+
<td><%= line[:methods] %></td>
|
43
|
+
<td><%= line[:methods_per_class] %></td>
|
44
|
+
<td><%= line[:loc_per_method] %></td>
|
45
|
+
</tr>
|
46
|
+
<% count += 1 %>
|
47
|
+
<% end %>
|
48
|
+
</table>
|
49
|
+
|
50
|
+
<p>Generated on <%= Time.now.localtime %></p>
|
51
|
+
</body>
|
52
|
+
</html>
|
53
|
+
|
54
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rake'
|
2
|
+
namespace :metrics do
|
3
|
+
desc "Generate all metrics reports"
|
4
|
+
task :all do
|
5
|
+
MetricFu::Configuration.run {}
|
6
|
+
MetricFu.metrics.each {|metric| MetricFu.report.add(metric) }
|
7
|
+
MetricFu.report.save_output(MetricFu.report.to_yaml,
|
8
|
+
MetricFu.base_directory,
|
9
|
+
'report.yml')
|
10
|
+
MetricFu.report.save_templatized_report
|
11
|
+
if MetricFu.report.open_in_browser?
|
12
|
+
MetricFu.report.show_in_browser(MetricFu.output_directory)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/tasks/railroad.rake
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
namespace :metrics do
|
2
|
+
|
3
|
+
RAILROAD_DIR = File.join(MetricFu::BASE_DIRECTORY, 'railroad')
|
4
|
+
RAILROAD_FILE = File.join(RAILROAD_DIR, 'index.html')
|
5
|
+
|
6
|
+
task :railroad => ['railroad:all'] do
|
7
|
+
end
|
8
|
+
|
9
|
+
namespace :railroad do
|
10
|
+
|
11
|
+
desc "Create all railroad reports"
|
12
|
+
task :all => [:models, :controllers, :aasm] do
|
13
|
+
#system("open #{RAILROAD_INDEX}") if PLATFORM['darwin']
|
14
|
+
end
|
15
|
+
|
16
|
+
desc "Create a railroad models report"
|
17
|
+
task :models do
|
18
|
+
#mkdir_p(RAILROAD_DIR) unless File.directory?(RAILROAD_DIR)
|
19
|
+
`railroad -M -a -m -l -v | neato -Tpng > #{File.join(MetricFu::BASE_DIRECTORY,'model-diagram.png')}`
|
20
|
+
#`echo "<a href=\"railroad/models.png\">Model diagram</a><br />" >> #{RAILROAD_FILE}`
|
21
|
+
end
|
22
|
+
|
23
|
+
desc "Create a railroad controllers report"
|
24
|
+
task :controllers do
|
25
|
+
#mkdir_p(RAILROAD_DIR) unless File.directory?(RAILROAD_DIR)
|
26
|
+
`railroad -C -l -v | neato -Tpng > #{File.join(MetricFu::BASE_DIRECTORY,'controller-diagram.png')}`
|
27
|
+
#`echo "<a href=\"railroad/controllers.png\">Controller diagram</a><br />" >> #{RAILROAD_FILE}`
|
28
|
+
end
|
29
|
+
|
30
|
+
desc "Create a railroad acts_as_state_machine report"
|
31
|
+
task :aasm do
|
32
|
+
#mkdir_p(RAILROAD_DIR) unless File.directory?(RAILROAD_DIR)
|
33
|
+
`railroad -A -l -v | neato -Tpng > #{File.join(MetricFu::BASE_DIRECTORY,'aasm-diagram.png')}`
|
34
|
+
#`echo "<a href=\"railroad/aasm.png\">State machine diagram</a><br />" >> #{RAILROAD_FILE}`
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|