Module: Inspec::Schema::OutputSchema
- Defined in:
 - lib/inspec/schema/output_schema.rb
 
Constant Summary collapse
- PLATFORMS =
          
using a proc here so we can lazy load it when we need
 lambda do require "train" Train.create("mock").connection Train::Platforms.export end
- LIST =
 { "profile-json" => OutputSchema.finalize(Schema::ProfileJson::PROFILE), "exec-json" => OutputSchema.finalize(Schema::ExecJson::OUTPUT), "exec-jsonmin" => OutputSchema.finalize(Schema::ExecJsonMin::OUTPUT), "platforms" => PLATFORMS, }.freeze
Class Method Summary collapse
- 
  
    
      .build_definitions(schema_type)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Build our definitions.
 - 
  
    
      .finalize(schema_type)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Helper function to automatically bundle a type with its dependencies.
 - .json(name) ⇒ Object
 - .names ⇒ Object
 
Class Method Details
.build_definitions(schema_type) ⇒ Object
Build our definitions
      11 12 13 14 15  | 
    
      # File 'lib/inspec/schema/output_schema.rb', line 11 def self.build_definitions(schema_type) { "definitions" => schema_type.all_depends.map { |t| [t.ref_name, t.body] }.to_h, } end  | 
  
.finalize(schema_type) ⇒ Object
Helper function to automatically bundle a type with its dependencies
      18 19 20  | 
    
      # File 'lib/inspec/schema/output_schema.rb', line 18 def self.finalize(schema_type) schema_type.body.merge(OutputSchema.build_definitions(schema_type)) end  | 
  
.json(name) ⇒ Object
      40 41 42 43 44 45 46 47 48 49 50  | 
    
      # File 'lib/inspec/schema/output_schema.rb', line 40 def self.json(name) if !LIST.key?(name) raise("Cannot find schema #{name.inspect}.") elsif LIST[name].is_a?(Proc) v = LIST[name].call else v = LIST[name] end JSON.dump(v) end  | 
  
.names ⇒ Object
      36 37 38  | 
    
      # File 'lib/inspec/schema/output_schema.rb', line 36 def self.names LIST.keys end  |