How can I reliably use code from github in vendor/gems?
I like to vendor as many gems as possible, except those that must be built on each platform (libxml, etc.) but sometimes I like to use some bleeding-edge code rather than the gems that are out there on the gem servers.
Can I clone a github gem directly into vendor/gems. I guess I could, but will it affect my app code since it is alread开发者_开发问答y a git repository? I would like to just do periodic git pulls for these couple of gems so that I don't have to update every gem and maybe break something.
Use of vendor/gems
has been deprecated in favor of using Bundler and Gemfile
instead. The vendor system had a number of flaws including a lack of support for compiled extensions, so it was never a complete solution.
You're better off locking your versions in the Gemfile as required. If you want to use bleeding edge versions, comment out the version declaration, remove Gemfile.lock
and do a bundle install
again.
It's often the case that the published version of the gem has a flaw you need to repair by forking and fixing, so it's easy to track this:
gem 'broken-gem', :git => 'git://github.com/myname/broken-gem.git'
The advantage here is that the Gemfile
serves as documentation of what versions of the gems you require, and where to get them. vendor/gems
leaves people in the dark as to where that version came from.
精彩评论