class PdfExportTasks
Public Instance Methods
export()
click to toggle source
# File lib/tasks/thorfile.rb, line 9 def export require 'config/environment' # The options we'll end up passing to the Processor class opts = {} report_path = options.output || Rails.root unless report_path.to_s =~ /\.pdf\z/ date = DateTime.now.strftime('%Y-%m-%d') base_filename = "dradis-report_#{date}.pdf" report_filename = NamingService.name_file( original_filename: base_filename, pathname: Pathname.new(report_path) ) report_path = File.join(report_path, report_filename) end detect_and_set_project_scope exporter = Dradis::Plugins::PdfExport::Exporter.new(task_options) pdf = exporter.export File.open(report_path, 'wb') do |f| f << pdf.render end logger.info{ "Report file created at:\n\t#{report_path}" } end