Class: UploadTasks
- Inherits:
-
Thor
- Object
- Thor
- UploadTasks
- Defined in:
- lib/tasks/thorfile.rb
Instance Method Summary collapse
Instance Method Details
#package(file_path) ⇒ Object
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# 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 .merge!({ plugin: Dradis::Plugins::Projects::Upload::Package, default_user_id: default_user_id }) importer = Dradis::Plugins::Projects::Upload::Package::Importer.new() importer.import(file: file_path) end |
#template(file_path) ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# 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 .merge!({ plugin: Dradis::Plugins::Projects::Upload::Template, default_user_id: default_user_id }) importer = Dradis::Plugins::Projects::Upload::Template::Importer.new() importer.import(file: file_path) end |