Turn into a gem.

All straightforward. Only big difference is moving patch_document.rb
to patch.rb.