dradis-projects 3.6.0 → 3.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -1
- data/dradis-projects.gemspec +1 -1
- data/lib/dradis/plugins/projects/gem_version.rb +1 -1
- data/lib/dradis/plugins/projects/upload/template.rb +2 -0
- data/lib/dradis/plugins/projects/upload/v1/template.rb +22 -2
- data/lib/tasks/thorfile.rb +6 -48
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25a395a59c0ca4e3b6f93229f6a26e0ba7c8e9c4
|
4
|
+
data.tar.gz: f819ec97349717710edc060fb4cf4f88e7d3ee41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa436c78584124948064ca23edf7f6130514391bf2e3bb9b1ee31dd06767bc10c6c4727121d110190da752d5c570f50c259634d43e5eec86fc46c44d8281da38
|
7
|
+
data.tar.gz: a99db48a1e47d88ab6580c24388c221a93bc677b291b13a0136e9d4ae752f714b82a7ef4327753b6d1946fb05971114a148b7847891344b158f3309732feab26
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## Dradis Framework 3.7 (July, 2017) ##
|
2
|
+
|
3
|
+
* Skip closing the logger in thorfile
|
4
|
+
|
1
5
|
## Dradis Framework 3.6 (March XX, 2017) ##
|
2
6
|
|
3
7
|
* Include file version in project template export.
|
@@ -7,4 +11,3 @@
|
|
7
11
|
* Make the project template exporter / uploader configurable.
|
8
12
|
|
9
13
|
* Break down the #export and #parse methods into smaller tasks.
|
10
|
-
|
data/dradis-projects.gemspec
CHANGED
@@ -25,6 +25,6 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.add_development_dependency 'rake', '~> 10.0'
|
26
26
|
spec.add_development_dependency 'rspec'
|
27
27
|
|
28
|
-
spec.add_dependency 'dradis-plugins', '~> 3.
|
28
|
+
spec.add_dependency 'dradis-plugins', '~> 3.7'
|
29
29
|
spec.add_dependency 'rubyzip', '~> 1.2.1'
|
30
30
|
end
|
@@ -63,6 +63,7 @@ module Dradis::Plugins::Projects::Upload
|
|
63
63
|
parse_nodes(template)
|
64
64
|
parse_issues(template)
|
65
65
|
parse_methodologies(template)
|
66
|
+
parse_report_content(template)
|
66
67
|
parse_tags(template)
|
67
68
|
finalize(template)
|
68
69
|
# FIXME: returning this is gross
|
@@ -80,6 +81,7 @@ module Dradis::Plugins::Projects::Upload
|
|
80
81
|
def parse_issues(template); raise NotImplementedError; end
|
81
82
|
def parse_methodologies(template); raise NotImplementedError; end
|
82
83
|
def parse_nodes(template); raise NotImplementedError; end
|
84
|
+
def parse_report_content(template); raise NotImplementedError; end
|
83
85
|
def parse_tags(template); raise NotImplementedError; end
|
84
86
|
end
|
85
87
|
end
|
@@ -249,7 +249,6 @@ module Dradis::Plugins::Projects::Upload::V1
|
|
249
249
|
end
|
250
250
|
|
251
251
|
def parse_nodes(template)
|
252
|
-
|
253
252
|
logger.info { 'Processing Nodes...' }
|
254
253
|
|
255
254
|
# Re generate the Node tree structure
|
@@ -329,8 +328,29 @@ module Dradis::Plugins::Projects::Upload::V1
|
|
329
328
|
end
|
330
329
|
end
|
331
330
|
|
332
|
-
def
|
331
|
+
def parse_report_content(template)
|
332
|
+
logger.info { 'Processing Report Content...' }
|
333
|
+
|
334
|
+
contentlib_type_id =
|
335
|
+
template.at_xpath(
|
336
|
+
"//nodes/node/type-id[text()='#{Node::Types::CONTENTLIB}']"
|
337
|
+
)
|
338
|
+
|
339
|
+
if contentlib_type_id
|
340
|
+
content_library_xml = contentlib_type_id.parent
|
341
|
+
document_properties =
|
342
|
+
JSON.parse(content_library_xml.at_xpath('properties').text)
|
333
343
|
|
344
|
+
content_library = Node.content_library
|
345
|
+
content_library.properties =
|
346
|
+
content_library.properties.merge(document_properties)
|
347
|
+
content_library.save
|
348
|
+
end
|
349
|
+
|
350
|
+
logger.info { 'Done.' }
|
351
|
+
end
|
352
|
+
|
353
|
+
def parse_tags(template)
|
334
354
|
logger.info { 'Processing Tags...' }
|
335
355
|
|
336
356
|
template.xpath('dradis-template/tags/tag').each do |xml_tag|
|
data/lib/tasks/thorfile.rb
CHANGED
@@ -10,14 +10,6 @@ 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
|
17
|
-
logger = Logger.new(STDOUT)
|
18
|
-
logger.level = Logger::DEBUG
|
19
|
-
opts[:logger] = logger
|
20
|
-
|
21
13
|
template_path = options.file || Rails.root.join('backup').to_s
|
22
14
|
FileUtils.mkdir_p(template_path) unless File.exist?(template_path)
|
23
15
|
|
@@ -33,13 +25,12 @@ class ExportTasks < Thor
|
|
33
25
|
detect_and_set_project_scope
|
34
26
|
|
35
27
|
exporter_class = Rails.application.config.dradis.projects.template_exporter
|
36
|
-
export_options =
|
28
|
+
export_options = task_options.merge(plugin: Dradis::Plugins::Projects)
|
37
29
|
exporter = exporter_class.new(export_options)
|
38
30
|
|
39
31
|
File.open(template_path, 'w') { |f| f.write exporter.export() }
|
40
32
|
|
41
33
|
logger.info { "Template file created at:\n\t#{ File.expand_path( template_path ) }" }
|
42
|
-
logger.close
|
43
34
|
end
|
44
35
|
|
45
36
|
|
@@ -51,14 +42,6 @@ class ExportTasks < Thor
|
|
51
42
|
def package
|
52
43
|
require 'config/environment'
|
53
44
|
|
54
|
-
# The options we'll end up passing to the Processor class
|
55
|
-
opts = {}
|
56
|
-
|
57
|
-
STDOUT.sync = true
|
58
|
-
logger = Logger.new(STDOUT)
|
59
|
-
logger.level = Logger::DEBUG
|
60
|
-
opts[:logger] = logger
|
61
|
-
|
62
45
|
package_path = options.file || Rails.root.join('backup')
|
63
46
|
FileUtils.mkdir_p(package_path) unless File.exist?(package_path)
|
64
47
|
|
@@ -70,14 +53,12 @@ class ExportTasks < Thor
|
|
70
53
|
|
71
54
|
detect_and_set_project_scope
|
72
55
|
|
73
|
-
export_options =
|
56
|
+
export_options = task_options.merge(plugin: Dradis::Plugins::Projects)
|
74
57
|
Dradis::Plugins::Projects::Export::Package.new(export_options).
|
75
58
|
export(filename: package_path)
|
76
59
|
|
77
60
|
logger.info{ "Project package created at:\n\t#{ File.expand_path( package_path ) }" }
|
78
|
-
logger.close
|
79
61
|
end
|
80
|
-
|
81
62
|
end
|
82
63
|
|
83
64
|
class UploadTasks < Thor
|
@@ -91,9 +72,6 @@ class UploadTasks < Thor
|
|
91
72
|
def template(file_path)
|
92
73
|
require 'config/environment'
|
93
74
|
|
94
|
-
logger = Logger.new(STDOUT)
|
95
|
-
logger.level = Logger::DEBUG
|
96
|
-
|
97
75
|
unless File.exists?(file_path)
|
98
76
|
$stderr.puts "** the file [#{file_path}] does not exist"
|
99
77
|
exit -1
|
@@ -101,18 +79,10 @@ class UploadTasks < Thor
|
|
101
79
|
|
102
80
|
detect_and_set_project_scope
|
103
81
|
|
104
|
-
|
105
|
-
template_service = Dradis::Plugins::TemplateService.new(plugin: Dradis::Plugins::Projects::Upload::Template)
|
106
|
-
|
107
|
-
importer = Dradis::Plugins::Projects::Upload::Template::Importer.new(
|
108
|
-
logger: logger,
|
109
|
-
content_service: content_service,
|
110
|
-
template_service: template_service
|
111
|
-
)
|
82
|
+
task_options.merge!(plugin: Dradis::Plugins::Projects::Upload::Template)
|
112
83
|
|
84
|
+
importer = Dradis::Plugins::Projects::Upload::Template::Importer.new(task_options)
|
113
85
|
importer.import(file: file_path)
|
114
|
-
|
115
|
-
logger.close
|
116
86
|
end
|
117
87
|
|
118
88
|
|
@@ -123,29 +93,17 @@ class UploadTasks < Thor
|
|
123
93
|
def package(file_path)
|
124
94
|
require 'config/environment'
|
125
95
|
|
126
|
-
logger = Logger.new(STDOUT)
|
127
|
-
logger.level = Logger::DEBUG
|
128
|
-
|
129
96
|
unless File.exists?(file_path)
|
130
97
|
$stderr.puts "** the file [#{file_path}] does not exist"
|
131
98
|
exit -1
|
132
99
|
end
|
133
100
|
|
134
|
-
|
135
101
|
detect_and_set_project_scope
|
136
102
|
|
137
|
-
|
138
|
-
template_service = Dradis::Plugins::TemplateService.new(plugin: Dradis::Plugins::Projects::Upload::Package)
|
139
|
-
|
140
|
-
importer = Dradis::Plugins::Projects::Upload::Package::Importer.new(
|
141
|
-
logger: logger,
|
142
|
-
content_service: content_service,
|
143
|
-
template_service: template_service
|
144
|
-
)
|
103
|
+
task_options.merge!(plugin: Dradis::Plugins::Projects::Upload::Package)
|
145
104
|
|
105
|
+
importer = Dradis::Plugins::Projects::Upload::Package::Importer.new(task_options)
|
146
106
|
importer.import(file: file_path)
|
147
|
-
|
148
|
-
logger.close
|
149
107
|
end
|
150
108
|
|
151
109
|
end
|
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.
|
4
|
+
version: 3.7.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-07-27 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.7'
|
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.7'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rubyzip
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -146,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
146
146
|
version: '0'
|
147
147
|
requirements: []
|
148
148
|
rubyforge_project:
|
149
|
-
rubygems_version: 2.
|
149
|
+
rubygems_version: 2.6.8
|
150
150
|
signing_key:
|
151
151
|
specification_version: 4
|
152
152
|
summary: Project export/upload for the Dradis Framework.
|