Various improvements to metadata.rb parser.

* Some exception types were changed to 'Exception'.
* Regular expression matches are improved.
* Versions/dependencies are replaced instead of hard-coded.
* Wrapped many lines to <80 characters.