Can I force a gem's dependencies in gemfile?

后端 未结 1 933
被撕碎了的回忆
被撕碎了的回忆 2021-01-04 04:18

If there are two gems, A and B. A1.0.0 depends on B1.0.0.

In my Gemfile:

gem \'A\', \'~> 1.0.0         


        
相关标签:
1条回答
  • 2021-01-04 04:49

    You'll need to explicitly specify the B gem in your Gemfile to use a git repository or another version. As long as A 1.0.0 is compatible with B 1.0.1 you'll be fine. If it is only compatible with B 1.0.0 then you'll have to create your own fork of the A gem and upgrade the gemspec to be compatible with B 1.0.1 and then use that repository as your gem for A instead of the rubygems version.

    Here is a sample Gemfile that should give you what you want, provided A 1.0.0 is compatible with B 1.0.1.

    gem 'B', :git => 'git://github.com/B/B.git', :tag => '1.0.1'
    gem 'A', '~> 1.0.0'
    
    0 讨论(0)
提交回复
热议问题