Class: Rubycritic::Reporter

Inherits:
Object
  • Object
show all
Defined in:
lib/rubycritic/report_generators/reporter.rb

Constant Summary collapse

ASSETS_DIR =
File.expand_path("../assets", __FILE__)

Instance Method Summary collapse

Constructor Details

#initialize(source_pathnames, smelly_pathnames) ⇒ Reporter

Returns a new instance of Reporter.



11
12
13
14
# File 'lib/rubycritic/report_generators/reporter.rb', line 11

def initialize(source_pathnames, smelly_pathnames)
  @source_pathnames = source_pathnames
  @smelly_pathnames = smelly_pathnames
end

Instance Method Details

#generate_reportObject



16
17
18
19
20
21
22
23
24
# File 'lib/rubycritic/report_generators/reporter.rb', line 16

def generate_report
  generators.each do |generator|
    FileUtils.mkdir_p(generator.file_directory)
    File.open(generator.file_pathname, "w+") do |file|
      file.write(generator.render)
    end
  end
  FileUtils.cp_r(ASSETS_DIR, BaseGenerator::REPORT_DIR)
end