summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordanielsdeleo <dan@chef.io>2016-02-26 16:58:31 -0800
committerdanielsdeleo <dan@chef.io>2016-02-26 17:42:30 -0800
commit1691eab8b6b1abcf532858718fabe1bcdd10bd30 (patch)
tree4f2545b68f09e1e17918744d6c12b3ab53675a72
parent9961644c72aeb283b8da76415b3dc5f3ba468bbb (diff)
downloadchef-1691eab8b6b1abcf532858718fabe1bcdd10bd30.tar.gz
Remove ignored files from all_files before segmenting
-rw-r--r--lib/chef/cookbook/cookbook_version_loader.rb16
1 files changed, 3 insertions, 13 deletions
diff --git a/lib/chef/cookbook/cookbook_version_loader.rb b/lib/chef/cookbook/cookbook_version_loader.rb
index e50bd19b39..5b6cf4b468 100644
--- a/lib/chef/cookbook/cookbook_version_loader.rb
+++ b/lib/chef/cookbook/cookbook_version_loader.rb
@@ -81,13 +81,7 @@ class Chef
load_all_files
- # TODO:
- # 1. Can we safely pick out the segment files with fnmatch against the
- # file names in all_files (?)
- # 2. If so, can we avoid running chefignore twice by running it against
- # all_files before segmenting?
- #
- # See: https://shane.io/2014/07/13/sobbing-with-ruby-file-globbing.html
+ remove_ignored_files
load_as(:attribute_filenames, "attributes", "*.rb")
load_as(:definition_filenames, "definitions", "*.rb")
@@ -99,8 +93,6 @@ class Chef
load_recursively_as(:provider_filenames, "providers", "*.rb")
load_root_files
- remove_ignored_files
-
if empty?
Chef::Log.warn "Found a directory #{cookbook_name} in the cookbook path, but it contains no cookbook files. skipping."
end
@@ -302,10 +294,8 @@ class Chef
end
def remove_ignored_files
- cookbook_settings.each_value do |file_list|
- file_list.reject! do |relative_path, full_path|
- chefignore.ignored?(relative_path)
- end
+ cookbook_settings[:all_files].reject! do |relative_path, full_path|
+ chefignore.ignored?(relative_path)
end
end