diff options
Diffstat (limited to 'lib/chef/cookbook/chefignore.rb')
-rw-r--r-- | lib/chef/cookbook/chefignore.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/chef/cookbook/chefignore.rb b/lib/chef/cookbook/chefignore.rb index dce58ecdb8..a27af68cb0 100644 --- a/lib/chef/cookbook/chefignore.rb +++ b/lib/chef/cookbook/chefignore.rb @@ -33,12 +33,16 @@ class Chef @ignores = parse_ignore_file end + # @param [Array] list the list of cookbook files + # @return [Array] list of cookbook files with chefignore files removed def remove_ignores_from(file_list) Array(file_list).inject([]) do |unignored, file| ignored?(file) ? unignored : unignored << file end end + # @param [String] file_name the file name to check ignored status for + # @return [Boolean] is the file ignored or not def ignored?(file_name) @ignores.any? { |glob| File.fnmatch?(glob, file_name) } end |