开发者

.gemrc file specification

开发者 https://www.devze.com 2023-01-27 09:26 出处:网络
I searched everywhere to find the .gemrc file specification but I haven\'t succeed. Does anyone know where I can find it开发者_运维知识库?gem looks for a configuration file .gemrc in your home direct

I searched everywhere to find the .gemrc file specification but I haven't succeed.

Does anyone know where I can find it开发者_运维知识库?


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
  • command-line options for ’’RDoc’’ (used when generating documentation)
  • GEM_PATH settings

More at gem environment command doc.


'Home' is a Linux/Mac term. What is refers to is the folder where a user's settings appear. You can find out where your settings directory is by doing the following:

on Unix/Linux, open a terminal and type the following command:

echo $HOME

on Windows, open a command-prompt and type the following command:

echo %USERPROFILE%

For me (in Windows 7), this is C:\Users[name]. However, looks like Ruby doesn't set up your .gemrc in that folder by default. Instead, you have to create the file. Open a text editor, copy the YAML style code you need (documentation), and save the file as .gemrc in your home directory (make sure you select all files, not '.txt').

These settings will only affect that individual user. If it's your personal computer, however, you probably don't need to change the settings for all users.


An updated gemrc specification is available at RubyGems Guides (under 'gem environment'). Note that /etc/gemrc applies to all users, while ~/.gemrc applies to an individual.

If the key is a gem command (for example, install:), it specifies arguments to be used with that command.

Here are the other keys that can be specified:

:sources: A YAML array of remote gem repositories to install gems from
:verbose: Verbosity of the gem command.  false, true, and :really are the levels
:update_sources: Enable/disable automatic updating of repository metadata
:backtrace: Print backtrace when RubyGems encounters an error
:gempath: The paths in which to look for gems


All of the answers here at time of writing are wrong because the obnoxious website keeps changing. It is at this moment here:

https://guides.rubygems.org/command-reference/#gem-environment

Obviously you should expect it to change constantly at this point.

0

精彩评论

暂无评论...
验证码 换一张
取 消