def export
require 'config/environment'
opts = {}
report_path = options.output || Rails.root
unless report_path.to_s =~ /\.html\z/
date = DateTime.now.strftime("%Y-%m-%d")
base_filename = "dradis-report_#{date}.html"
report_filename = NamingService.name_file(
original_filename: base_filename,
pathname: Pathname.new(report_path)
)
report_path = File.join(report_path, report_filename)
end
if template = options.template
shell.error("Template file doesn't exist") && exit(1) unless File.exists?(template)
task_options[:template] = template
end
detect_and_set_project_scope
exporter = Dradis::Plugins::HtmlExport::Exporter.new(task_options)
html = exporter.export
File.open(report_path, 'w') do |f|
f << html
end
logger.info{ "Report file created at:\n\t#{report_path}" }
end