class UploadTasks

Public Instance Methods

package(file_path) click to toggle source
# File lib/tasks/thorfile.rb, line 98
def package(file_path)
  require 'config/environment'

  unless File.exists?(file_path)
    $stderr.puts "** the file [#{file_path}] does not exist"
    exit -1
  end

  detect_and_set_project_scope

  default_user_id = @project ? @project.owners.first.id : User.first.id

  task_options.merge!({
    plugin: Dradis::Plugins::Projects::Upload::Package,
    default_user_id: default_user_id
  })

  importer = Dradis::Plugins::Projects::Upload::Package::Importer.new(task_options)
  importer.import(file: file_path)
end
template(file_path) click to toggle source
# File lib/tasks/thorfile.rb, line 72
def template(file_path)
  require 'config/environment'

  unless File.exists?(file_path)
    $stderr.puts "** the file [#{file_path}] does not exist"
    exit -1
  end

  detect_and_set_project_scope

  default_user_id = @project ? @project.owners.first.id : User.first.id

  task_options.merge!({
    plugin: Dradis::Plugins::Projects::Upload::Template,
    default_user_id: default_user_id
  })

  importer = Dradis::Plugins::Projects::Upload::Template::Importer.new(task_options)
  importer.import(file: file_path)
end