indirect-metric_fu 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,40 +0,0 @@
1
- require 'erb'
2
- require 'fileutils'
3
-
4
- module MetricFu
5
- class Flay
6
-
7
- class << self
8
- def generate_report(options = {})
9
- puts Dir.pwd
10
- files_to_flay = MetricFu::CODE_DIRS.map{|dir| Dir[File.join(dir, "**/*.rb")] }
11
- output = `flay #{files_to_flay.join(" ")}`
12
- @matches = output.chomp.split("\n\n").map{|m| m.split("\n ") }
13
- write_html_output("flay")
14
- end
15
-
16
- private
17
- def write_html_output(template_name)
18
- output_dir = File.join(MetricFu::BASE_DIRECTORY, template_name)
19
- FileUtils.mkdir_p(output_dir, :verbose => false)
20
-
21
- template_file = File.join(MetricFu::TEMPLATE_DIR, "#{template_name}.html.erb")
22
- html = ERB.new(File.read(template_file)).result(binding)
23
-
24
- File.open(File.join(output_dir, 'index.html'), "w"){|f| f << html }
25
- FileUtils.cp(File.join(MetricFu::TEMPLATE_DIR, "#{template_name}.css"), output_dir)
26
- `open #{output_dir}/index.html`
27
- end
28
-
29
- def link_to_filename(name, line = nil)
30
- filename = File.expand_path(name)
31
- if PLATFORM['darwin']
32
- %{<a href="txmt://open/?url=file://#{filename}&line=#{line}">#{name}</a>}
33
- else
34
- %{<a href="file://#{filename}">#{name}</a>}
35
- end
36
- end
37
- end
38
-
39
- end
40
- end