Fix dependency path generation

Use Pathname for cleanpath, which handles '..' in paths.

Does this fix the issues with absolute paths in gems?