dradis-projects 3.0.1 → 3.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/app/controllers/dradis/plugins/projects/packages_controller.rb +5 -9
- data/app/controllers/dradis/plugins/projects/templates_controller.rb +5 -7
- data/dradis-projects.gemspec +1 -1
- data/lib/dradis/plugins/projects.rb +4 -0
- data/lib/dradis/plugins/projects/engine.rb +10 -1
- data/lib/dradis/plugins/projects/export/package.rb +11 -6
- data/lib/dradis/plugins/projects/export/template.rb +10 -155
- data/lib/dradis/plugins/projects/export/v1/template.rb +167 -0
- data/lib/dradis/plugins/projects/gem_version.rb +2 -2
- data/lib/dradis/plugins/projects/upload/package.rb +11 -11
- data/lib/dradis/plugins/projects/upload/template.rb +37 -313
- data/lib/dradis/plugins/projects/upload/v1/template.rb +388 -0
- data/lib/tasks/thorfile.rb +25 -13
- metadata +7 -4
data/lib/tasks/thorfile.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'logger'
|
2
2
|
|
3
3
|
class ExportTasks < Thor
|
4
|
-
include
|
4
|
+
include Rails.application.config.dradis.thor_helper_module
|
5
5
|
|
6
6
|
namespace "dradis:plugins:projects:export"
|
7
7
|
|
@@ -10,9 +10,16 @@ class ExportTasks < Thor
|
|
10
10
|
def template
|
11
11
|
require 'config/environment'
|
12
12
|
|
13
|
+
# The options we'll end up passing to the Processor class
|
14
|
+
opts = {}
|
15
|
+
|
16
|
+
STDOUT.sync = true
|
13
17
|
logger = Logger.new(STDOUT)
|
14
18
|
logger.level = Logger::DEBUG
|
19
|
+
opts[:logger] = logger
|
20
|
+
|
15
21
|
template_path = options.file || Rails.root.join('backup').to_s
|
22
|
+
FileUtils.mkdir_p(template_path) unless File.exist?(template_path)
|
16
23
|
|
17
24
|
unless template_path =~ /\.xml\z/
|
18
25
|
date = DateTime.now.strftime("%Y-%m-%d")
|
@@ -25,10 +32,9 @@ class ExportTasks < Thor
|
|
25
32
|
|
26
33
|
detect_and_set_project_scope
|
27
34
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
)
|
35
|
+
exporter_class = Rails.application.config.dradis.projects.template_exporter
|
36
|
+
export_options = opts.merge(plugin: Dradis::Plugins::Projects)
|
37
|
+
exporter = exporter_class.new(export_options)
|
32
38
|
|
33
39
|
File.open(template_path, 'w') { |f| f.write exporter.export() }
|
34
40
|
|
@@ -45,11 +51,18 @@ class ExportTasks < Thor
|
|
45
51
|
def package
|
46
52
|
require 'config/environment'
|
47
53
|
|
54
|
+
# The options we'll end up passing to the Processor class
|
55
|
+
opts = {}
|
56
|
+
|
57
|
+
STDOUT.sync = true
|
48
58
|
logger = Logger.new(STDOUT)
|
49
59
|
logger.level = Logger::DEBUG
|
60
|
+
opts[:logger] = logger
|
61
|
+
|
50
62
|
package_path = options.file || Rails.root.join('backup')
|
63
|
+
FileUtils.mkdir_p(package_path) unless File.exist?(package_path)
|
51
64
|
|
52
|
-
unless package_path =~ /\.zip\z/
|
65
|
+
unless package_path.to_s =~ /\.zip\z/
|
53
66
|
date = DateTime.now.strftime("%Y-%m-%d")
|
54
67
|
sequence = Dir.glob(File.join(package_path, "dradis-export_#{date}_*.zip")).collect { |a| a.match(/_([0-9]+)\.zip\z/)[1].to_i }.max || 0
|
55
68
|
package_path = File.join(package_path, "dradis-export_#{date}_#{sequence + 1}.zip")
|
@@ -57,10 +70,9 @@ class ExportTasks < Thor
|
|
57
70
|
|
58
71
|
detect_and_set_project_scope
|
59
72
|
|
60
|
-
Dradis::Plugins::Projects
|
61
|
-
|
62
|
-
|
63
|
-
).export(filename: package_path)
|
73
|
+
export_options = opts.merge(plugin: Dradis::Plugins::Projects)
|
74
|
+
Dradis::Plugins::Projects::Export::Package.new(export_options).
|
75
|
+
export(filename: package_path)
|
64
76
|
|
65
77
|
logger.info{ "Project package created at:\n\t#{ File.expand_path( package_path ) }" }
|
66
78
|
logger.close
|
@@ -69,7 +81,7 @@ class ExportTasks < Thor
|
|
69
81
|
end
|
70
82
|
|
71
83
|
class UploadTasks < Thor
|
72
|
-
include
|
84
|
+
include Rails.application.config.dradis.thor_helper_module
|
73
85
|
|
74
86
|
namespace "dradis:plugins:projects:upload"
|
75
87
|
|
@@ -89,7 +101,7 @@ class UploadTasks < Thor
|
|
89
101
|
|
90
102
|
detect_and_set_project_scope
|
91
103
|
|
92
|
-
content_service =
|
104
|
+
content_service = Dradis::Plugins::ContentService.new(plugin: Dradis::Plugins::Projects::Upload::Template)
|
93
105
|
template_service = Dradis::Plugins::TemplateService.new(plugin: Dradis::Plugins::Projects::Upload::Template)
|
94
106
|
|
95
107
|
importer = Dradis::Plugins::Projects::Upload::Template::Importer.new(
|
@@ -122,7 +134,7 @@ class UploadTasks < Thor
|
|
122
134
|
|
123
135
|
detect_and_set_project_scope
|
124
136
|
|
125
|
-
content_service =
|
137
|
+
content_service = Dradis::Plugins::ContentService.new(plugin: Dradis::Plugins::Projects::Upload::Package)
|
126
138
|
template_service = Dradis::Plugins::TemplateService.new(plugin: Dradis::Plugins::Projects::Upload::Package)
|
127
139
|
|
128
140
|
importer = Dradis::Plugins::Projects::Upload::Package::Importer.new(
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dradis-projects
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0
|
4
|
+
version: 3.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Martin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '3.
|
75
|
+
version: '3.6'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '3.
|
82
|
+
version: '3.6'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rubyzip
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -104,6 +104,7 @@ extra_rdoc_files: []
|
|
104
104
|
files:
|
105
105
|
- ".gitignore"
|
106
106
|
- ".ruby-version"
|
107
|
+
- CHANGELOG.md
|
107
108
|
- CONTRIBUTING.md
|
108
109
|
- Gemfile
|
109
110
|
- LICENSE
|
@@ -118,9 +119,11 @@ files:
|
|
118
119
|
- lib/dradis/plugins/projects/engine.rb
|
119
120
|
- lib/dradis/plugins/projects/export/package.rb
|
120
121
|
- lib/dradis/plugins/projects/export/template.rb
|
122
|
+
- lib/dradis/plugins/projects/export/v1/template.rb
|
121
123
|
- lib/dradis/plugins/projects/gem_version.rb
|
122
124
|
- lib/dradis/plugins/projects/upload/package.rb
|
123
125
|
- lib/dradis/plugins/projects/upload/template.rb
|
126
|
+
- lib/dradis/plugins/projects/upload/v1/template.rb
|
124
127
|
- lib/dradis/plugins/projects/version.rb
|
125
128
|
- lib/tasks/thorfile.rb
|
126
129
|
homepage: http://dradisframework.org
|