dradis-html_export 3.20.0 → 4.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f6ac583114b620b0f712eec9d0d4635012a0566e1b6b5bf6e331b708991c223
4
- data.tar.gz: 571a3c231cddac14d08577f6811dd8beab715a0387fc763a99ce57b8340e9110
3
+ metadata.gz: 205222446aa051525b3f1a66c3de03860b2bcda28162666b170e156d6cf2d7da
4
+ data.tar.gz: e4ce08b1eb00b95a08371d710debab240efd7251f27859fc5dadf6abb2ac2e8a
5
5
  SHA512:
6
- metadata.gz: 6700179c827068d2810787d028bdc0621f918e86588d7c666547e7ea00be5425e141b15740cab0b0afe359021f13e28e1300c4a03edd87e7e2b86cd0b6adb1b8
7
- data.tar.gz: 36b73d54c2167cf49063882d9521e6954562331a3edc4464ec77b3f951302ad8ebc20ded1b9a7d996acc369e2000364ee916b0d2e6a5b1a2038d43ae6a7b1800
6
+ metadata.gz: 327c889c0dc25383b6b7db55cd1b70bcfb9bd20131ec54560235c03c65af8394096ba62b75c4c06f4b46b7bed3e1397d201bb9d939d12984847ff5f4835c098e
7
+ data.tar.gz: eb430dfd5ad4428e95a6d5babae0068d0813c3323fe8ce59d3cdfe162d2c745116688c8ef68928a89a2bb6ce3b61886f03dc3c2c2b6b44ecbf0c8756c3e187a7
data/CHANGELOG.md CHANGED
@@ -1,62 +1,64 @@
1
- ## Dradis Framework 3.20 (December, 2020) ##
1
+ v4.1.1 (November 2021)
2
+ - Loosen dradis-plugins version requirement
2
3
 
3
- * Add an option in the exporter to pass a controller for rendering.
4
- * Use NamingService to build export filename.
4
+ v4.1.0 (November 2021)
5
+ - No changes
5
6
 
6
- ## Dradis Framework 3.19 (September, 2020) ##
7
+ v4.0.0 (July 2021)
8
+ - No changes
7
9
 
8
- * No changes.
10
+ v3.22.0 (April 2021)
11
+ - No changes
9
12
 
10
- ## Dradis Framework 3.18 (July, 2020) ##
13
+ v3.21.0 (February 2021)
14
+ - Add a fix for Rails 6 not allowing HTML rendering outside the view directory
11
15
 
12
- * No changes.
16
+ v3.20.0 (December 2020)
17
+ - Add an option in the exporter to pass a controller for rendering
18
+ - Add views for the export view
19
+ - Use NamingService to build export filename
13
20
 
14
- ## Dradis Framework 3.17 (May, 2020) ##
21
+ v3.19.0 (September 2020)
22
+ - No changes
15
23
 
16
- * Render report using main app's ApplicationController#render.
24
+ v3.18.0 (July 2020)
25
+ - No changes
17
26
 
18
- ## Dradis Framework 3.16 (February, 2020) ##
27
+ v3.17.0 (May 2020)
28
+ - Render report using main app's ApplicationController#render
19
29
 
20
- * No changes.
30
+ v3.16.0 (February 2020)
31
+ - No changes
21
32
 
22
- ## Dradis Framework 3.15 (November, 2019) ##
33
+ v3.15.0 (November 2019)
34
+ - No changes
23
35
 
24
- * No changes.
36
+ v3.14.0 (August 2019)
37
+ - No changes
25
38
 
39
+ v3.13.0 (June 2019)
40
+ - No changes
26
41
 
27
- ## Dradis Framework 3.14 (August, 2019) ##
42
+ v3.12.0 (March 2019)
43
+ - No changes
28
44
 
29
- * No changes.
45
+ v3.11.0 (November 2018)
46
+ - No changes
30
47
 
31
- ## Dradis Framework 3.13 (June, 2019) ##
48
+ v3.10.0 (August 2018)
49
+ - Upgraded gems:
50
+ - RedCloth
51
+ - Bugs fixes:
52
+ - issue sorting
32
53
 
33
- * No changes.
54
+ v3.9.0 (January 2018)
55
+ - Updated rendering html as in Rails 5.1 (`render html:`)
34
56
 
35
- ## Dradis Framework 3.12 (March, 2019) ##
57
+ v3.8.0 (September 2017)
58
+ - No changes
36
59
 
37
- * No changes.
60
+ v3.7.0 (July 2017)
61
+ - No changes
38
62
 
39
- ## Dradis Framework 3.11 (November, 2018) ##
40
-
41
- * No changes.
42
-
43
- ## Dradis Framework 3.10 (August, 2018) ##
44
-
45
- * Security fix: update RedCloth to 4.3.2
46
- * Fix issue sorting
47
-
48
- ## Dradis Framework 3.9 (January, 2018) ##
49
-
50
- * Updated rendering html as in Rails 5.1 (`render html:`)
51
-
52
- ## Dradis Framework 3.8 (September, 2017) ##
53
-
54
- * No changes.
55
-
56
- ## Dradis Framework 3.7 (July, 2017) ##
57
-
58
- * No changes.
59
-
60
- ## Dradis Framework 3.6 (March, 2017) ##
61
-
62
- * No changes.
63
+ v3.6.0 (March 2017)
64
+ - No changes
@@ -0,0 +1,12 @@
1
+ [v#.#.#] ([month] [YYYY])
2
+ - [future tense verb] [feature]
3
+ - Upgraded gems:
4
+ - [gem]
5
+ - Bugs fixes:
6
+ - [future tense verb] [bug fix]
7
+ - Bug tracker items:
8
+ - [item]
9
+ - Security Fixes:
10
+ - High: (Authenticated|Unauthenticated) (admin|author|contributor) [vulnerability description]
11
+ - Medium: (Authenticated|Unauthenticated) (admin|author|contributor) [vulnerability description]
12
+ - Low: (Authenticated|Unauthenticated) (admin|author|contributor) [vulnerability description]
@@ -0,0 +1,23 @@
1
+ <%
2
+ templates_dir = File.join(::Configuration::paths_templates_reports, 'html_export')
3
+ templates = Dir["%s/*" % templates_dir].map { |t| File.basename(t) }.sort
4
+ %>
5
+
6
+ <%= content_tag :div, id: 'plugin-html_export', class: 'tab-pane fade' do %>
7
+ <%= form_tag project_export_manager_path(current_project), target: '_blank' do %>
8
+ <%= hidden_field_tag :plugin, :html_export %>
9
+ <%= hidden_field_tag :route, :root %>
10
+
11
+ <h4 class="header-underline">Choose a template</h4>
12
+ <p>Please choose one of the templates available for this plugin (find them in <code>.<%= templates_dir[Rails.root.to_s.length..-1] %></code>)</p>
13
+
14
+ <% templates.each do |template| %>
15
+ <div class="custom-control custom-radio">
16
+ <%= radio_button_tag :template, template, template == templates.first, :class => 'custom-control-input' %>
17
+ <label class="custom-control-label" for="template_<%= template %>"><%= template %></label>
18
+ </div>
19
+ <% end %>
20
+
21
+ <button id="export-button" class="btn btn-lg btn-primary mt-4">Export</button>
22
+ <% end %>
23
+ <% end%>
@@ -0,0 +1,3 @@
1
+ <li class='nav-item'>
2
+ <a href='#html_export' class='nav-link' data-toggle='tab' data-target='#plugin-html_export'>Generate advanced HTML reports</a>
3
+ </li>
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.require_paths = ["lib"]
22
22
 
23
23
  # gem.add_dependency 'dradis_core', version
24
- spec.add_dependency 'dradis-plugins', '~> 3.6'
24
+ spec.add_dependency 'dradis-plugins', '~> 4.0'
25
25
 
26
26
  # Note markup
27
27
  spec.add_dependency 'rails_autolink', '~> 1.1'
@@ -3,29 +3,30 @@ module Dradis
3
3
  module HtmlExport
4
4
 
5
5
  class Exporter < Dradis::Plugins::Export::Base
6
-
7
6
  def export(args = {})
8
7
  log_report
9
8
 
10
9
  controller = args[:controller] || ApplicationController
11
10
 
12
- # Render template
13
- controller.render(
14
- file: options.fetch(:template),
15
- layout: false,
16
- locals: {
17
- categorized_issues: categorized_issues,
18
- content_service: content_service,
19
- issues: issues,
20
- nodes: nodes,
21
- notes: notes,
22
- project: project,
23
- reporting_cat: content_service.report_category,
24
- tags: tags,
25
- title: title,
26
- user: options[:user]
27
- }
28
- )
11
+ with_temporary_template(options[:template]) do |temporary_template|
12
+ # Render template
13
+ controller.render(
14
+ template: temporary_template,
15
+ layout: false,
16
+ locals: {
17
+ categorized_issues: categorized_issues,
18
+ content_service: content_service,
19
+ issues: issues,
20
+ nodes: nodes,
21
+ notes: notes,
22
+ project: project,
23
+ reporting_cat: content_service.report_category,
24
+ tags: tags,
25
+ title: title,
26
+ user: options[:user]
27
+ }
28
+ )
29
+ end
29
30
  end
30
31
 
31
32
  private
@@ -94,6 +95,19 @@ module Dradis
94
95
  "Dradis Community Edition v#{Dradis::CE.version}"
95
96
  end
96
97
  end
98
+
99
+ def with_temporary_template(original, &block)
100
+ filename = File.basename(Dir::Tmpname.create(['', '.html.erb']) {})
101
+ destination_path = Rails.root.join('app', 'views', 'tmp', filename)
102
+
103
+ FileUtils.mkdir_p(File.dirname(destination_path))
104
+ FileUtils.cp(original, destination_path)
105
+
106
+ yield("tmp/#{filename}")
107
+ ensure
108
+ file_path = Rails.root.join("app/views/tmp/#{filename}")
109
+ File.delete(file_path) if File.exists?(file_path)
110
+ end
97
111
  end
98
112
  end
99
113
  end
@@ -7,9 +7,9 @@ module Dradis
7
7
  end
8
8
 
9
9
  module VERSION
10
- MAJOR = 3
11
- MINOR = 20
12
- TINY = 0
10
+ MAJOR = 4
11
+ MINOR = 1
12
+ TINY = 1
13
13
  PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>My Title</title>
5
+ </head>
6
+ <body>
7
+ <h2>Issues</h2>
8
+ <% issues.each do |issue| %>
9
+ <p><%= markup(issue.text) %></p>
10
+ <% end %>
11
+ </body>
12
+ </html>
@@ -0,0 +1,25 @@
1
+ require 'rails_helper'
2
+
3
+ describe Dradis::Plugins::HtmlExport::Exporter do
4
+ let!(:project) { create(:project) }
5
+ let!(:issues) { create_list(:issue, 3, node: project.issue_library) }
6
+
7
+ let(:export_options) do
8
+ {
9
+ project_id: project.id,
10
+ template: Dradis::Plugins::HtmlExport::Engine.root.join(
11
+ 'spec/fixtures/files/template.html.erb'
12
+ )
13
+ }
14
+ end
15
+
16
+ let(:exporter) { described_class.new(export_options) }
17
+
18
+ it 'exports html' do
19
+ html = exporter.export
20
+
21
+ issues.each do |issue|
22
+ expect(html.include?(issue.title))
23
+ end
24
+ end
25
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dradis-html_export
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.20.0
4
+ version: 4.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Martin
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-07 00:00:00.000000000 Z
11
+ date: 2021-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dradis-plugins
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '3.6'
19
+ version: '4.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '3.6'
26
+ version: '4.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rails_autolink
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -63,13 +63,15 @@ files:
63
63
  - ".github/pull_request_template.md"
64
64
  - ".gitignore"
65
65
  - ".rspec"
66
- - ".travis.yml"
67
66
  - CHANGELOG.md
67
+ - CHANGELOG.template
68
68
  - CONTRIBUTING.md
69
69
  - Gemfile
70
70
  - README.md
71
71
  - Rakefile
72
72
  - app/controllers/dradis/plugins/html_export/base_controller.rb
73
+ - app/views/dradis/plugins/html_export/export/_index-content.html.erb
74
+ - app/views/dradis/plugins/html_export/export/_index-tabs.html.erb
73
75
  - config/routes.rb
74
76
  - dradis-html_export.gemspec
75
77
  - lib/dradis-html_export.rb
@@ -79,6 +81,8 @@ files:
79
81
  - lib/dradis/plugins/html_export/gem_version.rb
80
82
  - lib/dradis/plugins/html_export/version.rb
81
83
  - lib/tasks/thorfile.rb
84
+ - spec/fixtures/files/template.html.erb
85
+ - spec/lib/dradis/plugins/html_export/exporter_spec.rb
82
86
  - spec/requests/html_export_spec.rb
83
87
  - spec/spec_helper.rb
84
88
  - templates/basic.html.erb
@@ -87,7 +91,7 @@ homepage: http://dradisframework.org
87
91
  licenses:
88
92
  - GPL-2
89
93
  metadata: {}
90
- post_install_message:
94
+ post_install_message:
91
95
  rdoc_options: []
92
96
  require_paths:
93
97
  - lib
@@ -102,10 +106,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
106
  - !ruby/object:Gem::Version
103
107
  version: '0'
104
108
  requirements: []
105
- rubygems_version: 3.2.4
106
- signing_key:
109
+ rubygems_version: 3.1.6
110
+ signing_key:
107
111
  specification_version: 4
108
112
  summary: Dradis HTML export plugin
109
113
  test_files:
114
+ - spec/fixtures/files/template.html.erb
115
+ - spec/lib/dradis/plugins/html_export/exporter_spec.rb
110
116
  - spec/requests/html_export_spec.rb
111
117
  - spec/spec_helper.rb
data/.travis.yml DELETED
@@ -1,11 +0,0 @@
1
- rvm:
2
- - 1.9.3
3
- notifications:
4
- irc:
5
- on_success: change
6
- on_failure: always
7
- channels:
8
- - "irc.freenode.org#dradis"
9
-
10
- bundler_args: --path vendor/bundle
11
- script: "bundle exec rake spec"