octool 0.0.3 → 0.0.4
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/bin/octool +17 -7
- data/lib/octool.rb +0 -1
- data/lib/octool/ssp.rb +16 -13
- data/lib/octool/version.rb +1 -1
- data/octool.rdoc +2 -2
- data/templates/ssp.erb +6 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a99d4ae79b106f19c3a49be0fd5fa84de52aaf790494a0f78e55c16fd00bbc5
|
4
|
+
data.tar.gz: d50899b6e334df9a7f40071f053824af296c842e7d11c8add1ae8e0b17c8313b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d447539ed45f3c6d55eaabdc04763b21a15bcfb1c9a25bcc8db050c885dba0d030634693353614243e59cec9c9622f09289c35d71aec52fdc56a1fc2922e896e
|
7
|
+
data.tar.gz: 728c1d363e0f30c4c3f52149088d867cefdb0b63e3b3594fbe5aa1e70b04e66749fe2466ed90643fd84e94b416367f59f26e9d4f049741f8b0bb2d61b15f6306
|
data/bin/octool
CHANGED
@@ -8,6 +8,22 @@ require 'octool'
|
|
8
8
|
class App
|
9
9
|
extend GLI::App
|
10
10
|
|
11
|
+
def self.data_dir
|
12
|
+
[ENV['TMPDIR'], ENV['TMP'], ENV['TEMP'], '/tmp'].each do |dir|
|
13
|
+
next if dir.nil?
|
14
|
+
|
15
|
+
stat = File.stat(dir)
|
16
|
+
return dir if stat.directory? && stat.writable?
|
17
|
+
end
|
18
|
+
OCTool::DEFAULT_OUTPUT_DIR
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.find_config(args)
|
22
|
+
path = args.first || OCTool::DEFAULT_CONFIG_FILENAME
|
23
|
+
path = File.join(path, OCTool::DEFAULT_CONFIG_FILENAME) if File.directory?(path)
|
24
|
+
path
|
25
|
+
end
|
26
|
+
|
11
27
|
program_desc 'Open Compliance Tool'
|
12
28
|
version OCTool::VERSION
|
13
29
|
|
@@ -39,7 +55,7 @@ class App
|
|
39
55
|
arg_name 'path/to/system/config.yaml'
|
40
56
|
command :ssp do |s|
|
41
57
|
s.desc 'where to store outputs'
|
42
|
-
s.default_value
|
58
|
+
s.default_value data_dir
|
43
59
|
s.long_desc 'Default output directory respects env vars TMPDIR, TMP, TEMP'
|
44
60
|
s.arg_name 'path/to/output/dir'
|
45
61
|
s.flag [:d, :dir]
|
@@ -86,10 +102,4 @@ class App
|
|
86
102
|
end
|
87
103
|
end
|
88
104
|
|
89
|
-
def find_config(args)
|
90
|
-
path = args.first || OCTool::DEFAULT_CONFIG_FILENAME
|
91
|
-
path = File.join(path, OCTool::DEFAULT_CONFIG_FILENAME) if File.directory?(path)
|
92
|
-
path
|
93
|
-
end
|
94
|
-
|
95
105
|
exit App.run(ARGV)
|
data/lib/octool.rb
CHANGED
data/lib/octool/ssp.rb
CHANGED
@@ -6,9 +6,15 @@ module OCTool
|
|
6
6
|
def initialize(system, output_dir)
|
7
7
|
@system = system
|
8
8
|
@output_dir = output_dir
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
end
|
10
|
+
|
11
|
+
def pandoc
|
12
|
+
@pandoc ||= begin
|
13
|
+
# Load paru/pandoc late enough that help functions work
|
14
|
+
# and early enough to be confident that we catch the correct error.
|
15
|
+
require 'paru/pandoc'
|
16
|
+
Paru::Pandoc.new
|
17
|
+
end
|
12
18
|
rescue UncaughtThrowError => e
|
13
19
|
STDERR.puts '[FAIL] octool requires pandoc to generate the SSP. Is pandoc installed?'
|
14
20
|
exit(1)
|
@@ -20,7 +26,8 @@ module OCTool
|
|
20
26
|
exit(1)
|
21
27
|
end
|
22
28
|
render_template
|
23
|
-
write
|
29
|
+
write 'pdf'
|
30
|
+
write 'docx'
|
24
31
|
end
|
25
32
|
|
26
33
|
def render_template
|
@@ -32,12 +39,12 @@ module OCTool
|
|
32
39
|
puts 'done'
|
33
40
|
end
|
34
41
|
|
35
|
-
def write
|
36
|
-
|
37
|
-
|
42
|
+
def write(type = 'pdf')
|
43
|
+
out_path = File.join(@output_dir, "ssp.#{type}")
|
44
|
+
print "Building #{out_path} ... "
|
38
45
|
converter = pandoc.configure do
|
39
46
|
from 'markdown'
|
40
|
-
to
|
47
|
+
to type
|
41
48
|
pdf_engine 'lualatex'
|
42
49
|
toc
|
43
50
|
toc_depth 3
|
@@ -45,16 +52,12 @@ module OCTool
|
|
45
52
|
highlight_style 'pygments'
|
46
53
|
end
|
47
54
|
output = converter << File.read(md_path)
|
48
|
-
File.new(
|
55
|
+
File.new(out_path, 'wb').write(output)
|
49
56
|
puts 'done'
|
50
57
|
end
|
51
58
|
|
52
59
|
def md_path
|
53
60
|
@md_path ||= File.join(@output_dir, 'ssp.md')
|
54
61
|
end
|
55
|
-
|
56
|
-
def pdf_path
|
57
|
-
@pdf_path ||= File.join(@output_dir, 'ssp.pdf')
|
58
|
-
end
|
59
62
|
end
|
60
63
|
end
|
data/lib/octool/version.rb
CHANGED
data/octool.rdoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
== octool - Open Compliance Tool
|
2
2
|
|
3
|
-
v0.0.
|
3
|
+
v0.0.4
|
4
4
|
|
5
5
|
=== Global Options
|
6
6
|
=== --help
|
@@ -33,7 +33,7 @@ generate System Security Plan
|
|
33
33
|
|
34
34
|
where to store outputs
|
35
35
|
|
36
|
-
[Default Value] /
|
36
|
+
[Default Value] /tmp
|
37
37
|
Default output directory respects env vars TMPDIR, TMP, TEMP
|
38
38
|
|
39
39
|
==== Command: <tt>validate </tt>
|
data/templates/ssp.erb
CHANGED
@@ -25,10 +25,10 @@ mainfontoptions:
|
|
25
25
|
- BoldFont=*-Bold
|
26
26
|
- BoldItalicFont=*-BoldItalic
|
27
27
|
|
28
|
-
lof:
|
29
|
-
lot:
|
28
|
+
lof: true
|
29
|
+
lot: true
|
30
30
|
colorlinks: true
|
31
|
-
linkcolor:
|
31
|
+
linkcolor: black # internal links (e.g., lof and lot)
|
32
32
|
urlcolor: blue
|
33
33
|
|
34
34
|
documentclass: report
|
@@ -104,7 +104,9 @@ Satisfies:
|
|
104
104
|
### Families
|
105
105
|
|
106
106
|
<% s.families.each do |family| %>
|
107
|
-
|
107
|
+
<%= family.family_key %>
|
108
|
+
~ <%= family.name %>
|
109
|
+
|
108
110
|
<% end %>
|
109
111
|
|
110
112
|
<% end %>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Morgan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
11
|
+
date: 2020-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|