api: auto-include library files for inspec profile

This commit is contained in:
Dominik Richter 2015-10-26 02:19:42 +01:00
parent 07e3d749be
commit 80b8b319d9
2 changed files with 17 additions and 3 deletions

View file

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

View file

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