Fix plugin issues on omni builds (#3499)

* Fix plugin issues on omni builds
* Fix gemspec to include etc dir.

Signed-off-by: Jared Quick <jquick@chef.io>
This commit is contained in:
Jared Quick 2018-10-11 23:25:01 -04:00 committed by GitHub
parent 6a671324a1
commit f7551b3de3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 2 deletions

View file

@ -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}

View file

@ -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}

View file

@ -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

View file

@ -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|