2

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.

Carlos Villela
  • 515
  • 5
  • 11

5 Answers5

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.

nathanvda
  • 49,707
  • 13
  • 117
  • 139
2

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.

dkastner
  • 457
  • 4
  • 3
1

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.

1

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

  • To be honest, I don't want to make any changes to ParseTree. I just wanted Bundler to use *this* particular version of it, which has compiled Win32 binaries, so I don't have to use VC++ on the other box I'm setting up. – Carlos Villela Dec 15 '10 at 17:45
1

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.

Carlos Villela
  • 515
  • 5
  • 11