inspec-pdf 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: fa039019bddf5d5b1bbfe7d9b0f8d6ddc939f6fb42d0eb873dd7a95bf8848b4f
4
+ data.tar.gz: 7a99b4686251c9b00a9d16ba1f93384e84b2552f78e4316e479d858a9bda10d1
5
+ SHA512:
6
+ metadata.gz: 605b6a60d5faf75cf8af5d67d84b463253b6081ae893647a6317f5ed0be8aa47575bf47b8c41a8e28ad12e3406e9fb8c1a8a0e1aef8436edaa3de453d3bda2a2
7
+ data.tar.gz: a5485fdd4179f7e3ffee80417137ada4693d8273384f6f3a4dabaaeb0d59a883bebac558459e5a2850134bde83ab6e50fa0e1fb3fbb8671e41ecd4f1ba780bfe
@@ -0,0 +1,19 @@
1
+ Gem::Specification.new do |spec|
2
+ spec.name = "inspec-pdf"
3
+ spec.version = "0.1.0"
4
+ spec.authors = ["Nick Schwaderer"]
5
+ spec.email = ["nicholas.schwaderer@gmail.com"]
6
+ spec.summary = "Inspec plugin for PDF generation"
7
+ spec.description = "InSpec plugin for PDF generation."
8
+ spec.homepage = "https://github.com/schwad/inspec-pdf"
9
+ spec.license = "MIT"
10
+ spec.require_paths = ["lib"]
11
+
12
+ spec.required_ruby_version = "~> 2.4"
13
+
14
+ spec.files =
15
+ Dir.glob("{{lib}/**/*,inspec-pdf.gemspec}").reject { |f| File.directory?(f) }
16
+
17
+
18
+ spec.add_dependency "prawn", "~> 0.2"
19
+ end
@@ -0,0 +1,13 @@
1
+ module InspecPlugins
2
+ module Pdf
3
+ class Plugin < Inspec.plugin(2)
4
+
5
+ plugin_name :'inspec-pdf'
6
+
7
+ reporter :pdf do
8
+ require_relative 'reporter.rb'
9
+ InspecPlugins::Pdf::Reporter
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,32 @@
1
+ module InspecPlugins::Pdf
2
+ class Reporter < Inspec.plugin(2, :reporter)
3
+ def render
4
+ require 'prawn'
5
+ data = run_data # `run_data` does not pass into the Prawn block on its own
6
+
7
+ Prawn::Document.generate("inspec-report-#{Time.now.strftime("%H%M%S%L")}.pdf") do
8
+ text "<b>Version:</b> #{data[:version]}", inline_format: true
9
+ text "<b>Platform:</b> #{data[:platform][:name]} | #{data[:platform][:release]}", inline_format: true
10
+ text "<b>Duration:</b> #{data[:statistics][:duration]}", inline_format: true
11
+ move_down 20
12
+ text "<u><b>Profiles</b></u>", inline_format: true, size: 18
13
+ move_down 10
14
+ data[:profiles].each do |p|
15
+ text "Name: #{p[:name]}", inline_format: true, size: 14
16
+ move_down 10
17
+ text "Controls:", inline_format: true
18
+ move_down 5
19
+ p[:controls].each do |c|
20
+ text "<b>Name:</b> #{c[:title]}", inline_format: true
21
+ text "<b>Desc:</b> #{c[:desc]}", inline_format: true
22
+ text "Results:", inline_format: true
23
+ c[:results].each do |r|
24
+ text "<b>*</b> #{r[:code_desc]} | <u>#{r[:status]}</u>", inline_format: true
25
+ end
26
+ move_down 5
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
data/lib/inspec-pdf.rb ADDED
@@ -0,0 +1 @@
1
+ require_relative 'inspec-pdf/plugin'
metadata ADDED
@@ -0,0 +1,61 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: inspec-pdf
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Nick Schwaderer
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-05-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: prawn
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.2'
27
+ description: InSpec plugin for PDF generation.
28
+ email:
29
+ - nicholas.schwaderer@gmail.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - inspec-pdf.gemspec
35
+ - lib/inspec-pdf.rb
36
+ - lib/inspec-pdf/plugin.rb
37
+ - lib/inspec-pdf/reporter.rb
38
+ homepage: https://github.com/schwad/inspec-pdf
39
+ licenses:
40
+ - MIT
41
+ metadata: {}
42
+ post_install_message:
43
+ rdoc_options: []
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - "~>"
49
+ - !ruby/object:Gem::Version
50
+ version: '2.4'
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ requirements: []
57
+ rubygems_version: 3.0.3
58
+ signing_key:
59
+ specification_version: 4
60
+ summary: Inspec plugin for PDF generation
61
+ test_files: []