Class: SourceReaders::InspecReader

Inherits:
Object
  • Object
show all
Defined in:
lib/source_readers/inspec.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target, metadata_source) ⇒ InspecReader

This create a new instance of an InSpec profile source reader

Parameters:

  • target (FileProvider)

    An instance of a FileProvider object that can list files and read them

  • metadata_source (String)

    eg. inspec.yml or metadata.rb



20
21
22
23
24
25
26
# File 'lib/source_readers/inspec.rb', line 20

def initialize(target, )
  @target     = target
  @metadata   = ()
  @tests      = load_tests
  @libraries  = load_libs
  @data_files = load_data_files
end

Instance Attribute Details

#data_filesObject (readonly)

Returns the value of attribute data_files.



14
15
16
# File 'lib/source_readers/inspec.rb', line 14

def data_files
  @data_files
end

#librariesObject (readonly)

Returns the value of attribute libraries.



14
15
16
# File 'lib/source_readers/inspec.rb', line 14

def libraries
  @libraries
end

#metadataObject (readonly)

Returns the value of attribute metadata.



14
15
16
# File 'lib/source_readers/inspec.rb', line 14

def 
  @metadata
end

#testsObject (readonly)

Returns the value of attribute tests.



14
15
16
# File 'lib/source_readers/inspec.rb', line 14

def tests
  @tests
end

Class Method Details

.resolve(target) ⇒ Object



9
10
11
12
# File 'lib/source_readers/inspec.rb', line 9

def self.resolve(target)
  return new(target, "inspec.yml") if target.files.include?("inspec.yml")
  nil
end