Domanda

When developing rails 4.1 engine module_infox, there include gem authentify which is developed in rails 3.2 in module_infox's gemfile:

gem 'authentify', :path => '../authentify' 

Gem authentify sits locally and its gemfile.lock was deleted to remove the version lock.

When bundle install under module_infox, there is an error:

$ bundle install
Fetching gem metadata from http://rubygems.org/.........
Fetching gem metadata from http://rubygems.org/..
Resolving dependencies...
Bundler could not find compatible versions for gem "rails":
  In Gemfile:
    authentify (>= 0) x86-mingw32 depends on
      rails (= 3.2.12) x86-mingw32

    module_infox (>= 0) x86-mingw32 depends on
      rails (4.1.0.beta1)

Based on our reading, old version gem can be used in newer version gem. Both gemfile.lock in authentify and module_infox were deleted before bundle install. But there is the same error. What's right way to do so?

È stato utile?

Soluzione

I think the specific dependency on Rails 3.2.12 on authentify gem is the reason of conflict.

Solution 1: Direct fix

The most intuitive solution would be changing this hard dependency. Say, revise the gemspec as rails, '> 3.2'.

However, your authentify gem itself may not be ready for Rails 4 yet. So using this would be a bit aggressive.

Solution 2: Use git brach

The better alternative is to add a branch in authentify gem say "rails-4", then change the gemspec as above.

Then you need to specify this git branch in Gemfile.

If you use Github to host this gem

gem 'authentify', git: 'git://github.com/username/authentify', branch: 'rails-4'

If you are not going to opensource this gem, you can still use local path. But you need to setup Bundle to recognize it.

$ bundle config local.authentify ~/Work/git/authentify

Then set it in Gemfile

# gem 'authentify', :github => 'authentify/authentify', :branch => 'master'

I commented out the last line of code because I just copied it from Bundle doc but not verified that before. You can check the doc and experiment by yourself. http://bundler.io/v1.2/git.html

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top