mirror of
https://github.com/inspec/inspec
synced 2024-11-23 13:13:22 +00:00
lib/source_readers/inspec.rb refactor 7/8: combine load_all and find_all.
58.9: flog total Signed-off-by: Ryan Davis <zenspider@chef.io>
This commit is contained in:
parent
213a4489ed
commit
ac6164e56d
1 changed files with 5 additions and 8 deletions
|
@ -46,29 +46,26 @@ module SourceReaders
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_all paths
|
def load_all &blk
|
||||||
paths.map { |path| file = @target.read(path); [path, file] if file }.compact.to_h
|
find_all(&blk).map { |path| file = @target.read(path); [path, file] if file }.compact.to_h
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_tests
|
def load_tests
|
||||||
paths = find_all { |path|
|
load_all { |path|
|
||||||
path.start_with?("controls") && path.end_with?(".rb")
|
path.start_with?("controls") && path.end_with?(".rb")
|
||||||
}
|
}
|
||||||
load_all paths
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_libs
|
def load_libs
|
||||||
paths = find_all { |path|
|
load_all { |path|
|
||||||
path.start_with?("libraries") && path.end_with?(".rb")
|
path.start_with?("libraries") && path.end_with?(".rb")
|
||||||
}
|
}
|
||||||
load_all paths
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_data_files
|
def load_data_files
|
||||||
paths = find_all { |path|
|
load_all { |path|
|
||||||
path.start_with?("files" + File::SEPARATOR)
|
path.start_with?("files" + File::SEPARATOR)
|
||||||
}
|
}
|
||||||
load_all paths
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue