def generate(target_dir, with_assets = true)
      target_dir = File.expand_path target_dir
      copy_assets target_dir if with_assets

      render.each do |view_name, output|
        file_name = File.join target_dir, view_name.to_s.downcase + '.html'
        begin
          output_file = File.open file_name, 'wb'
          output_file.write output
        ensure
          output_file.close
        end
      end
    end
def generate(target_dir, with_assets = true)
      target_dir = File.expand_path target_dir
      copy_assets target_dir if with_assets

      render.each do |view_name, output|
        file_name = File.join target_dir, view_name.to_s.downcase + '.html'
        begin
          output_file = File.open file_name, 'wb'
          output_file.write output
        ensure
          output_file.close
        end
      end
    end
Creates a new report for the given repository and commit range

 @param [Repository] repository The repository to analyze
 @param [String, Range] range The commit range to analyze
 Generates this report's output into the given target directory

 This will generate individual HTML files for the main views of the
 report.

 @param [String] target_dir The target directory of the report
 @param [Boolean] with_assets If `false` the report's assets will not be
        copied to the target directory