Skip to content

Instantly share code, notes, and snippets.

@natw
Created June 13, 2011 16:30
Show Gist options
  • Save natw/1023117 to your computer and use it in GitHub Desktop.
Save natw/1023117 to your computer and use it in GitHub Desktop.
#!/bin/bash
function main() {
for rpath in `repo_paths`; do
url="http://frogbucket$rpath/raw-file/tip/Gemfile.lock"
lines=`core_line`
if [[ $lines ]]; then
echo "$rpath"
echo "$lines" | while read line; do
echo -e "\t$line"
done
fi
done
}
function repo_paths() {
curl http://frogbucket/repos/ 2> /dev/null |
grep "a href" |
grep "lpp_" |
grep -v "/users" | # remove assorted undesirable lines
grep -v "<li>" |
grep -v "/rev/" |
tail -r | # reverse the order of the lines
cut -d \" -f 2 | # just the URI
grep -v "/admin/" | # remove a few more undesirable URIs
grep -v "login/?next" |
grep -v "^/$"
}
function core_line() {
curl -f $url 2> /dev/null |
grep "lpp-core " |
sed 's/^\s*//g'
}
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment