Skip to content
Browse files

Better handling of Chef::Solo variants, refs #26

  • Loading branch information...
1 parent 935a712 commit a88d40283ab574edeb337a72755e8bc43cf155f7 @miketheman committed May 6, 2012
Showing with 9 additions and 3 deletions.
  1. +2 −0 .gitignore
  2. +7 −3 lib/foodcritic/api.rb
View
2 .gitignore
@@ -8,3 +8,5 @@ pkg
*.swp
tmp
Gemfile.lock
+.DS_Store
+.rvmrc
View
10 lib/foodcritic/api.rb
@@ -32,13 +32,17 @@ def attribute_access(ast, options = {})
# Does the specified recipe check for Chef Solo?
#
# @param [Nokogiri::XML::Node] ast The AST of the cookbook recipe to check.
- # @return [Boolean] True if there is a test for Chef::Config[:solo] in the
- # recipe
+ # @return [Boolean] True if there is a test for Chef::Config[:solo],
+ # Chef::Config['solo'] in the recipe
def checks_for_chef_solo?(ast)
raise_unless_xpath!(ast)
! ast.xpath(%q{//if/aref[count(descendant::const[@value = 'Chef' or
@value = 'Config']) = 2
- and count(descendant::ident[@value='solo']) > 0]}).empty?
+ and
+ ( count(descendant::ident[@value='solo']) > 0
+ or count(descendant::tstring_content[@value='solo']) > 0
+ )
+ ]}).empty?
end
# Is the chef-solo-search library available?

0 comments on commit a88d402

Please sign in to comment.
Something went wrong with that request. Please try again.