From: Jano Svitok Date: 2007-11-14T01:51:06+09:00 Subject: Re: Automating gem installs? On Nov 9, 2007 6:48 PM, Justin Hahn wrote: > I'm trying to setup an automated build system for all of our upstream > binary dependencies (that we don't get from our OS). Since we track a > newer ruby than most of our machines ship with, this means building ruby > and installing gems. For the most part this works fine, except when I > need to install a gem like mongrel that has several versions. > > > For example, if I run 'gem install -y mongrel' from my Makefile, I get > an error like this (since stdin isn't attached): > > > Select which gem to install for your platform (x86_64-linux) > 1. mongrel 1.1 (ruby) > 2. mongrel 1.1 (mswin32) > 3. mongrel 1.0.4 (mswin32) > 4. mongrel 1.0.4 (ruby) > 5. Skip this gem > 6. Cancel installation > > ERROR: While executing gem ... (NoMethodError) > undefined method `strip' for nil:NilClass > > Unfortunately, the list entries aren't even stable -- sometimes option > #1 is the mswin32 and sometimes it's the ruby choice. So I can't even do > something nasty like "echo 1 | gem install -y mongrel" and be assured of > getting the right thing. > > Is there any way to tell gem, from the commandline, precisely which gem > I want? The documentation seems sparse, and I haven't had the time to go > digging through gem's source code yet. (My hope is that this is any easy > answer...) One way is to install the gems on one machine and run a gem server on it. Then install the other machines from that server (--source=http://yourserver) If you install only one version of a gem, only one will be offered and you'll exactly know which one. This will make the install a bit faster, as you'll be downloading from the local network. Setting up a gem server is pretty easy -- e.g. http://rambleon.org/2007/04/19/creating-your-own-gem-server/ J.