summaryrefslogtreecommitdiff
path: root/lib/chef/cookbook
diff options
context:
space:
mode:
authorSerdar Sutay <serdar@opscode.com>2014-10-10 15:32:05 -0700
committerSerdar Sutay <serdar@opscode.com>2014-10-10 15:32:05 -0700
commitd51ae6f6555efbe3ba028a9c78d690042c3205d5 (patch)
tree05e7c39df37d325c25a9092b36d11d24ed1a04f1 /lib/chef/cookbook
parent685042c1ea839cef2ad7fe440df1fc0955535581 (diff)
parentd4801e39b1e82e85ffebeff797be4f0b9d5d6493 (diff)
downloadchef-d51ae6f6555efbe3ba028a9c78d690042c3205d5.tar.gz
Merge pull request #2149 from JeanMertz/chef_client_no_check_files_subdir
knife upload fails due to "wrong" ruby syntax in files/* file
Diffstat (limited to 'lib/chef/cookbook')
-rw-r--r--lib/chef/cookbook/syntax_check.rb15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/chef/cookbook/syntax_check.rb b/lib/chef/cookbook/syntax_check.rb
index 1437785259..96fc7e7b84 100644
--- a/lib/chef/cookbook/syntax_check.rb
+++ b/lib/chef/cookbook/syntax_check.rb
@@ -101,15 +101,24 @@ class Chef
end
def remove_ignored_files(file_list)
- return file_list unless chefignore.ignores.length > 0
+ return file_list if chefignore.ignores.empty?
+
file_list.reject do |full_path|
relative_pn = Chef::Util::PathHelper.relative_path_from(cookbook_path, full_path)
- chefignore.ignored? relative_pn.to_s
+ chefignore.ignored?(relative_pn.to_s)
end
end
+ def remove_uninteresting_ruby_files(file_list)
+ file_list.reject { |f| f =~ %r{#{cookbook_path}/(files|templates)/} }
+ end
+
def ruby_files
- remove_ignored_files Dir[File.join(Chef::Util::PathHelper.escape_glob(cookbook_path), '**', '*.rb')]
+ path = Chef::Util::PathHelper.escape_glob(cookbook_path)
+ files = Dir[File.join(path, '**', '*.rb')]
+ files = remove_ignored_files(files)
+ files = remove_uninteresting_ruby_files(files)
+ files
end
def untested_ruby_files