Search code examples
ruby-on-railsrubyrest-clientgemfile

ruby gemfile rest-client version conflict


I mean, users are encouraged to upgrade to rest-client 2.0, I need to upgrade for some mail api only support 2.0 version, but now I meet this problem.
When I change rest-client version to 2.0.2 in my Gemfile, and I meet this problem.
Bundler could not find compatible versions for gem "rest-client": it seems that rest-client 2.0 version is conflict with docverter which depends on rest-client (~> 1.6.7)
So how should I do to solve? I need rest-client version to be above 2.0.

here's my Gemfile:

source 'https://rubygems.org'
ruby '2.4.1'

gem 'rails'

# Forms
gem 'wicked'
gem 'localstorageshim-rails'
gem 'simple_form'

# Monitoring
gem 'newrelic_rpm'
gem 'slack-notifier'
gem 'puma_worker_killer'

# Assets
gem 'sass-rails'
gem 'haml-rails'
gem 'uglifier'
gem 'autoprefixer-rails'

# Design
gem 'bootstrap-sass'
gem 'font-awesome-sass'
gem 'nprogress-rails'
gem 'normalize-rails'

# Markdown
gem 'marked-rails'
gem 'rdiscount'

# Javascript
gem 'react-rails'
gem 'coffee-rails'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jquery-turbolinks'

# Authentication
gem 'devise'
gem 'pundit'

# Data
gem 'pg'

# Payments
gem 'stripe'
gem 'braintree'

# Crypto
gem 'hashids'

# Images
gem 'lazyload-rails'

# Files
gem 'rest-client', '>= 2.0'
gem 'docverter'

# Utils
gem 'annotate'
gem 'jbuilder'
gem 'sdoc',          group: :doc

group :development do
  gem 'spring'
  gem 'spring-commands-rspec'

  gem 'better_errors'
  gem 'binding_of_caller', :platforms=>[:mri_21]
  gem 'html2haml'
  gem 'hub', :require=>nil
  gem 'quiet_assets'
  gem 'rails_layout'
end

group :development, :test do
  gem 'factory_girl_rails'
  gem 'faker'
  gem 'rspec-rails'
end

group :production do
  gem 'rails_12factor'
  gem 'puma'
  gem 'heroku_rails_deflate'
  gem 'rack-timeout'
end

group :test do
  gem 'capybara'
  gem 'database_cleaner'
  gem 'launchy'
  gem 'selenium-webdriver'
end

Solution

  • Unfortunately you can only have one version of a gem activated at a time. So when there are conflicting version dependencies like this, you have to pick one.

    The latest Docverter code requires rest-client 1.x: https://github.com/Docverter/docverter-ruby/blob/5775e5a8bc00610d3168141cc44a83b4af41717a/docverter.gemspec#L20

    In this situation, your best bet is probably to make a fork changing the dependency to ~> 2.0 and issue a pull request. In the best case, the maintainers will merge your pull request quickly.

    In the worst case, you can use your forked version by specifying a git URL in the Gemfile. http://bundler.io/v1.15/guides/git.html