inspec-reporter-flex 0.1.1 → 0.1.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a70f1ad5110657323aa557b7876f254052aa80e5e82d0dc2d1bd1fa62e5ee097
|
4
|
+
data.tar.gz: af696adb163985a265cc85fb0d6da9213f316ad33cc377d3211814abf7d62f25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 309b3ee73a2884b4155de09cf5708f62d1fe98241d3a34c41ab051394a42391385af2dbf0acbd899707a3c6cf165967409bd8462d92dba4261de3f0c4503876c
|
7
|
+
data.tar.gz: 056d903d087b8ca2ac21204d766a0c72547b563dac3d9908ae515ed8b369c7fdadcbd1467cc177e723d112ca09c85d5f54278f1c39c4019f67829492e5d0e3c8
|
data/CHANGELOG.md
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
module InspecPlugins::FlexReporter
|
2
2
|
module ErbHelpers
|
3
|
-
# Return
|
3
|
+
# Return approximate time of the scan
|
4
4
|
#
|
5
|
-
# @return [DateTime] Timestamp of the
|
5
|
+
# @return [DateTime] Timestamp of the first scan in the profile
|
6
6
|
def scan_time
|
7
|
-
|
7
|
+
scan_time = report[:profiles].detect { |p| p[:controls].detect { |c| c[:results].detect { |r| !r.empty? } } }.dig(:controls, 0, :results, 0, :start_time)
|
8
|
+
|
9
|
+
DateTime.strptime(scan_time)
|
8
10
|
end
|
9
11
|
|
10
12
|
# Execute a remote command.
|
@@ -1,11 +1,11 @@
|
|
1
1
|
module InspecPlugins::FlexReporter
|
2
2
|
module FileResolver
|
3
|
-
# Resolve the
|
3
|
+
# Resolve the full path for a file in order absolute path/gem bundled file/relative.
|
4
4
|
#
|
5
5
|
# @param [String] name Name or path of a file to resolve
|
6
6
|
# @return [String] Absolute path to the file, if any
|
7
7
|
# @raise [IOError] if file not found
|
8
|
-
def
|
8
|
+
def full_path(name)
|
9
9
|
if absolute_path?(name)
|
10
10
|
name
|
11
11
|
elsif relative_path?(name)
|
@@ -10,12 +10,11 @@ module InspecPlugins::FlexReporter
|
|
10
10
|
|
11
11
|
ENV_PREFIX = "INSPEC_REPORTER_FLEX_".freeze
|
12
12
|
|
13
|
-
attr_writer :config, :env, :inspec_config, :logger
|
13
|
+
attr_writer :config, :env, :inspec_config, :logger, :template_contents
|
14
14
|
|
15
15
|
# Render report
|
16
16
|
def render
|
17
|
-
|
18
|
-
template = ERB.new(File.read(template_file))
|
17
|
+
template = ERB.new(template_contents)
|
19
18
|
|
20
19
|
# Use JSON Reporter base's `report` to have pre-processed data
|
21
20
|
mushy_report = Hashie::Mash.new(report)
|
@@ -54,6 +53,14 @@ module InspecPlugins::FlexReporter
|
|
54
53
|
|
55
54
|
private
|
56
55
|
|
56
|
+
# Read contents of requested template.
|
57
|
+
#
|
58
|
+
# @return [String] ERB Template
|
59
|
+
# @raise [IOError]
|
60
|
+
def template_contents
|
61
|
+
@template_contents ||= File.read full_path(config["template_file"])
|
62
|
+
end
|
63
|
+
|
57
64
|
# Initialize configuration with defaults and Plugin config.
|
58
65
|
#
|
59
66
|
# @return [Hash] Configuration data after merge
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inspec-reporter-flex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Heinen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-11-
|
11
|
+
date: 2020-11-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bump
|