dradis-html_export 4.9.1 → 4.10.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ca36e1c731fed6fecd0df85b0f3e4f8d767b8165c683cab6fa1c9f306d61f741
4
- data.tar.gz: 847247d60414d9ab8c1342318421d15b5e2b1cdf1103f6c061ee03d4b21fba23
3
+ metadata.gz: 27d99c716d170d2268e97a1b0889729ce6e653f4b8e9ab2cfb41c34527b2747a
4
+ data.tar.gz: ec40e7c9bbb6239f3058b2b8cc223b445290952fb1762b4ac74b22029dbc0391
5
5
  SHA512:
6
- metadata.gz: afad897697ffc0473072d1b2bf4b074724c3ec38286a3328eb34c654bff1676543168d3ef5081b1fa51dfaae8c1bd1eb7a754a95e66327399cd284a4c03585dd
7
- data.tar.gz: ed111b118353cc1419f6d141975275a4982ca910aefd139bf6bf286bbd8372902d98c1d889051883c3242102ce627663b23c4d36fd0a9556fd0de627e2f0ced2
6
+ metadata.gz: d7d68a975f8517af01b889567140163cdaa42b4a7ce786a3b68d06cc07f72310e8e8dac35b1cebe151a23e123f9c909065fd4e6db95d9eb9b8c0e2e56d2919aa
7
+ data.tar.gz: a8b48338691dbedcf04abb428fee667389c5a90ac0a015341c1c101581cd25260a09654715f3f757a0fa04ca79c0ba93c29eecde277da1d896d57a094657ee6b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ v4.10.0 (September 2023)
2
+ - Add support for enabling/disabling
3
+ - Prevent exporting reports without any HTML templates
4
+ - Fix the default templates
5
+ - Implement handling of HTML exports directly from Tylium
6
+ - Update views for compatibility with Font Awesome 6
7
+ - Update gemspec links
8
+
1
9
  v4.9.1 (June 2023)
2
10
  - Show HTML export tab by default in CE's export view
3
11
 
@@ -6,7 +14,7 @@ v4.9.0 (June 2023)
6
14
 
7
15
  v4.8.0 (April 2023)
8
16
  - Add feature to select published/all records for export
9
-
17
+
10
18
  v4.7.0 (February 2023)
11
19
  - No changes
12
20
 
@@ -1,13 +1,14 @@
1
1
  module Dradis
2
2
  module Plugins
3
3
  module HtmlExport
4
- class BaseController < Dradis::Plugins::Export::BaseController
4
+ class ReportsController < Dradis::Plugins::Export::BaseController
5
5
  # This method cycles throw the notes in the reporting category and creates
6
6
  # a simple HTML report with them.
7
7
  #
8
8
  # It uses the template at: ./vendor/plugins/html_export/template.html.erb
9
- def index
10
- exporter = Dradis::Plugins::HtmlExport::Exporter.new(export_params)
9
+ def create
10
+ options = export_params.merge(template: @template_file)
11
+ exporter = Dradis::Plugins::HtmlExport::Exporter.new(options)
11
12
  html = exporter.export
12
13
 
13
14
  render html: html.html_safe
@@ -1,24 +1,25 @@
1
1
  <%= content_tag :div, id: 'plugin-html_export', class: class_names('tab-pane', 'fade', 'active show': !defined?(Dradis::Pro)) do %>
2
- <%= form_tag project_export_manager_path(current_project), target: '_blank' do %>
3
- <%= hidden_field_tag :plugin, :html_export %>
4
- <%= hidden_field_tag :route, :root %>
5
-
6
- <h4 class="header-underline">Choose a template</h4>
7
- <p>Please choose one of the templates available for this plugin (find them in <code>.<%= Dradis::Plugins::HtmlExport::TemplatePresenter.templates_dir[Rails.root.to_s.length..-1] %></code>)</p>
8
-
9
- <% Dradis::Plugins::HtmlExport::TemplatePresenter.each_template do |template| %>
10
- <% present(template, Dradis::Plugins::HtmlExport::TemplatePresenter) do |template_presenter| %>
11
- <div class="form-check">
12
- <%= radio_button_tag :template, template_presenter.filename, Dradis::Plugins::HtmlExport::TemplatePresenter.templates.first == template , class: 'form-check-input' %>
13
- <label class="form-check-label" for="template_<%= template_presenter.filename %>">
14
- <%= template_presenter.title %>
15
- </label>
16
- </div>
2
+ <% if Dradis::Plugins::HtmlExport::TemplatePresenter.templates.any? %>
3
+ <%= form_tag html_export.project_report_path(current_project) do %>
4
+ <h4 class="header-underline">Choose a template</h4>
5
+ <p>Please choose one of the templates available for this plugin (find them in <code>.<%= Dradis::Plugins::HtmlExport::TemplatePresenter.templates_dir[Rails.root.to_s.length..-1] %></code>)</p>
6
+
7
+ <% Dradis::Plugins::HtmlExport::TemplatePresenter.each_template do |template| %>
8
+ <% present(template, Dradis::Plugins::HtmlExport::TemplatePresenter) do |template_presenter| %>
9
+ <div class="form-check">
10
+ <%= radio_button_tag :template, template_presenter.filename, Dradis::Plugins::HtmlExport::TemplatePresenter.templates.first == template , class: 'form-check-input' %>
11
+ <label class="form-check-label" for="template_<%= template_presenter.filename %>">
12
+ <%= template_presenter.title %>
13
+ </label>
14
+ </div>
15
+ <% end %>
17
16
  <% end %>
18
- <% end %>
19
17
 
20
- <div class="mt-4">
21
- <%= render partial: 'export/submit_button', locals: { plugin_name: Dradis::Plugins::HtmlExport::Engine.plugin_name } %>
22
- </div>
18
+ <div class="mt-4">
19
+ <%= render partial: 'export/submit_button', locals: { plugin_name: Dradis::Plugins::HtmlExport::Engine.plugin_name } %>
20
+ </div>
21
+ <% end %>
22
+ <% else %>
23
+ <%= render partial: 'export/no_templates', locals: { plugin_name: Dradis::Plugins::HtmlExport::Engine.plugin_name } %>
23
24
  <% end %>
24
- <% end%>
25
+ <% end %>
@@ -1,3 +1,3 @@
1
1
  <li class='nav-item'>
2
- <a href='#plugin-html_export' class="<%= class_names('nav-link', active: !defined?(Dradis::Pro)) %>" data-bs-toggle='tab'>HTML</a>
2
+ <a href='#plugin-html_export' class="<%= class_names('nav-link', active: !defined?(Dradis::Pro)) %>" data-bs-toggle='tab'><i class="fa-solid fa-file-code fa-fw"></i>HTML</a>
3
3
  </li>
data/config/routes.rb CHANGED
@@ -1,3 +1,5 @@
1
1
  Dradis::Plugins::HtmlExport::Engine.routes.draw do
2
- root to: 'base#index'
2
+ resources :projects, only: [] do
3
+ resource :report, only: [:create], path: '/export/html/reports'
4
+ end
3
5
  end
@@ -1,24 +1,24 @@
1
1
  # -*- encoding: utf-8 -*-
2
+
2
3
  require File.expand_path('../lib/dradis/plugins/html_export/version', __FILE__)
3
4
  version = Dradis::Plugins::HtmlExport::version
4
5
 
5
6
  Gem::Specification.new do |spec|
6
7
  spec.platform = Gem::Platform::RUBY
7
- spec.name = "dradis-html_export"
8
+ spec.name = 'dradis-html_export'
8
9
  spec.version = version
9
10
  spec.required_ruby_version = '>= 1.9.3'
10
11
  spec.license = 'GPL-2'
11
12
 
12
13
  spec.authors = ['Daniel Martin']
13
- spec.email = ["<etd@nomejortu.com>"]
14
- spec.description = %q{Export to HTML plugin for the Dradis Framework}
15
- spec.summary = %q{Dradis HTML export plugin}
16
- spec.homepage = 'http://dradisframework.org'
14
+ spec.description = 'Export to HTML plugin for the Dradis Framework'
15
+ spec.summary = 'Dradis HTML export plugin'
16
+ spec.homepage = 'http://dradis.com'
17
17
 
18
18
  spec.files = `git ls-files`.split($\)
19
- spec.executables = spec.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
19
+ spec.executables = spec.files.grep(%r{^bin/}).map { |f| File.basename(f) }
20
20
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
21
- spec.require_paths = ["lib"]
21
+ spec.require_paths = ['lib']
22
22
 
23
23
  # gem.add_dependency 'dradis_core', version
24
24
  spec.add_dependency 'dradis-plugins', '>= 4.8.0'
@@ -18,13 +18,21 @@ module Dradis
18
18
  provides :export, :rtp
19
19
  description 'Generate advanced HTML reports'
20
20
 
21
+ addon_settings :html_export do
22
+ settings.default_enabled = false
23
+ end if defined?(Dradis::Pro)
24
+
21
25
  initializer 'dradis-html_export.mount_engine' do
22
26
  Rails.application.routes.append do
23
- mount Dradis::Plugins::HtmlExport::Engine => '/export/html'
27
+ # Enabling/disabling integrations calls Rails.application.reload_routes! we need the enable
28
+ # check inside the block to ensure the routes can be re-enabled without a server restart
29
+ if Engine.enabled?
30
+ mount Engine => '/', as: :html_export
31
+ end
24
32
  end
25
33
  end
26
34
 
27
- initializer 'draids-html_export.include_helper' do
35
+ initializer 'dradis-html_export.include_helper' do
28
36
  ActiveSupport.on_load(:action_view) do
29
37
  Dradis::Plugins::HtmlExport::Exporter.include(ApplicationHelper)
30
38
  end
@@ -2,6 +2,8 @@ module Dradis
2
2
  module Plugins
3
3
  module HtmlExport
4
4
  class Exporter < Dradis::Plugins::Export::Base
5
+ include ActionView::Helpers::TextHelper
6
+
5
7
  def export(args = {})
6
8
  log_report
7
9
 
@@ -8,11 +8,11 @@ module Dradis
8
8
 
9
9
  module VERSION
10
10
  MAJOR = 4
11
- MINOR = 9
12
- TINY = 1
11
+ MINOR = 10
12
+ TINY = 0
13
13
  PRE = nil
14
14
 
15
- STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
15
+ STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
16
16
  end
17
17
  end
18
18
  end
@@ -1,6 +1,8 @@
1
1
  require 'rails_helper'
2
2
 
3
3
  describe Dradis::Plugins::HtmlExport::Exporter do
4
+ before { Dradis::Plugins::HtmlExport::Exporter.include(ApplicationHelper) }
5
+
4
6
  let!(:project) { create(:project, :with_team) }
5
7
 
6
8
  let!(:content_blocks) { create_list(:content_block, 5, project: project) }
@@ -8,7 +10,7 @@ describe Dradis::Plugins::HtmlExport::Exporter do
8
10
  let!(:nodes) { create_list(:node, 5, project: project) }
9
11
  let!(:tags) { create_list(:tag, 5, project: project) }
10
12
 
11
- let(:controller) { Dradis::Plugins::HtmlExport::BaseController.new }
13
+ let(:controller) { Dradis::Plugins::HtmlExport::ExportController.new }
12
14
 
13
15
  let(:exporter) { described_class.new(export_options) }
14
16
 
@@ -31,6 +33,46 @@ describe Dradis::Plugins::HtmlExport::Exporter do
31
33
  end
32
34
  end
33
35
 
36
+ context 'templates' do
37
+ describe 'basic template' do
38
+ let(:export_options) do
39
+ {
40
+ project_id: project.id,
41
+ template: Dradis::Plugins::HtmlExport::Engine.root.join(
42
+ 'templates/basic.html.erb'
43
+ )
44
+ }
45
+ end
46
+
47
+ it 'exports html' do
48
+ html = exporter.export
49
+
50
+ issues.each do |issue|
51
+ expect(html.include?(issue.title))
52
+ end
53
+ end
54
+ end
55
+
56
+ describe 'default template' do
57
+ let(:export_options) do
58
+ {
59
+ project_id: project.id,
60
+ template: Dradis::Plugins::HtmlExport::Engine.root.join(
61
+ 'templates/default_dradis_template_v3.0.html.erb'
62
+ )
63
+ }
64
+ end
65
+
66
+ it 'exports html' do
67
+ html = exporter.export
68
+
69
+ issues.each do |issue|
70
+ expect(html.include?(issue.title))
71
+ end
72
+ end
73
+ end
74
+ end
75
+
34
76
  context 'liquid' do
35
77
  let(:export_options) do
36
78
  {
@@ -26,14 +26,14 @@
26
26
  <section>
27
27
  <h2>Issues</h2>
28
28
  <% issues.each do |issue| %>
29
- <div class="note"><%= markup(issue.text) %></div>
29
+ <div class="note"><%= markup(issue.text, liquid: true) %></div>
30
30
  <% end %>
31
31
  </section>
32
32
 
33
33
  <section>
34
- <h2>Notes assigned to the <%= reporting_cat.name %> category</h2>
34
+ <h2>Notes</h2>
35
35
  <% notes.each do |note| %>
36
- <div class="note"><%= markup(note.text) %></div>
36
+ <div class="note"><%= markup(note.text, liquid: true) %></div>
37
37
  <% end %>
38
38
  </section>
39
39
 
@@ -70,7 +70,7 @@
70
70
  <% notes.each do |note| %>
71
71
  <div class="panel panel-default">
72
72
  <div class="panel-body">
73
- <%= markup(note.text) %>
73
+ <%= markup(note.text, liquid: true) %>
74
74
  </div>
75
75
  </div>
76
76
  <% end %>
@@ -81,7 +81,7 @@
81
81
  <% issues.each do |issue| %>
82
82
  <div class="panel panel-default">
83
83
  <div class="panel-body">
84
- <%= markup(issue.text) %>
84
+ <%= markup(issue.text, liquid: true) %>
85
85
 
86
86
  <h3>Assets affected by this issue</h3>
87
87
  <% if issue.affected.empty? %>
@@ -101,7 +101,7 @@
101
101
  <section id="evidence_for_#{node.id}">
102
102
  <% if instances.count == 1 %>
103
103
  <div class="content-textile" id="node_<%= node.id %>_instance_0">
104
- <%= markup(instances.first.content) %>
104
+ <%= markup(instances.first.content, liquid: true) %>
105
105
  </div>
106
106
  <% else %>
107
107
  <ul class="nav nav-tabs">
@@ -113,7 +113,7 @@
113
113
  <div class="tab-content">
114
114
  <% instances.each_with_index do |evidence, i| %>
115
115
  <div class="content-textile tab-pane<%= ' active' if i==0 %>" id="node_<%= node.id %>_instance_<%= i %>">
116
- <%= markup(evidence.content) %>
116
+ <%= markup(evidence.content, liquid: true) %>
117
117
  </div>
118
118
  <% end %>
119
119
  </div>
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: 4.9.1
4
+ version: 4.10.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: 2023-06-02 00:00:00.000000000 Z
11
+ date: 2023-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dradis-plugins
@@ -53,8 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: 4.3.2
55
55
  description: Export to HTML plugin for the Dradis Framework
56
- email:
57
- - "<etd@nomejortu.com>"
56
+ email:
58
57
  executables: []
59
58
  extensions: []
60
59
  extra_rdoc_files: []
@@ -69,7 +68,7 @@ files:
69
68
  - Gemfile
70
69
  - README.md
71
70
  - Rakefile
72
- - app/controllers/dradis/plugins/html_export/base_controller.rb
71
+ - app/controllers/dradis/plugins/html_export/reports_controller.rb
73
72
  - app/presenters/dradis/plugins/html_export/template_presenter.rb
74
73
  - app/views/dradis/plugins/html_export/export/_index-content.html.erb
75
74
  - app/views/dradis/plugins/html_export/export/_index-tabs.html.erb
@@ -90,7 +89,7 @@ files:
90
89
  - spec/spec_helper.rb
91
90
  - templates/basic.html.erb
92
91
  - templates/default_dradis_template_v3.0.html.erb
93
- homepage: http://dradisframework.org
92
+ homepage: http://dradis.com
94
93
  licenses:
95
94
  - GPL-2
96
95
  metadata: {}
@@ -109,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
108
  - !ruby/object:Gem::Version
110
109
  version: '0'
111
110
  requirements: []
112
- rubygems_version: 3.0.3.1
111
+ rubygems_version: 3.1.4
113
112
  signing_key:
114
113
  specification_version: 4
115
114
  summary: Dradis HTML export plugin