Method: Inspec::Runner#eval_with_virtual_profile

Defined in:
lib/inspec/runner.rb

#eval_with_virtual_profile(command) ⇒ Object



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

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.each do |dep|
    # support for windows paths
    dep = dep.tr('\\', "/")
    Inspec::Profile.for_path(dep, { profile_context: ctx }).load_libraries
  end

  ctx.load(command)
end