Ruby Gems Either/Or Dependency?
My [VCR][1] gem currently depends on [FakeWeb][2].  I have it [declared as a dependency in my gemspec][3].

I'm working with the auther of [WebMock][4] (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][5], 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]: http://github.com/myronmarston/vcr
  [2]: http://github.com/chrisk/fakeweb
  [3]: http://github.com/myronmarston/vcr/blob/v0.3.0/Rakefile#L14
  [4]: http://github.com/bblimke/webmock
  [5]: http://gembundler.com/
Ruby Gems Either/Or Dependency?
===

My [VCR][1] gem currently depends on [FakeWeb][2].  I have it [declared as a dependency in my gemspec][3].

I'm working with the auther of [WebMock][4] (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][5], 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]: http://github.com/myronmarston/vcr
  [2]: http://github.com/chrisk/fakeweb
  [3]: http://github.com/myronmarston/vcr/blob/v0.3.0/Rakefile#L14
  [4]: http://github.com/bblimke/webmock
  [5]: http://gembundler.com/