mirror of
https://github.com/inspec/inspec
synced 2025-02-17 06:28:40 +00:00
load plugins in the same gem installation
This commit is contained in:
parent
a91749b8f6
commit
926023de91
1 changed files with 11 additions and 4 deletions
|
@ -24,11 +24,18 @@ module Inspec
|
|||
def_delegator :registry, :keys, :list
|
||||
|
||||
def initialize(home = nil)
|
||||
@paths = []
|
||||
|
||||
# load plugins in the same gem installation
|
||||
lib_home = File.expand_path(File.join(__FILE__, '..', '..', '..', '..'))
|
||||
@paths += Dir[lib_home+'/inspec-*-*/lib/inspec-*rb']
|
||||
|
||||
# traverse out of inspec-vX.Y.Z/lib/inspec/plugins.rb
|
||||
@home = home || File.join(Dir.home, '.inspec', 'plugins')
|
||||
@paths = Dir[File.join(@home, '**{,/*/**}', '*.gemspec')]
|
||||
.map { |x| File.dirname(x) }
|
||||
.map { |x| Dir[File.join(x, 'lib', 'inspec-*.rb')] }
|
||||
.flatten
|
||||
@paths += Dir[File.join(@home, '**{,/*/**}', '*.gemspec')]
|
||||
.map { |x| File.dirname(x) }
|
||||
.map { |x| Dir[File.join(x, 'lib', 'inspec-*.rb')] }
|
||||
.flatten
|
||||
|
||||
# load bundled plugins
|
||||
bundled_dir = File.expand_path(File.dirname(__FILE__))
|
||||
|
|
Loading…
Add table
Reference in a new issue