How to make –no-ri –no-rdoc the default for gem install?

How to make –no-ri –no-rdoc the default for gem install?

I don’t use RI or RDoc from the gems I install in my machine or in the servers I handle (I use other means of documentation), but every gem I install comes with RI and RDoc by default and I forget to set –no-ri –no-rdoc.

Is there a way to make those two flags the default?

How do I make –no-ri –no-rdoc the default for gem install? [duplicate]

Possible Duplicate: How to make –no-ri –no-rdoc the default for gem install? I never use ri nor rdoc and they take too long to install. Is there a config file somewhere that will let me do this

How to make gem install command only install when not installed or update needed

i’ve read the documentation from rubygems site, but i guess the gem install command always reinstall, recompile everything, even if the same version already installed.. how to make gem install comma

In Ruby on Rails, after “gem install ”, how to make it extend Array, or use its class method?

Summary: after I gem install <gem_name>, how do I make it extend Array which the gem can do? Details: I see a gem for natural language sort, which is http://rubygems.org/gems/naturalsort http:

how to install gem manually

I know that client_side_validations is not available as a gem for Rails 4. But there is a 4.0. beta branch on github. When downloaded, how can I install it ?

How to install gem from GitHub source?

I would like to install gem from the latest GitHub source. How do I do this?

How to specify compiler for “gem install”?

How can I specify which compiler should be used for gem install? In Bash CC=gcc gem install … does not help, because it still uses solaris studio on my system.

Can “gem install” be configured to install executables outside /usr/bin/ by default?

By default, when you sudo gem install thegemname it will install executables into /usr/bin/ Is there a way to change this? For example, to install them into /usr/local/rubygems/bin (or any other path)

How to install a specific version of a ruby gem?

Using the command-line gem tool, how can I install a specific version of a gem?

How can I install a local gem?

If I download a .gem file to a folder in my computer, can I install it later using gem install?

How many times was a Ruby gem installed via `gem install` or `gem update`

I am trying to find out how many times a gem was installed via gem install or gem update. For example, Watir 1.6.2: it was installed 97 times via gemcutter (http://gemcutter.org/gems/watir/versions/1

Answers

You can specify default options using the .gemrc configuration file.

Documentation about gem configuration file

You just add following line to your local ~/.gemrc file (it is in your home folder)

gem: --no-document

or you can add this line to global gemrc config file, here is how to find it (in linux)

strace gem source 2>&1 | grep gemrc

On Windows XP the path to the .gemrc file is

c:/Documents and Settings/All Users/Application Data/gemrc 

and this file is not created by default, you should create it yourself.

# /home/{user}/.gemrc

---
:update_sources: true
:sources:
- http://gems.rubyforge.org/
- http://gems.github.com
:benchmark: false
:bulk_threshold: 1000
:backtrace: false
:verbose: true
gem: --no-ri --no-rdoc

http://webonrails.com/2008/12/03/skiping-installation-of-ri-and-rdoc-documentation-while-installing-gems/

From RVM’s documentation:

Just add this line to your ~/.gemrc or /etc/gemrc:

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

The answer stated earlier:

install: --no-rdoc --no-ri 
update: --no-rdoc --no-ri 

but it got updated with the docs it was quoting – @mpapis

Step by steps:

To create/edit the .gemrc file from the terminal:

vi  ~/.gemrc

You will open a editor called vi. paste in:

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

click ‘esc’-button.

type in:

:exit

You can check if everything is correct with this command:

sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit ~/.gemrc

On Linux (and probably Mac):

echo 'gem: --no-document' >> ~/.gemrc

This one-liner used to be in comments here, but somehow disappeared.

Note that –no-ri and –no-rdoc have been deprecated according to the new guides. The recommended way is to use –no-document in ~/.gemrc or /etc/gemrc.

install: --no-document
update: --no-document

or

gem: --no-document

A oneliner for the windows users:

(echo install: –no-document && echo update: –no-document) >> c:/ProgramData/gemrc

On Windows7 the .gemrc file is not present, you can let Ruby create one like this (it’s not easy to do this in explorer).

gem sources --add http://rubygems.org

You will have to confirm (it’s unsafe). Now the file is created in your userprofile folder (c:/users/)

You can edit the textfile to remove the source you added or you can remove it with

gem sources --remove http://rubygems.org

As mentioned above, put gem: –no-document in your gem file. However, the system-wide gemrc will not always necessarily go into /etc/gemrc. If you are using RVM, or you have Ruby installed under /usr/local/bin, it needs to go in a different location. You can find this location by running irb and typing…

require 'rubygems'
Gem::ConfigFile::SYSTEM_WIDE_CONFIG_FILE

See the original post on this over here.

One line to rule them all:

echo "gem: --no-document" >> ~/.gemrc