Distinguish between core gems and system gems and load system gems normally.

Signed-off-by: Ryan Davis <zenspider@chef.io>
This commit is contained in:
Ryan Davis 2020-02-07 14:40:56 -08:00
parent 093af59ea2
commit 3eac105498

View file

@ -48,9 +48,12 @@ module Inspec::Plugin::V2
begin begin
# We could use require, but under testing, we need to repeatedly reload the same # We could use require, but under testing, we need to repeatedly reload the same
# plugin. However, gems only work with require (rubygems dooes not overload `load`) # plugin. However, gems only work with require (rubygems dooes not overload `load`)
if plugin_details.installation_type == :user_gem case plugin_details.installation_type
when :user_gem
activate_managed_gems_for_plugin(plugin_name) activate_managed_gems_for_plugin(plugin_name)
require plugin_details.entry_point require plugin_details.entry_point
when :system_gem
require plugin_details.entry_point
else else
load_path = plugin_details.entry_point load_path = plugin_details.entry_point
load_path += ".rb" unless plugin_details.entry_point.end_with?(".rb") load_path += ".rb" unless plugin_details.entry_point.end_with?(".rb")