Created
October 23, 2013 21:14
-
-
Save gswallow/7126857 to your computer and use it in GitHub Desktop.
Ever want to get the latest versions of your cookbooks to include them in your environment manifests?
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 | |
spaces=${1:-0} | |
if [ "$[$spaces-$spaces]" -ne "0" ]; then | |
spaces=0 | |
fi | |
i=0 | |
while [ $i -lt $spaces ]; do | |
begin="$begin " | |
i=$[$i+1] | |
done | |
grep '^version' cookbooks/*/metadata.rb | \ | |
sed -e 's/cookbooks\//"/' | \ | |
sed -e 's/\/metadata.rb:version/":/' | \ | |
sort -k1 | \ | |
awk '{ printf "%-24s %s\n", $1, $2}' | \ | |
sed -e "s/[\'\"]\([0-9]\)/\"= \1/" | \ | |
sed -e "s/[\'\"]\$/\",/" | \ | |
sed -e '$s/,$//' | \ | |
sed -e "s/^/$begin/" | tee newest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment