Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable rdoc and ri generation by default for rubygems 1.8.x

Tags:

ruby

rubygems

There are a lot of answers for this question that work under older versions of rubygems, but what is the recommended procedure for Rubygems 1.8.x? I have an /etc/gemrc file that looks like this:

gem: --no-rdoc --no-ri

These options seem to be ignored during any gem install.

Update:

After doing some more digging, it seems the problem is related to rvm which partitions not just the various versions of ruby, but their associated configuration files, too. To check where the config file should go, use irb:

require 'rubygems'
Gem::ConfigFile::SYSTEM_WIDE_CONFIG_FILE
# => "/opt/local/rvm/rubies/ruby-1.9.2-p180/etc/gemrc"
like image 472
tadman Avatar asked Jun 02 '11 19:06

tadman


2 Answers

You need to put the following in your ~/.gemrc or /etc/gemrc file

install: --no-rdoc --no-ri
like image 83
Pan Thomakos Avatar answered Nov 19 '22 00:11

Pan Thomakos


It appears that this is dependent on where Ruby--and by extension gem--is installed in general, not just with RVM. I installed Ruby from source. The default install location when your are building from source is /usr/local/bin, so I installed Ruby there. Naturally this installs gem and all the other tools that come with Ruby in the same directory as well. I had my gemrc under /etc, but it didn't start working until I moved it to /usr/local/etc instead.

I later re-installed Ruby under /usr/bin instead /usr/local/bin and got the same result. It is now looking for gemrc under /usr/etc instead of /usr/local/etc. The gem tool must be looking for a path relative to where it's installed like ../etc when searching for the system-wide gemrc file.

like image 1
Adam Avatar answered Nov 19 '22 01:11

Adam