Class: AbideDevUtils::Sce::Generate::Reference::MarkdownGenerator
- Inherits:
 - 
      Object
      
        
- Object
 - AbideDevUtils::Sce::Generate::Reference::MarkdownGenerator
 
 
- Defined in:
 - lib/abide_dev_utils/sce/generate/reference.rb
 
Overview
Generates a markdown reference doc
Constant Summary collapse
- SPECIAL_CONTROL_IDS =
 %w[dependent sce_options sce_protected].freeze
Instance Method Summary collapse
- #generate(doc_title = 'Reference') ⇒ Object
 - 
  
    
      #initialize(benchmarks, module_name, file: 'REFERENCE.md', opts: {})  ⇒ MarkdownGenerator 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of MarkdownGenerator.
 
Constructor Details
#initialize(benchmarks, module_name, file: 'REFERENCE.md', opts: {}) ⇒ MarkdownGenerator
Returns a new instance of MarkdownGenerator.
      72 73 74 75 76 77 78  | 
    
      # File 'lib/abide_dev_utils/sce/generate/reference.rb', line 72 def initialize(benchmarks, module_name, file: 'REFERENCE.md', opts: {}) @benchmarks = benchmarks @module_name = module_name @file = file @opts = opts @md = AbideDevUtils::Markdown.new(@file) end  | 
  
Instance Method Details
#generate(doc_title = 'Reference') ⇒ Object
      80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102  | 
    
      # File 'lib/abide_dev_utils/sce/generate/reference.rb', line 80 def generate(doc_title = 'Reference') @strings = Strings.new(opts: @opts) md.add_title(doc_title) benchmarks.each do |benchmark| unless @opts[:quiet] = AbideDevUtils::Output.progress(title: "Generating Markdown for #{benchmark.title_key}", total: benchmark.controls.length) end md.add_h1(benchmark.title_key) benchmark.controls.each do |control| next if SPECIAL_CONTROL_IDS.include? control.id next if benchmark.framework == 'stig' && control.id_map_type != 'vulnid' control_md = ControlMarkdown.new(control, @md, @strings, @module_name, benchmark.framework, opts: @opts) control_md.generate! if control_md.verify_profile_and_level_selections .increment unless @opts[:quiet] rescue StandardError => e raise "Failed to generate markdown for control #{control.id}. Original message: #{e.}" end end AbideDevUtils::Output.simple("Saving markdown to #{@file}") unless @opts[:quiet] md.to_file end  |