Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v5.0.0 (March 2026)
- Accept file path argument when exporting via the command line

v4.19.0 (November 2025)
- No changes

Expand Down
4 changes: 2 additions & 2 deletions lib/dradis/plugins/csv_export/gem_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ def self.gem_version
end

module VERSION
MAJOR = 4
MINOR = 19
MAJOR = 5
MINOR = 0
TINY = 0
PRE = nil

Expand Down
26 changes: 16 additions & 10 deletions lib/tasks/thorfile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,31 @@ class CSVTasks < Thor
namespace "dradis:plugins:csv"

desc "export", "export issues to a CSV file"
method_option :output, required: false, type: :string, desc: "the report file to create (if ends in .csv), or directory to create it in"
def export
require 'config/environment'

report_path = options.output || Rails.root.join('tmp')
unless report_path.to_s =~ /\.csv\z/
date = DateTime.now.strftime("%Y-%m-%d")
base_filename = "dradis-report_#{date}.csv"

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::CSVExport::Exporter.new(task_options)
csv = exporter.export()

date = DateTime.now.strftime("%Y-%m-%d")
base_filename = "dradis-report_#{date}.csv"

filename = NamingService.name_file(
original_filename: base_filename,
pathname: Rails.root
)

File.open(filename, 'w') { |f| f.write csv }
File.open(report_path, 'w') { |f| f.write csv }

logger.info "File written to ./#{ filename }"
logger.info "Report file created at:\n\t#{report_path}"
end

end