octool 0.0.2 → 0.0.3

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: f7ba13a2d5661f8cb124c8f76390bd475535b816d33a613ed5d3b77b807b1c30
4
- data.tar.gz: fd7758b697928e0807727360f669e6bef91fa85935a1c040b8bbf63e35a111fc
3
+ metadata.gz: 2b4309625dcbe93d28161179e763a38c4d4c25bd46f75b8a717e314167984356
4
+ data.tar.gz: eb021712e5165c88df02c1ecb40b6017c4c1abbe9c05c7ef77e074255b04298a
5
5
  SHA512:
6
- metadata.gz: f18379a0d61d2326066d788279f2f2466112441b84f2c120bc7e062bc98991913afcc84273b0cc868fa302eba5a43518a8a9889f1a424df4710975b3e33727f0
7
- data.tar.gz: dcf36feada04da9dd6368dca3c5a80f5bd9a77c750afbef93bc7d70d55049333636fec95f552bbeb1fca5303b158933507a464eaabadc3c14307d415d6d29fc9
6
+ metadata.gz: 4534786fd6fbb5a0e1be118872e9a0fba4cb50b87d05b59ba4262b6cf6fc884d3f81b9dd48690cb382c5f5cc347228e37497dc2a4c02ecc9bdb2c1290b4268b1
7
+ data.tar.gz: a715d521b431f1f20770bba0df3ac1eb2091f837a1902c017bc15d881f09a9301c3eef794f54c18d7eccc9b8836b8d347a0d71819a1a7b688590f5fb14f4a9be
data/bin/octool CHANGED
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  require 'gli'
3
5
  require 'octool'
4
6
 
@@ -37,14 +39,13 @@ class App
37
39
  arg_name 'path/to/system/config.yaml'
38
40
  command :ssp do |s|
39
41
  s.desc 'where to store outputs'
40
- s.default_value Dir.tmpdir
42
+ s.default_value OCTool::DEFAULT_OUTPUT_DIR
41
43
  s.long_desc 'Default output directory respects env vars TMPDIR, TMP, TEMP'
42
44
  s.arg_name 'path/to/output/dir'
43
45
  s.flag [:d, :dir]
44
46
 
45
47
  s.action do |global_options, options, args|
46
48
  export_dir = options[:dir]
47
- FileUtils.mkdir_p export_dir unless File.directory?(export_dir)
48
49
  config_file = find_config(args)
49
50
  system = OCTool::Parser.new(config_file).load_system
50
51
  Dir.chdir File.dirname(config_file) do
@@ -75,12 +76,13 @@ class App
75
76
  # Error logic here
76
77
  # Return false to skip default error handling.
77
78
  if ENV['DEBUG']
78
- puts exception.backtrace
79
+ STDERR.puts exception.message
80
+ STDERR.puts exception.backtrace
79
81
  pp exception
80
82
  false
81
- else
82
- true
83
83
  end
84
+ STDERR.puts '[FAIL]'
85
+ true
84
86
  end
85
87
  end
86
88
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'octool/version.rb'
2
4
 
3
5
  # Built-ins.
@@ -1,6 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OCTool
2
- LATEST_SCHEMA_VERSION = 'v1.0.0'.freeze
4
+ LATEST_SCHEMA_VERSION = 'v1.0.0'
3
5
  BASE_SCHEMA_DIR = File.join(File.dirname(__FILE__), '..', '..', 'schemas').freeze
4
6
  ERB_DIR = File.join(File.dirname(__FILE__), '..', '..', 'templates').freeze
5
- DEFAULT_CONFIG_FILENAME = 'config.yaml'.freeze
7
+ DEFAULT_CONFIG_FILENAME = 'config.yaml'
8
+ DEFAULT_OUTPUT_DIR = '/data'
6
9
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OCTool
2
4
  # Custom error to show validation errors.
3
5
  class ValidationError < StandardError
@@ -56,9 +58,7 @@ module OCTool
56
58
  end
57
59
 
58
60
  def schema_dir
59
- @schema_dir ||= begin
60
- File.join(BASE_SCHEMA_DIR, schema_version).freeze
61
- end
61
+ @schema_dir ||= File.join(BASE_SCHEMA_DIR, schema_version)
62
62
  end
63
63
 
64
64
  def schema_version
@@ -15,6 +15,10 @@ module OCTool
15
15
  end
16
16
 
17
17
  def generate
18
+ if not File.writable?(@output_dir)
19
+ STDERR.puts "[FAIL] #{@output_dir} is not writable"
20
+ exit(1)
21
+ end
18
22
  render_template
19
23
  write
20
24
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OCTool
2
4
  # Representation of a system
3
5
  class System
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OCTool
2
- VERSION = '0.0.2'.freeze
4
+ VERSION = '0.0.3'
3
5
  end
@@ -1,6 +1,6 @@
1
1
  == octool - Open Compliance Tool
2
2
 
3
- v0.0.2
3
+ v0.0.3
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] /tmp
36
+ [Default Value] /data
37
37
  Default output directory respects env vars TMPDIR, TMP, TEMP
38
38
 
39
39
  ==== Command: <tt>validate </tt>
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.2
4
+ version: 0.0.3
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-14 00:00:00.000000000 Z
11
+ date: 2020-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -64,6 +64,20 @@ dependencies:
64
64
  - - '='
65
65
  - !ruby/object:Gem::Version
66
66
  version: 0.2.2
67
+ - !ruby/object:Gem::Dependency
68
+ name: etc
69
+ requirement: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - '='
72
+ - !ruby/object:Gem::Version
73
+ version: 1.1.0
74
+ type: :runtime
75
+ prerelease: false
76
+ version_requirements: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - '='
79
+ - !ruby/object:Gem::Version
80
+ version: 1.1.0
67
81
  - !ruby/object:Gem::Dependency
68
82
  name: gli
69
83
  requirement: !ruby/object:Gem::Requirement
@@ -165,7 +179,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
165
179
  requirements:
166
180
  - - ">="
167
181
  - !ruby/object:Gem::Version
168
- version: '0'
182
+ version: '2.4'
169
183
  required_rubygems_version: !ruby/object:Gem::Requirement
170
184
  requirements:
171
185
  - - ">="