Class: AwesomeTemplate

Inherits:
MetricFu::Template show all
Defined in:
lib/templates/awesome/awesome_template.rb

Instance Attribute Summary

Attributes inherited from MetricFu::Template

#report

Instance Method Summary collapse

Instance Method Details

#this_directoryObject


33
34
35
# File 'lib/templates/awesome/awesome_template.rb', line 33

def this_directory
  File.dirname(__FILE__)
end

#writeObject


5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/templates/awesome/awesome_template.rb', line 5

def write
  # Getting rid of the crap before and after the project name from integrity
  @name = File.basename(Dir.pwd).gsub(/^\w+-|-\w+$/, "")

  # Copy Bluff javascripts to output directory
  Dir[File.join(this_directory, '..', 'javascripts', '*')].each do |f|
    FileUtils.copy(f, File.join(MetricFu.output_directory, File.basename(f)))
  end

  report.each_pair do |section, contents|
    if template_exists?(section)
      create_instance_var(section, contents)
      @html = erbify(section)
      html = erbify('layout')
      fn = output_filename(section)
      MetricFu.report.save_output(html, MetricFu.output_directory, fn)
    end
  end

  # Instance variables we need should already be created from above
  if template_exists?('index')
    @html = erbify('index')
    html = erbify('layout')
    fn = output_filename('index')
    MetricFu.report.save_output(html, MetricFu.output_directory, fn)
  end
end