reorganize source to better separate lib from test and use rakefile instead of shell script for building

this is a project structure cleanup, no changes to source files

switching to a rakefile with file tasks greatly speeds up everything except a full rebuild, and makes even that simpler to manage