mirror of
https://github.com/inspec/inspec
synced 2025-02-17 06:28:40 +00:00
api: auto-include library files for inspec profile
This commit is contained in:
parent
07e3d749be
commit
80b8b319d9
2 changed files with 17 additions and 3 deletions
|
@ -5,6 +5,19 @@
|
|||
module Vulcano::Targets
|
||||
module DirsHelper
|
||||
class ProfileDir
|
||||
def handles?(paths)
|
||||
paths.include?('test') && paths.include?('metadata.rb')
|
||||
end
|
||||
|
||||
def get_filenames(paths)
|
||||
paths.find_all do |path|
|
||||
(path.start_with?('test') || path.start_with?('lib')) &&
|
||||
path.end_with?('.rb')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class ChefAuditDir
|
||||
def handles?(paths)
|
||||
paths.include?('recipes') and paths.include?('metadata.rb')
|
||||
end
|
||||
|
|
|
@ -21,10 +21,11 @@ module Vulcano::Targets
|
|||
if helper.nil?
|
||||
fail "Don't know how to handle folder #{target}"
|
||||
end
|
||||
# get all file contents
|
||||
|
||||
# get all test file contents
|
||||
file_handler = Vulcano::Targets.modules['file']
|
||||
test_files = helper.get_filenames(files)
|
||||
test_files.map do |f|
|
||||
raw_files = helper.get_filenames(files)
|
||||
raw_files.map do |f|
|
||||
file_handler.resolve(File.join(target, f))
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue