Skip to content

Instantly share code, notes, and snippets.

@arthurk
Created March 21, 2010 15:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arthurk/339368 to your computer and use it in GitHub Desktop.
Save arthurk/339368 to your computer and use it in GitHub Desktop.
#!/bin/bash
# This will scrape the django trac pages and output two files with ticket counts
# ticket-status-all.txt: assigned | repoened | new
# ticket-meta-all.txt: has_patch | needs_docs | needs_tests | needs_better_patch
# You can then use these numbers to make a plot in gnuplot or R
#
# Note: This was just a test; it's better to use the TRAC API.
DATE=$(date +%Y-%m-%d)
wget "http://code.djangoproject.com/query?status=assigned" -O 1
wget "http://code.djangoproject.com/query?status=reopened" -O 2
wget "http://code.djangoproject.com/query?status=new" -O 3
num1=$(grep matches 1 | cut -d '(' -f 2 | cut -d ' ' -f 1)
num2=$(grep matches 2 | cut -d '(' -f 2 | cut -d ' ' -f 1)
num3=$(grep matches 3 | cut -d '(' -f 2 | cut -d ' ' -f 1)
echo -e "$DATE\t${num1}\t${num2}\t${num3}" >> ticket-status-all.txt
wget "http://code.djangoproject.com/query?status=new&status=assigned&status=reopened&has_patch=%211&order=priority" -O 4
wget "http://code.djangoproject.com/query?status=new&status=assigned&status=reopened&needs_docs=1&order=priority" -O 5
wget "http://code.djangoproject.com/query?status=new&status=assigned&status=reopened&needs_tests=1&order=priority" -O 6
wget "http://code.djangoproject.com/query?status=new&status=assigned&status=reopened&needs_better_patch=1&order=priority" -O 7
num1=$(grep matches 4 | cut -d '(' -f 2 | cut -d ' ' -f 1)
num2=$(grep matches 5 | cut -d '(' -f 2 | cut -d ' ' -f 1)
num3=$(grep matches 6 | cut -d '(' -f 2 | cut -d ' ' -f 1)
num4=$(grep matches 7 | cut -d '(' -f 2 | cut -d ' ' -f 1)
echo -e "$DATE\t${num1}\t${num2}\t${num3}\t${num4}" >> ticket-meta-all.txt
#gnuplot ticket-status-all.plot
#gnuplot ticket-type-all.plot
#gnuplot ticket-component-all.plot
rm -f 1 2 3 4 5 6 7
#YEAR=$(date +%Y)
#for i in ticket-status ticket-type ticket-component; do
#for i in ticket-status; do
# sed -e "s,@@YEAR@@,${YEAR},g" $i-ALL.plot > $i-${YEAR}.plot
# grep -- ${YEAR}- $i-all.txt > $i-${YEAR}.txt
# gnuplot $i-${YEAR}.plot
#done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment