Extend gem:install task to allow for options to the gem command and to the setup of gems
Reported by Gavin Stark | July 23rd, 2008 @ 10:17 PM | in 2.x
When installing gems such as mysql I need to pass it options to tell it where to find the libraries and headers on my system.
Also, when I install gems on production boxes I often use --no-ri and --no-rdoc.
The included patch adds a :gem_options which are command line options to be passed to the gem command and :install_options which are passed to the gem setup via the "--" option to gem.
Example:
config.gem "mysql", :version => "2.7", :gem_options => "--no-ri --no-rdoc", :install_options => "--with-mysql-config=/usr/local/mysql-5.0.51b-osx10.5-x86/bin/mysql_config"
Comments and changes to this ticket
-

kain July 24th, 2008 @ 11:41 AM
I vote for it, on production boxes there's no need for gem documentation, also the mysql gem always gave this kind of "problem".
the issue here is that the options may differ from machine to machine, but it's a start.
-
Ryan Bates July 24th, 2008 @ 12:40 PM
I don't think this belongs in the config file because it is very specific to the system. If you have multiple developers or need to deploy to multiple servers, there's a good chance you'll need it to behave differently.
Perhaps instead we can have "GEM_OPTIONS" for the gems:install rake task itself? You could then make a capistrano task to run this command with specific options on the specific server to install the gems the way you want.
That said, giving the ability to specify gem options in the config file doesn't hurt anything, and there very well be options which aren't system dependent. I'm just going by the example in the ticket.
-

Gavin Stark July 24th, 2008 @ 01:05 PM
The case of needing to supply build options to the mysql gem was the original case I was trying to solve. That install rarely automatically finds the mysql headers and libraries. There was no way to get a one-step clean gems:install without providing options.
You are correct that this doesn't explicitly deal with options that may be machine specific.
However, wouldn't this already work with the above:
config.gem "mysql", :version => "2.7", :install_options => ENV["MYSQL_GEM_INSTALL_OPTIONS"]
and invoke the gems:install rake task as:
rake gems:install MYSQL_GEM_INSTALL_OPTIONS="--with-mysql-config=/server/specific/directory"
or the same via capistrano?
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
Source available from github
The Git repository resides at http://github.com/rails
Check out the current development trunk (Edge Rails) with:
git clone git://github.com/rails/rails.git
The latest development for the 1.2.x and 2.0.x releases are on the 1-2-stable and 2-0-stable branches.
Creating a bug report
When creating a bug report, be sure to include as much relevant information as possible. Post the code sample that causes the problem. Preferably, alter the unit tests and show through either changed or added tests how the expected behavior is not occuring.
Security vulnerabilities should be reported via an email to security@rubyonrails.org, do not use trac for reporting security vulnerabilities. All content in trac is publicly available as soon as it is posted.
Then don't get your hopes up. Unless you have a "Code Red, Mission Critical, The World is Coming to an End" kinda bug, you're creating this ticket in the hope that others with the same problem will be able to collaborate with you on solving it. Do not expect that the ticket automatically will see any activity or that others will jump to fix it. Creating a ticket like this is mostly to help yourself start on the path of fixing the problem and for others to sign on to with a "I'm having this problem too".
