views:

113

answers:

1

My VCR gem currently depends on FakeWeb. I have it declared as a dependency in my gemspec.

I'm working with the auther of WebMock (a library that provides similar functionality to FakeWeb) to get VCR to work with WebMock as well, so that users of VCR could use either FakeWeb or WebMock as the http stubbing library.

When it comes time to release the next version of VCR, I'm not sure of the best way to handle these dependencies. VCR will depend on either WebMock, or FakeWeb (but doesn't need both), and will have certain version requirements for both. I could add both as dependencies to my gemspec, but when you use bundler, it bundles all gem dependencies--so both FakeWeb and Webmock will get bundled with the application.

I've been thinking that maybe I won't declare either gem as a dependency, and check for the presence of either library at run-time (along with checking the version), and give the user a helpful error message if neither is present at a supported version. But I'm not really sure I like this approach either.

Does anyone have a suggestion for the best way to handle an either/or gem dependency?

Thanks!

+1  A: 

since it's not possible to declare either/or dependencies, i think not specifying any dependency in your gemspec and checking for the presence of either library at runtime is the way to go.

rubiii