summaryrefslogtreecommitdiff
path: root/lib/chef/cookbook
diff options
context:
space:
mode:
authorJay Mundrawala <jdmundrawala@gmail.com>2014-09-29 14:57:51 -0700
committerJay Mundrawala <jdmundrawala@gmail.com>2014-09-29 15:01:47 -0700
commited3f76c6f0c2a9e925af32ffb8c28878f34eea9e (patch)
tree87ef4319f02a25f1b2d78148df4469bdffce17d6 /lib/chef/cookbook
parent4098cf801f8d991ab163f5ce21b81c7807dde6ff (diff)
downloadchef-ed3f76c6f0c2a9e925af32ffb8c28878f34eea9e.tar.gz
Fixing cookbook loading for windows
Diffstat (limited to 'lib/chef/cookbook')
-rw-r--r--lib/chef/cookbook/cookbook_version_loader.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/chef/cookbook/cookbook_version_loader.rb b/lib/chef/cookbook/cookbook_version_loader.rb
index 5c9de6b8ca..5481ba7ddc 100644
--- a/lib/chef/cookbook/cookbook_version_loader.rb
+++ b/lib/chef/cookbook/cookbook_version_loader.rb
@@ -214,23 +214,29 @@ class Chef
def load_root_files
Dir.glob(File.join(Chef::Util::PathHelper.escape_glob(cookbook_path), '*'), File::FNM_DOTMATCH).each do |file|
+ file = Chef::Util::PathHelper.cleanpath(file)
next if File.directory?(file)
next if File.basename(file) == UPLOADED_COOKBOOK_VERSION_FILE
- cookbook_settings[:root_filenames][file[@relative_path, 1]] = file
+ name = Chef::Util::PathHelper.relative_path_from(@cookbook_path, file)
+ cookbook_settings[:root_filenames][name] = file
end
end
def load_recursively_as(category, category_dir, glob)
file_spec = File.join(Chef::Util::PathHelper.escape_glob(cookbook_path, category_dir), '**', glob)
Dir.glob(file_spec, File::FNM_DOTMATCH).each do |file|
+ file = Chef::Util::PathHelper.cleanpath(file)
next if File.directory?(file)
- cookbook_settings[category][file[@relative_path, 1]] = file
+ name = Chef::Util::PathHelper.relative_path_from(@cookbook_path, file)
+ cookbook_settings[category][name] = file
end
end
def load_as(category, *path_glob)
Dir[File.join(Chef::Util::PathHelper.escape_glob(cookbook_path), *path_glob)].each do |file|
- cookbook_settings[category][file[@relative_path, 1]] = file
+ file = Chef::Util::PathHelper.cleanpath(file)
+ name = Chef::Util::PathHelper.relative_path_from(@cookbook_path, file)
+ cookbook_settings[category][name] = file
end
end