restructure a bit, pass directories and trees separately

abuse BEGIN{} to put classes at the bottom of the file

use IO.popen for rlog since there is a file in the openbsd ports
tree with a space in it