support caching for gemfiles in subdirectories

should fix https://github.com/travis-ci/travis-ci/issues/2975