Version of a gem's runtime dependency

时间:2017-06-09 12:45:29

标签: ruby rubygems bundle gemspecs

Can I let the choice of the version of a runtime dependency to the project that will use my gem?

For example in my gem's gemspec :

Gem::Specification.new do |s|
  s.name = "my-gem"
  [...]
  s.add_runtime_dependency 'my-other-gem'
end

And in the Gemfile of my main project :

gem "my-gem"
gem "my-other-gem", "0.2.1"

If I execute a bundle install from my main project with that configuration, I've got the following error :

Bundler could not find compatible versions for gem "my-other-gem":
  In snapshot (Gemfile.lock):
    my-other-gem (= 0.2.1)

  In Gemfile:
    my-other-gem (= 0.2.1)

    my-gem was resolved to 0.0.1, which depends on
      my-other-gem

Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.

0 个答案:

没有答案