octool 0.0.3 → 0.0.4

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: 2b4309625dcbe93d28161179e763a38c4d4c25bd46f75b8a717e314167984356
4
- data.tar.gz: eb021712e5165c88df02c1ecb40b6017c4c1abbe9c05c7ef77e074255b04298a
3
+ metadata.gz: 6a99d4ae79b106f19c3a49be0fd5fa84de52aaf790494a0f78e55c16fd00bbc5
4
+ data.tar.gz: d50899b6e334df9a7f40071f053824af296c842e7d11c8add1ae8e0b17c8313b
5
5
  SHA512:
6
- metadata.gz: 4534786fd6fbb5a0e1be118872e9a0fba4cb50b87d05b59ba4262b6cf6fc884d3f81b9dd48690cb382c5f5cc347228e37497dc2a4c02ecc9bdb2c1290b4268b1
7
- data.tar.gz: a715d521b431f1f20770bba0df3ac1eb2091f837a1902c017bc15d881f09a9301c3eef794f54c18d7eccc9b8836b8d347a0d71819a1a7b688590f5fb14f4a9be
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 OCTool::DEFAULT_OUTPUT_DIR
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)
@@ -4,7 +4,6 @@ require 'octool/version.rb'
4
4
 
5
5
  # Built-ins.
6
6
  require 'pp'
7
- require 'tmpdir'
8
7
 
9
8
  # 3rd-party libs.
10
9
  require 'kwalify'
@@ -6,9 +6,15 @@ module OCTool
6
6
  def initialize(system, output_dir)
7
7
  @system = system
8
8
  @output_dir = output_dir
9
- # Load paru/pandoc late enough that help functions work
10
- # and early enough to be confident that we catch the correct error.
11
- require 'paru/pandoc'
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
- print "Building #{pdf_path} ... "
37
- pandoc = Paru::Pandoc.new
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 'pdf'
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(pdf_path, 'wb').write(output)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OCTool
4
- VERSION = '0.0.3'
4
+ VERSION = '0.0.4'
5
5
  end
@@ -1,6 +1,6 @@
1
1
  == octool - Open Compliance Tool
2
2
 
3
- v0.0.3
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] /data
36
+ [Default Value] /tmp
37
37
  Default output directory respects env vars TMPDIR, TMP, TEMP
38
38
 
39
39
  ==== Command: <tt>validate </tt>
@@ -25,10 +25,10 @@ mainfontoptions:
25
25
  - BoldFont=*-Bold
26
26
  - BoldItalicFont=*-BoldItalic
27
27
 
28
- lof: false
29
- lot: false
28
+ lof: true
29
+ lot: true
30
30
  colorlinks: true
31
- linkcolor: blue
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
- - <%= family.family_key -%>: <%= family.name %>
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.3
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-15 00:00:00.000000000 Z
11
+ date: 2020-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake