Die properly when the target dir doesn't exists or is invalid
Work properly with latest versions of active_support

The `active_support/core_ext/module/attr_accessor_with_default` has
been dropped by recent versions of active_support. The code never used
'attr_accessor_with_default`, so we can safely replace this broken
dependency with the right one.
Handle database_version tag
Do not crash when writing to different output dir

Create the directory structure inside of the output directory when it's
not there.
Write new `repomd.xml` to the proper location

Use File.join() to compose the path to the final repomd.xml file.
Previously when "+" was used the filename was **not** separated from
the base path, causing the creation of `/path/to/repo/repodatarepomd.xml`
instead of `/path/to/repo/repodata/repomd.xml`
Make possible to select the digest algorithm to use

Previously sha1 was the only algorithm used to compute file's digests.
This resulted to be a problem when parsing the `susedata.xml` file generated
from a repository using sha2 as digest algorithm. The `pkgid`s elements inside
of `susedata.xml` were using the sha1 digest, while the entries of
`primary.xml` were using sha2. Some programs, like SUSE Manager, rely
on the `pgkid` to extend the information provided by `primary.xml` with
the details inside of `susedata.xml`. Having a different `pkgid` made
impossible to join the contents of the two files.
Merge pull request #2 from flavio/misc_fixes

Misc fixes