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?
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.
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.
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.
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.
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
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
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.
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.
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.
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
On Linux (and probably Mac):
echo 'gem: --no-document' >> ~/.gemrc
This one-liner used to be in comments here, but somehow disappeared.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With