Method: Inspec::Runner#eval_with_virtual_profile

Defined in:
lib/inspec/runner.rb

#eval_with_virtual_profile(command) ⇒ Object



229
230
231
232
233
234
235
236
237
238
239
240
241
242
# File 'lib/inspec/runner.rb', line 229

def eval_with_virtual_profile(command)
  require 'fetchers/mock'
  add_target({ 'inspec.yml' => 'name: inspec-shell' })
  our_profile = @target_profiles.first
  ctx = our_profile.runner_context

  # Load local profile dependencies. This is used in inspec shell
  # to provide access to local profiles that add resources.
  @depends
    .map { |x| Inspec::Profile.for_path(x, { profile_context: ctx }) }
    .each(&:load_libraries)

  ctx.load(command)
end