Method: Inspec::Profile#load_libraries

Defined in:
lib/inspec/profile.rb

#load_librariesObject



231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
# File 'lib/inspec/profile.rb', line 231

def load_libraries
  return @runner_context if @libraries_loaded

  locked_dependencies.dep_list.each_with_index do |(_name, dep), i|
    d = dep.profile
    # this will force a dependent profile load so we are only going to add
    # this metadata if the parent profile is supported.
    if supports_platform? && !d.supports_platform?
      # since ruby 1.9 hashes are ordered so we can just use index values here
      .dependencies[i][:status] = 'skipped'
      msg = "Skipping profile: '#{d.name}' on unsupported platform: '#{d.backend.platform.name}/#{d.backend.platform.release}'."
      .dependencies[i][:skip_message] = msg
      next
    elsif .dependencies[i]
      # Currently wrapper profiles will load all dependencies, and then we
      # load them again when we dive down. This needs to be re-done.
      .dependencies[i][:status] = 'loaded'
    end
    c = d.load_libraries
    @runner_context.add_resources(c)
  end

  libs = libraries.map do |path, content|
    [content, path]
  end

  @runner_context.load_libraries(libs)
  @libraries_loaded = true
  @runner_context
end