4

It is always frustrating to install a gem and wait 2 seconds for the gem to install and then wait 30 seconds for the docs, which I never use(Google, anyone?). Why do we force this convention upon ourselves when the local docs normally aren't even beneficial?

I know you can use gem install rails --no-ri --no-rdoc to skip that step but is there a way to simply skip the docs by default?

Josh
  • 5,631
  • 1
  • 28
  • 54
  • 1
    possible duplicate of [How do I make --no-ri --no-rdoc the default for gem install?](http://stackoverflow.com/questions/1789376/how-do-i-make-no-ri-no-rdoc-the-default-for-gem-install) – the Tin Man Apr 05 '12 at 18:58
  • It's a good question, but one for a Ruby mailing list, not s/o. – Phrogz Apr 05 '12 at 19:13

1 Answers1

1

Add the flags to your ~/.gemrc file.

From the docs:

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). Only one configuration file will be processed: the rightmost one on the command-line, or the default $HOME/.gemrc, or none at all.

There are three things you can specify in the configuration file:

  • command-line arguments to be used every time gem runs
  • command-line options for "RDoc" (used when generating documentation)
  • GEMPATH settings

The config file itself is in "YAML" format. Here is an example:

gem:  --local --gen-rdoc --run-tests
rdoc: --inline-source --line-numbers
gempath:
 - /usr/local/rubygems
 - /home/gavin/.rubygems

The effects of such a config file would be:

  • gem only runs "local" operations (unless you specify --remote or --both on the command-line)
  • gem generates RDocs and runs unit tests every time it installs something (good idea!)
  • when it generates RDocs, the given arguments will be used
  • /usr/local/rubygems and /home/gavin/rubygems will be used as your $GEM_PATH setting
Jordan Running
  • 102,619
  • 17
  • 182
  • 182
the Tin Man
  • 158,662
  • 42
  • 215
  • 303
  • 5
    This doesn't actually answer the top-line question. Why does it appear that RDocs take much much longer to install than the actual code? – Jeremy Wadhams Apr 11 '12 at 20:55