Skip to content

Commit

Permalink
Merge pull request #28 from svanharmelen/master
Browse files Browse the repository at this point in the history
Version 0.3.1
  • Loading branch information
Sander van Harmelen committed Aug 7, 2015
2 parents 286dc02 + 4869690 commit a0006a2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Chef-Guard CHANGELOG
====================

0.3.1
-----
- Miguel Ferreira - Fixed syntax error in the custom foodcritic tests

0.3.0
-----
- Sander van Harmelen - Updated the cookbook to use Chef-Guard v0.6.0 which requires some config changes
Expand Down
2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
license 'Apache 2.0'
description 'Installs/Configures Chef-Guard'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.3.0'
version '0.3.1'

%w(redhat centos ubuntu).each do |os|
supports os
Expand Down
11 changes: 8 additions & 3 deletions templates/default/cg_foodcritic_tests.rb.erb
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,22 @@ end

rule 'CG001', 'Ensure all cookbook dependencies depend on a specific version' do
tags %w(correctness metadata)
matches = []

metadata do |ast|
matches = []
name = ast.xpath(%q{//command[ident/@value='name']})

if name.to_s.match('<%= @matches %>')
# Get and loop through the hash with dependencies
# and check if they depend on a specific version
dependency_versions(ast).each do |name,version|
matches << name unless version.to_s != '' && /^(?:= )?\d+\.\d+\.\d+$/ === version.xpath(%q{@value}).to_s
unless version.to_s != '' && /^(?:= )?\d+\.\d+\.\d+$/ === version.xpath(%q{@value}).to_s
matches << name
end
end
end
matches
end

# Return any matches that we may have found
matches
end

0 comments on commit a0006a2

Please sign in to comment.