Merge pull request #4898 from inspec/zenspider/system-plugin/fixes

Distinguish between user plugin gems and system gems and load system gems normally.
This commit is contained in:
Ryan Davis 2020-02-10 19:12:49 -08:00 committed by GitHub
commit 3e3dbdc8f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -48,9 +48,12 @@ module Inspec::Plugin::V2
begin
# 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`)
if plugin_details.installation_type == :user_gem
case plugin_details.installation_type
when :user_gem
activate_managed_gems_for_plugin(plugin_name)
require plugin_details.entry_point
when :system_gem
require plugin_details.entry_point
else
load_path = plugin_details.entry_point
load_path += ".rb" unless plugin_details.entry_point.end_with?(".rb")