Added a library template.

This is just https://github.com/rebar/rebar/pull/168 rebased to latest master. I messed up the previous branch somehow and prefer to code than to fight against history…