Cleanup pod directory when download fails (probably due to a network error)

Fixes #1482
Merge branch 'cleanup-pod-dir-on-failed-download' of https://github.com/alexrothenberg/CocoaPods into alexrothenberg-cleanup-pod-dir-on-failed-download
Make test Ruby 1.8.7 compatible.

See https://travis-ci.org/CocoaPods/CocoaPods/jobs/21842661