summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authordanielsdeleo <dan@chef.io>2016-02-26 15:45:52 -0800
committerdanielsdeleo <dan@chef.io>2016-02-26 17:42:30 -0800
commite4f0839f18ddfaea1519b65dbcdd759dd9988c4e (patch)
tree797fbf1fa952db785fad351bb9689d87346a3e02 /lib
parent4710acd2029d8a7a0417c994cc5a5f61ffbf8fc6 (diff)
downloadchef-e4f0839f18ddfaea1519b65dbcdd759dd9988c4e.tar.gz
Rename all_unignored_files -> all_files
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/cookbook/cookbook_version_loader.rb18
-rw-r--r--lib/chef/cookbook_version.rb4
2 files changed, 11 insertions, 11 deletions
diff --git a/lib/chef/cookbook/cookbook_version_loader.rb b/lib/chef/cookbook/cookbook_version_loader.rb
index b9fa5dfa29..0e3fb2ef72 100644
--- a/lib/chef/cookbook/cookbook_version_loader.rb
+++ b/lib/chef/cookbook/cookbook_version_loader.rb
@@ -43,7 +43,7 @@ class Chef
@relative_path = /#{Regexp.escape(@cookbook_path)}\/(.+)$/
@metadata_loaded = false
@cookbook_settings = {
- :all_unignored_files => {},
+ :all_files => {},
:attribute_filenames => {},
:definition_filenames => {},
:recipe_filenames => {},
@@ -79,13 +79,13 @@ class Chef
# re-raise any exception that occurred when reading the metadata
raise_metadata_error!
- load_all_unignored_files
+ load_all_files
# TODO:
# 1. Can we safely pick out the segment files with fnmatch against the
- # file names in all_unignored_files (?)
+ # file names in all_files (?)
# 2. If so, can we avoid running chefignore twice by running it against
- # all_unignored_files before segmenting?
+ # all_files before segmenting?
#
# See: https://shane.io/2014/07/13/sobbing-with-ruby-file-globbing.html
@@ -132,7 +132,7 @@ class Chef
return nil if empty?
Chef::CookbookVersion.new(cookbook_name, *cookbook_paths).tap do |c|
- c.all_unignored_files = cookbook_settings[:all_unignored_files].values
+ c.all_files = cookbook_settings[:all_files].values
c.attribute_filenames = cookbook_settings[:attribute_filenames].values
c.definition_filenames = cookbook_settings[:definition_filenames].values
c.recipe_filenames = cookbook_settings[:recipe_filenames].values
@@ -224,7 +224,7 @@ class Chef
@chefignore ||= Chefignore.new(File.basename(cookbook_path))
end
- def load_all_unignored_files
+ def load_all_files
# List all directories that are not dotdirs, then list everything in
# those, *including* dotfiles and dotdirs.
# Finally, list all the _files_ at the root, including dotfiles, and
@@ -235,11 +235,11 @@ class Chef
Dir.glob(File.join(Chef::Util::PathHelper.escape_glob(dir), "**/*"), File::FNM_DOTMATCH).each do |file|
name = Chef::Util::PathHelper.relative_path_from(@cookbook_path, file)
- cookbook_settings[:all_unignored_files][name] = file
+ cookbook_settings[:all_files][name] = file
end
end
load_root_files
- cookbook_settings[:all_unignored_files].merge!(cookbook_settings[:root_filenames])
+ cookbook_settings[:all_files].merge!(cookbook_settings[:root_filenames])
end
def load_root_files
@@ -283,7 +283,7 @@ class Chef
# always enabled.
def select_files_by_glob(pattern, option = 0)
combined_opts = option | File::FNM_PATHNAME
- cookbook_settings[:all_unignored_files].values.select do |path|
+ cookbook_settings[:all_files].values.select do |path|
File.fnmatch?(pattern, path, combined_opts)
end
end
diff --git a/lib/chef/cookbook_version.rb b/lib/chef/cookbook_version.rb
index d9e9897a06..2857d8098e 100644
--- a/lib/chef/cookbook_version.rb
+++ b/lib/chef/cookbook_version.rb
@@ -40,7 +40,7 @@ class Chef
COOKBOOK_SEGMENTS = [ :resources, :providers, :recipes, :definitions, :libraries, :attributes, :files, :templates, :root_files ]
- attr_accessor :all_unignored_files
+ attr_accessor :all_files
attr_accessor :root_paths
attr_accessor :definition_filenames
@@ -130,7 +130,7 @@ class Chef
@metadata_filenames = Array.new
@root_filenames = Array.new
- @all_unignored_files = Array.new
+ @all_files = Array.new
# deprecated
@status = :ready