Class: GitHealthCheck::Report

Inherits:
Object
  • Object
show all
Defined in:
lib/git-health-check/report.rb

Instance Method Summary collapse

Constructor Details

#initialize(working_copy, history, packfile, options) ⇒ Report

Returns a new instance of Report.


7
8
9
10
11
12
13
# File 'lib/git-health-check/report.rb', line 7

def initialize(working_copy, history, packfile, options)
  @working_copy = working_copy
  @history = history
  @packfile = packfile
  @repository = options[:repository]
  @report_directory = @repository + '/healthcheck'
end

Instance Method Details

#createObject


23
24
25
26
27
28
29
30
31
32
# File 'lib/git-health-check/report.rb', line 23

def create
  rhtml = ERB.new(get_template)
  output = rhtml.result(get_binding)

  Dir.mkdir @report_directory unless File.directory? @report_directory

  File.open(@report_directory + '/report.html', 'w+') do |f|
    f.write output
  end
end

#get_bindingObject


15
16
17
# File 'lib/git-health-check/report.rb', line 15

def get_binding
  binding
end

#get_templateObject


19
20
21
# File 'lib/git-health-check/report.rb', line 19

def get_template
  File.read(File.dirname(__FILE__) + '/report/report.erb')
end