diff options
| -rw-r--r-- | lib/chef/cookbook/syntax_check.rb | 15 | ||||
| -rw-r--r-- | spec/data/cookbooks/ignorken/files/default/not_me.rb | 2 | ||||
| -rw-r--r-- | spec/data/cookbooks/ignorken/templates/ubuntu-12.10/not_me.rb | 2 |
3 files changed, 16 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 diff --git a/spec/data/cookbooks/ignorken/files/default/not_me.rb b/spec/data/cookbooks/ignorken/files/default/not_me.rb new file mode 100644 index 0000000000..8063e32a95 --- /dev/null +++ b/spec/data/cookbooks/ignorken/files/default/not_me.rb @@ -0,0 +1,2 @@ +a cat walked on the keyboard one day... +(*&(*&(*&(*&(*^%$%^%#^^&(*)(*{}}}}}}}}+++++===)))))) diff --git a/spec/data/cookbooks/ignorken/templates/ubuntu-12.10/not_me.rb b/spec/data/cookbooks/ignorken/templates/ubuntu-12.10/not_me.rb new file mode 100644 index 0000000000..8063e32a95 --- /dev/null +++ b/spec/data/cookbooks/ignorken/templates/ubuntu-12.10/not_me.rb @@ -0,0 +1,2 @@ +a cat walked on the keyboard one day... +(*&(*&(*&(*&(*^%$%^%#^^&(*)(*{}}}}}}}}+++++===)))))) |
