views:

20

answers:

2

In other words, can't the versions have conflicts and is there a way to solve it?

Such as Foo depends on Bar and Foo doesn't support Bar 2.0, but Wala need to have at least Bar 2.0, so can Rubygems or Bundler or any mechanism handle it?

+1  A: 

It's open-source, check it out with Git and fix Foo, then contribute your fix back to the community!

Paul Betts
you mean, make Foo compatible with both Bar 1.2.2 and Bar 2.0... what if it can take weeks to do that and I need to finish the project (at work) 3 days later.
動靜能量
I'm sorry, sometimes there's no way but the hard way; trying to run two separate instances of the same gem is almost certainly going to cause you problems
Paul Betts
+1  A: 

This can be a problem, if each gem really needs that specific version. But most of the time, you can fix this quickly. Vendor your gems:

rake rails:freeze:gems

Now go into vendor/gems, and find the *.gemspec files for the gems you're trying to reconcile. Update the add_dependency line, and set the dependency in both gems to the same version. Use the more recent version for both.

Chances are good this will fix your problem. If not, there may be more work involved :)

Jaime Bellmyer
can `rake rails:freeze:gems` freeze any gems the project needs that is not directly needed by Rails? For example, if the project need BlueCloth or Facebooker, but it is not part of Rails, can `rake rails:freeze:gems` freeze it too?
動靜能量
If you're in a rails application, the rake command I gave will freeze anything that is listed in the config/environment.rb file, or the config/environments/*.rb files if you specify the environment the rake task should run as. For instance, if you have gems that are only listed in the test.rb file, you can get them frozen by calling "rake rails:freeze:gems RAILS_ENV=test". Outside of rails, go to github and clone the gem you want to change. Update it, and install it locally on your system. And if you're feeling generous, follow Paul Betts' advice and re-release it back to the public :)
Jaime Bellmyer