Skip to content

Instantly share code, notes, and snippets.

@natw

natw/finder.sh

Created May 4, 2011
Embed
What would you like to do?
#!/bin/bash
function main() {
for rpath in `repo_paths`; do
url="http://frogbucket$rpath/raw-file/tip/setup.py"
reqs=`req_strings`
if [[ $reqs ]]; then
echo "$rpath"
echo "$reqs" | while read line; do
echo -e "\t$line"
done
fi
done
}
function repo_paths() {
curl http://frogbucket/repos/ 2> /dev/null |
grep -E "a href|fork\.gif" | # only links or the images signifying forks
grep -v "/users" | # remove assorted undesirable lines
grep -v "<li>" |
grep -v "/rev/" |
tail -r | # reverse the order of the lines
sed '/fork\.gif/{ N; /.*/d; }' | # remove all fork.gif lines, plus the line following. This is where the magic happens.
cut -d \" -f 2 | # just the URI
grep -v "/admin/" | # remove a few more undesirable URIs
grep -v "login/?next" |
grep -v "^/$"
}
function req_strings() {
curl -f $url 2> /dev/null |
grep -i "django" |
grep -v "description" |
grep -v "active_directory" |
cut -d "[" -f 2 |
sed 's/^\s*//g'
}
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.