Created
June 21, 2012 20:35
-
-
Save atomic-penguin/2968356 to your computer and use it in GitHub Desktop.
Foodcritic FC001 fixer script.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$#" -eq 0 ]; then | |
echo "Usage: `basename $0` <cookbook directory>" | |
elif [ "$#" -eq 1 ]; then | |
find $1 -name "*[.md|.rb]" ! -name "*.git" ! -name "*.erb" | xargs perl -p -e 's!\[:([a-z0-9_]+)\]![\x27$1\x27]!gi' -i | |
echo "Commit message:" | |
echo "FC001: Use strings in preference to symbols to access node attributes" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
thanks for the script, Eric! I forked it so that erb templates get ignored. Otherwise definitions like apache2's web_app definition will fail.
Here's some additional background: CHEF-2748 (params currently is a hash and not a hash with indifferent access) and an apache2 pull request.
Would be better to test for the params hash though instead of ignoring all erb templates, but I'm not enough of a regex guru.
Best regards,
Mike