Bundler: installing a specific .gem file

一曲冷凌霜 提交于 2019-12-24 01:47:28

问题


Is there a way to tell Bundler to install a particular .gem file I have lying around?

I have a compiled version of ParseTree that I must use (damn you, Windows!), but didn't want to expand the gem file in order to add a :path => '...' attribute to the 'gem' requirement.


回答1:


You could also package your gems with bundle package, which puts all of your gems in the vendor/cache directory of your project. If needed, overwrite ParseTree with your precompiled gem in in that directory. Then, when you set up your project on another machine, run bundle install --local and it will only install gems that you've packaged.




回答2:


Instead of setting up your own gem-server, I was able to solve this by writing the following in my Gemfile (the explicit version is crucial):

gem 'libv8', '3.11.8.3mytest', :path => '../libv8/pkg'

And the ../libv8/pkg folder contains only the binary packaged gem libv8-3.11.8.3mytest-x86_64-linux.gem.

Hope this helps.




回答3:


I don't think you can. As far as I know, you need to gem unpack the .gem into something like vendor/ and set the :path option.




回答4:


Can't you point the gem declaration to your ParseTree fork at Github?




回答5:


I figured it out -- thanks to everyone who responded! :)

The trick was to set up a local gem server (with, uh, "gem server") and change my Gemfile's source to point to http://localhost:8808 instead of http://rubygems.org.

This means bundler will grab all the gems from the current installed gem set (which happens to be fine for my case) and then the compiled libs just work.



来源:https://stackoverflow.com/questions/4452052/bundler-installing-a-specific-gem-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!