Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

ruby

rubygems

I don't use the RI or RDoc output from the gems I install in my machine or in the servers I handle (I use other means of documentation).

Every gem I install installs RI and RDoc documentation by default, because I forget to set --no-ri --no-rdoc.

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

like image 658
Ricardo Acras Avatar asked Sep 04 '09 21:09

Ricardo Acras


People also ask

How do I install a specific version of a gem?

Use `gem install -v` You may already be familiar with gem install , but if you add the -v flag, you can specify the version of the gem to install. Using -v you can specify an exact version or use version comparators.

How do I install everything in Gemfile?

run the command bundle install in your shell, once you have your Gemfile created. This command will look your Gemfile and install the relevant Gems on the indicated versions. The Gemfiles are installed because in your Gemfile you are pointing out the source where the gems can be downloaded from.

Where is the Gemrc file?

gem looks for a configuration file . gemrc in your home directory, although you can specify another file on the command-line if you wish (with the --config-file modifier). There are three things you can specify in the configuration file: command-line arguments to be used every time gem runs.

How do I install gems?

To install a gem, use gem install [gem] . Browsing installed gems is done with gem list . For more information about the gem command, see below or head to RubyGems' docs. There are other sources of libraries though.

How do I Turn Off documentation for a gem?

You just add the following line to your local ~/.gemrcfile (it is in your homefolder): gem: --no-document or you can add this line to the global gemrcconfig file. Here is how to find it (in Linux): strace gem source 2>&1 | grep gemrc The --no-documentoption is documented in the RubyGems CLI Reference. Share Follow

Is the --no-document option documented in RubyGems CLI reference?

The --no-documentoption is documented in the RubyGems CLI Reference. Share Follow edited Aug 19 at 16:25 Hosam Aly 39.2k3535 gold badges132132 silver badges179179 bronze badges answered Sep 6 '09 at 16:10 JirapongJirapong 23k1010 gold badges4949 silver badges7070 bronze badges 11 2

How can I speed up my gem installation?

If you want to speed up your gem installations and have less clutter in your system, remove the rdoc and ri when installing new gems. And if you want to default not having the documentation, add the flags to your global gemrc definition: And to knock it up a notch, you should add .gemrc to your dotfiles.


4 Answers

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

gem: --no-document

by

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

or you can add this line to the global gemrc config file.

Here is how to find it (in Linux):

strace gem source 2>&1 | grep gemrc

The --no-document option is documented in the RubyGems CLI Reference.

like image 120
Jirapong Avatar answered Oct 08 '22 02:10

Jirapong


From RVM’s documentation:

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

gem: --no-document

Note: The original answer was:

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

This is no longer valid; the RVM docs have since been updated, thus the current answer to only include the gem directive is the correct one.

like image 22
gdelfino Avatar answered Oct 08 '22 01:10

gdelfino


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
like image 188
James Lim Avatar answered Oct 08 '22 03:10

James Lim


On Linux (and probably Mac):

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

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

like image 101
3 revs Avatar answered Oct 08 '22 03:10

3 revs