metric_fu 4.10.0 → 4.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +2 -2
- data/.simplecov +42 -0
- data/.travis.yml +7 -6
- data/CONTRIBUTING.md +1 -1
- data/DEV.md +4 -3
- data/Gemfile +29 -7
- data/HISTORY.md +29 -3
- data/README.md +6 -1
- data/Rakefile +33 -11
- data/checksum/metric_fu-4.10.0.gem.sha512 +1 -1
- data/gem_tasks/usage_test.rake +0 -11
- data/lib/metric_fu.rb +12 -0
- data/lib/metric_fu/configuration.rb +1 -5
- data/lib/metric_fu/environment.rb +3 -3
- data/lib/metric_fu/formatter.rb +1 -1
- data/lib/metric_fu/formatter/html.rb +9 -9
- data/lib/metric_fu/gem_run.rb +2 -2
- data/lib/metric_fu/{metrics/generator.rb → generator.rb} +0 -0
- data/lib/metric_fu/loader.rb +30 -23
- data/lib/metric_fu/logger.rb +65 -0
- data/lib/metric_fu/logging/mf_debugger.rb +13 -48
- data/lib/metric_fu/metric.rb +3 -3
- data/lib/metric_fu/metrics/cane/{cane.rb → generator.rb} +0 -0
- data/lib/metric_fu/metrics/cane/{cane_grapher.rb → grapher.rb} +0 -0
- data/lib/metric_fu/metrics/cane/{init.rb → metric.rb} +1 -1
- data/lib/metric_fu/metrics/cane/{template_awesome/cane.html.erb → report.html.erb} +0 -0
- data/lib/metric_fu/metrics/churn/{churn.rb → generator.rb} +0 -0
- data/lib/metric_fu/metrics/churn/{churn_hotspot.rb → hotspot.rb} +0 -0
- data/lib/metric_fu/metrics/churn/{init.rb → metric.rb} +0 -0
- data/lib/metric_fu/metrics/churn/{template_awesome/churn.html.erb → report.html.erb} +0 -0
- data/lib/metric_fu/metrics/flay/{flay.rb → generator.rb} +16 -2
- data/lib/metric_fu/metrics/flay/{flay_grapher.rb → grapher.rb} +0 -0
- data/lib/metric_fu/metrics/flay/{flay_hotspot.rb → hotspot.rb} +0 -0
- data/lib/metric_fu/metrics/flay/{init.rb → metric.rb} +1 -1
- data/lib/metric_fu/metrics/flay/{template_awesome/flay.html.erb → report.html.erb} +0 -0
- data/lib/metric_fu/metrics/flog/{flog.rb → generator.rb} +0 -0
- data/lib/metric_fu/metrics/flog/{flog_grapher.rb → grapher.rb} +0 -0
- data/lib/metric_fu/metrics/flog/{flog_hotspot.rb → hotspot.rb} +0 -0
- data/lib/metric_fu/metrics/flog/{init.rb → metric.rb} +1 -1
- data/lib/metric_fu/metrics/flog/{template_awesome/flog.html.erb → report.html.erb} +0 -0
- data/lib/metric_fu/metrics/hotspots/{hotspots.rb → generator.rb} +1 -1
- data/lib/metric_fu/metrics/hotspots/{init.rb → metric.rb} +0 -0
- data/lib/metric_fu/metrics/hotspots/{template_awesome/hotspots.html.erb → report.html.erb} +0 -0
- data/lib/metric_fu/metrics/rails_best_practices/{rails_best_practices.rb → generator.rb} +0 -0
- data/lib/metric_fu/metrics/rails_best_practices/{rails_best_practices_grapher.rb → grapher.rb} +0 -0
- data/lib/metric_fu/metrics/rails_best_practices/{init.rb → metric.rb} +1 -1
- data/lib/metric_fu/metrics/rails_best_practices/{template_awesome/rails_best_practices.html.erb → report.html.erb} +0 -0
- data/lib/metric_fu/metrics/rcov/{rcov.rb → generator.rb} +0 -0
- data/lib/metric_fu/metrics/rcov/{rcov_grapher.rb → grapher.rb} +0 -0
- data/lib/metric_fu/metrics/rcov/{rcov_hotspot.rb → hotspot.rb} +0 -0
- data/lib/metric_fu/metrics/rcov/{init.rb → metric.rb} +0 -0
- data/lib/metric_fu/metrics/rcov/rcov_format_coverage.rb +57 -9
- data/lib/metric_fu/metrics/rcov/{template_awesome/rcov.html.erb → report.html.erb} +0 -0
- data/lib/metric_fu/metrics/rcov/simplecov_formatter.rb +13 -2
- data/lib/metric_fu/metrics/reek/{reek.rb → generator.rb} +0 -0
- data/lib/metric_fu/metrics/reek/{reek_grapher.rb → grapher.rb} +0 -0
- data/lib/metric_fu/metrics/reek/{reek_hotspot.rb → hotspot.rb} +1 -1
- data/lib/metric_fu/metrics/reek/{init.rb → metric.rb} +0 -0
- data/lib/metric_fu/metrics/reek/{template_awesome/reek.html.erb → report.html.erb} +0 -0
- data/lib/metric_fu/metrics/roodi/{roodi.rb → generator.rb} +0 -0
- data/lib/metric_fu/metrics/roodi/{roodi_grapher.rb → grapher.rb} +0 -0
- data/lib/metric_fu/metrics/roodi/{roodi_hotspot.rb → hotspot.rb} +0 -0
- data/lib/metric_fu/metrics/roodi/{init.rb → metric.rb} +0 -0
- data/lib/metric_fu/metrics/roodi/{template_awesome/roodi.html.erb → report.html.erb} +0 -0
- data/lib/metric_fu/metrics/saikuro/{saikuro.rb → generator.rb} +0 -0
- data/lib/metric_fu/metrics/saikuro/{saikuro_hotspot.rb → hotspot.rb} +0 -0
- data/lib/metric_fu/metrics/saikuro/{init.rb → metric.rb} +0 -0
- data/lib/metric_fu/metrics/saikuro/{template_awesome/saikuro.html.erb → report.html.erb} +0 -0
- data/lib/metric_fu/metrics/stats/{stats.rb → generator.rb} +1 -1
- data/lib/metric_fu/metrics/stats/{stats_grapher.rb → grapher.rb} +0 -0
- data/lib/metric_fu/metrics/stats/{stats_hotspot.rb → hotspot.rb} +0 -0
- data/lib/metric_fu/metrics/stats/{init.rb → metric.rb} +0 -0
- data/lib/metric_fu/metrics/stats/{template_awesome/stats.html.erb → report.html.erb} +0 -0
- data/lib/metric_fu/{metrics → reporting/graphs}/graph.rb +0 -0
- data/lib/metric_fu/{reporting/templates/awesome → templates}/_graph.html.erb +0 -0
- data/lib/metric_fu/{reporting/templates/awesome → templates}/_report_footer.html.erb +0 -0
- data/lib/metric_fu/templates/configuration.rb +3 -2
- data/lib/metric_fu/{reporting/templates/awesome → templates}/index.html.erb +1 -1
- data/lib/metric_fu/{reporting/templates → templates}/javascripts/bluff-min.js +0 -0
- data/lib/metric_fu/{reporting/templates → templates}/javascripts/bluff_graph.js +0 -0
- data/lib/metric_fu/{reporting/templates → templates}/javascripts/excanvas.js +0 -0
- data/lib/metric_fu/{reporting/templates → templates}/javascripts/highcharts.js +0 -0
- data/lib/metric_fu/{reporting/templates → templates}/javascripts/highcharts_graph.js +0 -0
- data/lib/metric_fu/{reporting/templates → templates}/javascripts/js-class.js +0 -0
- data/lib/metric_fu/{reporting/templates → templates}/javascripts/standalone-framework.js +0 -0
- data/lib/metric_fu/{reporting/templates → templates}/javascripts/utils.js +0 -0
- data/lib/metric_fu/{reporting/templates/awesome → templates}/layout.html.erb +1 -1
- data/lib/metric_fu/templates/metrics_template.rb +68 -0
- data/lib/metric_fu/templates/report.rb +11 -3
- data/lib/metric_fu/{metrics/base_template.rb → templates/template.rb} +8 -24
- data/lib/metric_fu/utility.rb +25 -0
- data/lib/metric_fu/version.rb +1 -1
- data/metric_fu.gemspec +2 -0
- data/spec/capture_warnings.rb +48 -0
- data/spec/dummy/lib/bad_encoding.rb +6 -0
- data/spec/fixtures/coverage-153.rb +11 -0
- data/spec/fixtures/rcov_output.txt +135 -0
- data/spec/metric_fu/configuration_spec.rb +4 -265
- data/spec/metric_fu/formatter/configuration_spec.rb +46 -0
- data/spec/metric_fu/formatter/html_spec.rb +17 -25
- data/spec/metric_fu/formatter/yaml_spec.rb +1 -1
- data/spec/metric_fu/{metrics/generator_spec.rb → generator_spec.rb} +0 -0
- data/spec/metric_fu/metrics/cane/configuration_spec.rb +22 -0
- data/spec/metric_fu/metrics/cane/{cane_spec.rb → generator_spec.rb} +1 -1
- data/spec/metric_fu/metrics/churn/configuration_spec.rb +15 -0
- data/spec/metric_fu/metrics/churn/{churn_spec.rb → generator_spec.rb} +1 -1
- data/spec/metric_fu/metrics/flay/configuration_spec.rb +15 -0
- data/spec/metric_fu/metrics/flay/{flay_spec.rb → generator_spec.rb} +2 -2
- data/spec/metric_fu/metrics/flay/{flay_grapher_spec.rb → grapher_spec.rb} +1 -1
- data/spec/metric_fu/metrics/flog/configuration_spec.rb +20 -0
- data/spec/metric_fu/metrics/flog/{flog_spec.rb → generator_spec.rb} +1 -1
- data/spec/metric_fu/metrics/flog/{flog_grapher_spec.rb → grapher_spec.rb} +1 -1
- data/spec/metric_fu/metrics/hotspots/{hotspots_spec.rb → generator_spec.rb} +1 -1
- data/spec/metric_fu/metrics/rails_best_practices/configuration_spec.rb +47 -0
- data/spec/metric_fu/metrics/rails_best_practices/{rails_best_practices_spec.rb → generator_spec.rb} +1 -1
- data/spec/metric_fu/metrics/rails_best_practices/{rails_best_practices_grapher_spec.rb → grapher_spec.rb} +1 -1
- data/spec/metric_fu/metrics/rcov/configuration_spec.rb +30 -0
- data/spec/metric_fu/metrics/rcov/generator_spec.rb +26 -0
- data/spec/metric_fu/metrics/rcov/{rcov_grapher_spec.rb → grapher_spec.rb} +1 -1
- data/spec/metric_fu/metrics/rcov/{rcov_hotspot_spec.rb → hotspot_spec.rb} +2 -2
- data/spec/metric_fu/metrics/rcov/simplecov_formatter_spec.rb +40 -12
- data/spec/metric_fu/metrics/reek/configuration_spec.rb +13 -0
- data/spec/metric_fu/metrics/reek/{reek_spec.rb → generator_spec.rb} +1 -1
- data/spec/metric_fu/metrics/reek/{reek_grapher_spec.rb → grapher_spec.rb} +1 -1
- data/spec/metric_fu/metrics/roodi/configuration_spec.rb +16 -0
- data/spec/metric_fu/metrics/roodi/{roodi_spec.rb → generator_spec.rb} +1 -1
- data/spec/metric_fu/metrics/roodi/{roodi_grapher_spec.rb → grapher_spec.rb} +1 -1
- data/spec/metric_fu/metrics/saikuro/configuration_spec.rb +26 -0
- data/spec/metric_fu/metrics/saikuro/{saikuro_spec.rb → generator_spec.rb} +1 -1
- data/spec/metric_fu/metrics/stats/{stats_spec.rb → generator_spec.rb} +1 -1
- data/spec/metric_fu/metrics/stats/{stats_grapher_spec.rb → grapher_spec.rb} +1 -1
- data/spec/metric_fu/{metrics → reporting/graphs}/graph_spec.rb +1 -1
- data/spec/metric_fu/run_spec.rb +1 -1
- data/spec/metric_fu/templates/configuration_spec.rb +57 -0
- data/spec/metric_fu/templates/report_spec.rb +15 -0
- data/spec/metric_fu/{metrics/base_template_spec.rb → templates/template_spec.rb} +0 -0
- data/spec/quality_spec.rb +86 -0
- data/spec/shared/configured.rb +47 -0
- data/spec/shared/test_coverage.rb +99 -0
- data/spec/spec_helper.rb +9 -5
- data/spec/support/helper_methods.rb +3 -2
- data/spec/support/matcher_create_file.rb +2 -2
- data/spec/support/matcher_create_files.rb +2 -2
- data/spec/support/usage_test.rb +24 -7
- data/spec/usage_test_spec.rb +28 -2
- metadata +165 -112
- metadata.gz.sig +0 -0
- data/Gemfile.devtools +0 -39
- data/lib/metric_fu/reporting/templates/awesome/awesome_template.rb +0 -62
- data/spec/metric_fu/metrics/rcov/rcov_spec.rb +0 -185
metadata.gz.sig
CHANGED
Binary file
|
data/Gemfile.devtools
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
group :development do
|
4
|
-
gem 'rake', '~> 10.1.0'
|
5
|
-
gem 'rspec', '~> 3.0.0.beta1'
|
6
|
-
gem 'yard', '~> 0.8.7', group: :yard
|
7
|
-
end
|
8
|
-
|
9
|
-
group :yard do
|
10
|
-
gem 'kramdown', '~> 1.2.0'
|
11
|
-
end
|
12
|
-
|
13
|
-
group :guard do
|
14
|
-
gem 'guard', '~> 1.8.1'
|
15
|
-
gem 'guard-bundler', '~> 1.0.0'
|
16
|
-
gem 'guard-rspec'#, '~> 3.0.2'
|
17
|
-
# gem 'guard-rubocop', '~> 0.2.0'
|
18
|
-
|
19
|
-
# file system change event handling
|
20
|
-
gem 'listen', '~> 1.3.0'
|
21
|
-
gem 'rb-fchange', '~> 0.0.6', require: false
|
22
|
-
gem 'rb-fsevent', '~> 0.9.3', require: false
|
23
|
-
gem 'rb-inotify', '~> 0.9.0', require: false
|
24
|
-
|
25
|
-
# notification handling
|
26
|
-
gem 'libnotify', '~> 0.8.0', require: false
|
27
|
-
gem 'rb-notifu', '~> 0.0.4', require: false
|
28
|
-
gem 'terminal-notifier-guard', '~> 1.5.3', require: false
|
29
|
-
end
|
30
|
-
|
31
|
-
group :metrics do
|
32
|
-
# gem 'rubocop', '~> 0.14.1'
|
33
|
-
end
|
34
|
-
|
35
|
-
platform :jruby do
|
36
|
-
group :jruby do
|
37
|
-
gem 'jruby-openssl', '~> 0.8.5'
|
38
|
-
end
|
39
|
-
end
|
@@ -1,62 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
MetricFu.metrics_require { 'base_template' }
|
3
|
-
MetricFu.lib_require { 'templates/report' }
|
4
|
-
|
5
|
-
class AwesomeTemplate < MetricFu::Template
|
6
|
-
|
7
|
-
def write
|
8
|
-
@name = MetricFu.report_name
|
9
|
-
|
10
|
-
# Copy javascripts to output directory
|
11
|
-
Dir[File.join(template_directory, '..', 'javascripts', '*')].each do |f|
|
12
|
-
FileUtils.cp(f, File.join(self.output_directory, File.basename(f)))
|
13
|
-
end
|
14
|
-
|
15
|
-
@metrics = {}
|
16
|
-
result.each_pair do |section, contents|
|
17
|
-
if template_exists?(section)
|
18
|
-
create_instance_var(section, contents)
|
19
|
-
@metrics[section] = contents
|
20
|
-
create_instance_var(:per_file_data, per_file_data)
|
21
|
-
mf_debug "Generating html for section #{section} with #{template(section)} for result #{result.class}"
|
22
|
-
@html = erbify(section)
|
23
|
-
html = erbify('layout')
|
24
|
-
fn = output_filename(section)
|
25
|
-
formatter.write_template(html, fn)
|
26
|
-
else
|
27
|
-
mf_debug "no template for section #{section} with #{template(section)} for result #{result.class}"
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
# Instance variables we need should already be created from above
|
32
|
-
if template_exists?('index')
|
33
|
-
@html = erbify('index')
|
34
|
-
html = erbify('layout')
|
35
|
-
fn = output_filename('index')
|
36
|
-
formatter.write_template(html, fn)
|
37
|
-
else
|
38
|
-
mf_debug "no template for section index for result #{result.class}"
|
39
|
-
end
|
40
|
-
|
41
|
-
write_file_data
|
42
|
-
end
|
43
|
-
|
44
|
-
def write_file_data
|
45
|
-
per_file_data.each_pair do |file, lines|
|
46
|
-
next if file.to_s.empty?
|
47
|
-
next unless File.file?(file)
|
48
|
-
report = MetricFu::Templates::Report.new(file, lines).render(@metrics)
|
49
|
-
|
50
|
-
formatter.write_template(report, html_filename(file))
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
def html_filename(file)
|
55
|
-
"#{file.gsub(%r{/}, '_')}.html"
|
56
|
-
end
|
57
|
-
|
58
|
-
def template_directory
|
59
|
-
File.dirname(__FILE__)
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
@@ -1,185 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
MetricFu.metrics_require { 'rcov/rcov' }
|
3
|
-
|
4
|
-
describe MetricFu::RcovGenerator do
|
5
|
-
|
6
|
-
before do
|
7
|
-
setup_fs
|
8
|
-
MetricFu::Configuration.run do |config|
|
9
|
-
config.configure_metric(:rcov) do |rcov|
|
10
|
-
rcov.enabled = true
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
before :each do
|
16
|
-
@default_options = MetricFu::Metric.get_metric(:rcov).run_options
|
17
|
-
end
|
18
|
-
|
19
|
-
describe "emit" do
|
20
|
-
before :each do
|
21
|
-
options = {:external => nil}
|
22
|
-
@rcov = MetricFu::RcovGenerator.new(@default_options.merge(options))
|
23
|
-
end
|
24
|
-
|
25
|
-
it "should clear out previous output and make output folder" do
|
26
|
-
expect(MetricFu::Utility).to receive(:rm_rf).with(MetricFu::RcovGenerator.metric_directory, :verbose => false)
|
27
|
-
expect(MetricFu::Utility).to receive(:mkdir_p).with(MetricFu::RcovGenerator.metric_directory)
|
28
|
-
@rcov.reset_output_location
|
29
|
-
end
|
30
|
-
|
31
|
-
it "should set the RAILS_ENV" do
|
32
|
-
expect(MetricFu::Utility).to receive(:rm_rf).with(MetricFu::RcovGenerator.metric_directory, :verbose => false)
|
33
|
-
expect(MetricFu::Utility).to receive(:mkdir_p).with(MetricFu::RcovGenerator.metric_directory)
|
34
|
-
options = {:environment => 'metrics', :external => nil}
|
35
|
-
@rcov = MetricFu::RcovGenerator.new(@default_options.merge(options))
|
36
|
-
expect(@rcov.command).to include('RAILS_ENV=metrics')
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
describe "with RCOV_OUTPUT fed into" do
|
41
|
-
before :each do
|
42
|
-
options = {:external => nil}
|
43
|
-
@rcov = MetricFu::RcovGenerator.new(@default_options.merge(options))
|
44
|
-
expect(@rcov).to receive(:load_output).and_return(RCOV_OUTPUT)
|
45
|
-
@files = @rcov.analyze
|
46
|
-
end
|
47
|
-
|
48
|
-
describe "analyze" do
|
49
|
-
it "should compute percent of lines run" do
|
50
|
-
expect(@files["lib/templates/awesome/awesome_template.rb"][:percent_run]).to eq(13)
|
51
|
-
expect(@files["lib/templates/standard/standard_template.rb"][:percent_run]).to eq(14)
|
52
|
-
end
|
53
|
-
|
54
|
-
it "should know which lines were run" do
|
55
|
-
expect(@files["lib/templates/awesome/awesome_template.rb"][:lines]).
|
56
|
-
to include({:content=>"require 'fileutils'", :was_run=>true})
|
57
|
-
end
|
58
|
-
|
59
|
-
it "should know which lines NOT were run" do
|
60
|
-
expect(@files["lib/templates/awesome/awesome_template.rb"][:lines]).
|
61
|
-
to include({:content=>" if template_exists?(section)", :was_run=>false})
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
describe "to_h" do
|
66
|
-
it "should calculate total percentage for all files" do
|
67
|
-
expect(@rcov.to_h[:rcov][:global_percent_run]).to eq(13.7)
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
describe "with external configuration option set" do
|
72
|
-
before :each do
|
73
|
-
options = {:external => 'coverage/rcov.txt'}
|
74
|
-
@rcov = MetricFu::RcovGenerator.new(@default_options.merge(options))
|
75
|
-
end
|
76
|
-
|
77
|
-
it "should emit nothing if external configuration option is set" do
|
78
|
-
expect(MetricFu::Utility).not_to receive(:rm_rf)
|
79
|
-
@rcov.emit
|
80
|
-
end
|
81
|
-
|
82
|
-
it "should open the external rcov analysis file" do
|
83
|
-
expect(@rcov).to receive(:load_output).and_return(RCOV_OUTPUT)
|
84
|
-
@files = @rcov.analyze
|
85
|
-
end
|
86
|
-
|
87
|
-
end
|
88
|
-
|
89
|
-
|
90
|
-
RCOV_OUTPUT = <<-HERE
|
91
|
-
Profiling enabled.
|
92
|
-
.............................................................................................................................................................................................
|
93
|
-
|
94
|
-
|
95
|
-
Top 10 slowest examples:
|
96
|
-
0.2707830 MetricFu::RoodiGrapher responding to #get_metrics should push 13 to roodi_count
|
97
|
-
0.1994550 MetricFu::RcovGrapher responding to #get_metrics should update labels with the date
|
98
|
-
0.1985800 MetricFu::ReekGrapher responding to #get_metrics should set a hash of code smells to reek_count
|
99
|
-
0.1919860 MetricFu::ReekGrapher responding to #get_metrics should update labels with the date
|
100
|
-
0.1907400 MetricFu::RoodiGrapher responding to #get_metrics should update labels with the date
|
101
|
-
0.1883000 MetricFu::FlogGrapher responding to #get_metrics should update labels with the date
|
102
|
-
0.1882650 MetricFu::FlayGrapher responding to #get_metrics should push 476 to flay_score
|
103
|
-
0.1868780 MetricFu::FlogGrapher responding to #get_metrics should push to top_five_percent_average
|
104
|
-
0.1847730 MetricFu::FlogGrapher responding to #get_metrics should push 9.9 to flog_average
|
105
|
-
0.1844090 MetricFu::FlayGrapher responding to #get_metrics should update labels with the date
|
106
|
-
|
107
|
-
Finished in 2.517686 seconds
|
108
|
-
|
109
|
-
189 examples, 0 failures
|
110
|
-
================================================================================
|
111
|
-
lib/templates/awesome/awesome_template.rb
|
112
|
-
================================================================================
|
113
|
-
require 'fileutils'
|
114
|
-
|
115
|
-
class AwesomeTemplate < MetricFu::Template
|
116
|
-
|
117
|
-
def write
|
118
|
-
!! # Getting rid of the crap before and after the project name from integrity
|
119
|
-
!! @name = File.basename(MetricFu.run_dir).gsub(/^\w+-|-\w+$/, "")
|
120
|
-
!!
|
121
|
-
!! # Copy Bluff javascripts to output directory
|
122
|
-
!! Dir[File.join(template_directory, '..', 'javascripts', '*')].each do |f|
|
123
|
-
!! FileUtils.copy(f, File.join(MetricFu.output_directory, File.basename(f)))
|
124
|
-
!! end
|
125
|
-
!!
|
126
|
-
!! report.each_pair do |section, contents|
|
127
|
-
!! if template_exists?(section)
|
128
|
-
!! create_instance_var(section, contents)
|
129
|
-
!! @html = erbify(section)
|
130
|
-
!! html = erbify('layout')
|
131
|
-
!! fn = output_filename(section)
|
132
|
-
!! MetricFu.report.save_output(html, MetricFu.output_directory, fn)
|
133
|
-
!! end
|
134
|
-
!! end
|
135
|
-
!!
|
136
|
-
!! # Instance variables we need should already be created from above
|
137
|
-
!! if template_exists?('index')
|
138
|
-
!! @html = erbify('index')
|
139
|
-
!! html = erbify('layout')
|
140
|
-
!! fn = output_filename('index')
|
141
|
-
!! MetricFu.report.save_output(html, MetricFu.output_directory, fn)
|
142
|
-
!! end
|
143
|
-
!! end
|
144
|
-
|
145
|
-
def template_directory
|
146
|
-
!! File.dirname(__FILE__)
|
147
|
-
!! end
|
148
|
-
!! end
|
149
|
-
|
150
|
-
================================================================================
|
151
|
-
lib/templates/standard/standard_template.rb
|
152
|
-
================================================================================
|
153
|
-
class StandardTemplate < MetricFu::Template
|
154
|
-
|
155
|
-
|
156
|
-
def write
|
157
|
-
!! report.each_pair do |section, contents|
|
158
|
-
!! if template_exists?(section)
|
159
|
-
!! create_instance_var(section, contents)
|
160
|
-
!! html = erbify(section)
|
161
|
-
!! fn = output_filename(section)
|
162
|
-
!! MetricFu.report.save_output(html, MetricFu.output_directory, fn)
|
163
|
-
!! end
|
164
|
-
!! end
|
165
|
-
!!
|
166
|
-
!! # Instance variables we need should already be created from above
|
167
|
-
!! if template_exists?('index')
|
168
|
-
!! html = erbify('index')
|
169
|
-
!! fn = output_filename('index')
|
170
|
-
!! MetricFu.report.save_output(html, MetricFu.output_directory, fn)
|
171
|
-
!! end
|
172
|
-
!! end
|
173
|
-
|
174
|
-
def template_directory
|
175
|
-
!! File.dirname(__FILE__)
|
176
|
-
!! end
|
177
|
-
!! end
|
178
|
-
|
179
|
-
HERE
|
180
|
-
|
181
|
-
after do
|
182
|
-
cleanup_fs
|
183
|
-
end
|
184
|
-
|
185
|
-
end
|