diff --git a/inspec-core.gemspec b/inspec-core.gemspec index 23af5f1f8..3da2da578 100644 --- a/inspec-core.gemspec +++ b/inspec-core.gemspec @@ -14,7 +14,7 @@ Gem::Specification.new do |spec| spec.files = %w{README.md MAINTAINERS.toml MAINTAINERS.md LICENSE inspec-core.gemspec Gemfile CHANGELOG.md} + - Dir.glob('{bin,docs,examples,lib}/**/*', File::FNM_DOTMATCH) + Dir.glob('{bin,lib,etc}/**/*', File::FNM_DOTMATCH) .reject { |f| File.directory?(f) || f =~ /aws|azure|gcp/ } spec.executables = %w{inspec} diff --git a/inspec.gemspec b/inspec.gemspec index 16bc3b087..95b5d1365 100644 --- a/inspec.gemspec +++ b/inspec.gemspec @@ -17,7 +17,7 @@ Gem::Specification.new do |spec| README.md Rakefile MAINTAINERS.md LICENSE inspec.gemspec Gemfile CHANGELOG.md .rubocop.yml } + Dir.glob( - '{bin,lib}/**/*', File::FNM_DOTMATCH + '{bin,lib,etc}/**/*', File::FNM_DOTMATCH ).reject { |f| File.directory?(f) } spec.executables = %w{inspec} diff --git a/lib/inspec/plugin/v2/installer.rb b/lib/inspec/plugin/v2/installer.rb index e0402f201..32e89b039 100644 --- a/lib/inspec/plugin/v2/installer.rb +++ b/lib/inspec/plugin/v2/installer.rb @@ -395,10 +395,21 @@ module Inspec::Plugin::V2 class InstalledVendorSet < Gem::Resolver::VendorSet def initialize super + Gem::Specification.find_all do |spec| @specs[spec.name] = spec @directories[spec] = spec.gem_dir end + + if !defined?(::Bundler) + directories = Gem::Specification.dirs.find_all do |path| + !path.start_with?(Gem.user_dir) + end + Gem::Specification.each_spec(directories) do |spec| + @specs[spec.name] = spec + @directories[spec] = spec.gem_dir + end + end end end diff --git a/lib/inspec/plugin/v2/loader.rb b/lib/inspec/plugin/v2/loader.rb index 92fb4d582..e74f5e6ff 100644 --- a/lib/inspec/plugin/v2/loader.rb +++ b/lib/inspec/plugin/v2/loader.rb @@ -31,6 +31,10 @@ module Inspec::Plugin::V2 end def load_all + # This fixes the gem paths on some bundles + Gem.path << plugin_gem_path + Gem.refresh + # Be careful not to actually iterate directly over the registry here; # we want to allow "sidecar loading", in which case a plugin may add an entry to the registry. registry.plugin_names.dup.each do |plugin_name|