In habitat, train-* are system gems (#4897)

In habitat, train-* are system gems
This commit is contained in:
Clinton Wolfe 2020-02-18 13:03:49 -05:00 committed by GitHub
commit 5b81c5ad39
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 6 deletions

View file

@ -470,5 +470,5 @@ rescue Inspec::Plugin::V2::Exception => v2ex
else
Inspec::Log.error "Run again with --debug for a stacktrace."
end
ui.exit Inspec::UI::EXIT_PLUGIN_ERROR
exit Inspec::UI::EXIT_PLUGIN_ERROR
end

View file

@ -32,6 +32,13 @@ module Inspec::Plugin::V2
# Identify plugins that inspec is co-installed with
detect_system_plugins unless options[:omit_sys_plugins]
# Train plugins are not true InSpec plugins; we need to decorate them a
# bit more to integrate them. Wait to do this until after we know if
# they are system or user.
registry.each do |plugin_name, status|
fixup_train_plugin_status(status) if train_plugin_name?(plugin_name)
end
end
def load_all
@ -256,10 +263,6 @@ module Inspec::Plugin::V2
status.entry_point = plugin_entry[:installation_path]
end
# Train plugins are not true InSpec plugins; we need to decorate them a
# bit more to integrate them.
fixup_train_plugin_status(status) if train_plugin_name?(plugin_entry[:name])
registry[status.name] = status
end
end
@ -268,6 +271,8 @@ module Inspec::Plugin::V2
status.api_generation = :'train-1'
if status.installation_type == :user_gem
# Activate the gem. This allows train to 'require' the gem later.
# This is not required for system gems because rubygems already has
# activated the gemspecs.
activate_managed_gems_for_plugin(status.entry_point)
end
end

View file

@ -32,8 +32,8 @@ class PluginManagerCliInstall < Minitest::Test
given: File.join("test", "fixtures", "plugins", "inspec-test-fixture", "lib", "inspec-test-fixture.rb"),
},
"refers_to_a_train_plugin" => {
given: File.join(core_config_dir_path, "train-test-fixture", "gems", ruby_abi_version, "gems", "train-test-fixture-0.1.0", "lib", "train-test-fixture.rb"),
plugin_name: "train-test-fixture",
given: File.join(core_config_dir_path, "train-test-fixture", "gems", ruby_abi_version, "gems", "train-test-fixture-0.1.0", "lib", "train-test-fixture.rb"),
resolved_path: File.join(core_config_dir_path, "train-test-fixture", "gems", ruby_abi_version, "gems", "train-test-fixture-0.1.0", "lib", "train-test-fixture.rb"),
},
}.each do |test_name, fixture_info|