class Chef::Resource::InspecInput

Public Instance Methods

build_source() click to toggle source
# File lib/chef/resource/inspec_input.rb, line 105
def build_source
  return new_resource.source unless new_resource.source.nil?
  return nil unless new_resource.input.count(::File::SEPARATOR) > 0 || (::File::ALT_SEPARATOR && new_resource.input.count(::File::ALT_SEPARATOR) > 0 )

  # InSpec gets processed locally, so no TargetIO
  return nil unless ::File.exist?(new_resource.input)

  new_resource.input
end
input_hash() click to toggle source
# File lib/chef/resource/inspec_input.rb, line 115
def input_hash
  case source
  when Hash
    source
  when String
    parse_file(source)
  when nil
    raise Chef::Exceptions::ValidationFailed, "Could not find the input #{new_resource.input} in any cookbook segment."
  end
end
source() click to toggle source

If the source is nil and the input / name_property contains a file separator and is a string of a file that exists, then use that as the file (similar to the package provider automatic source property). Otherwise just return the source.

@api private

# File lib/chef/resource/inspec_input.rb, line 101
def source
  @source ||= build_source
end