Ruby-on-rails .gemrc 文件规范

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4292443/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 23:43:12  来源:igfitidea点击:

.gemrc file specification

ruby-on-railsrubygems

提问by Thiago Diniz

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

我到处搜索以找到.gemrc文件规范,但没有成功。

Does anyone know where I can find it?

有谁知道我在哪里可以找到它?

采纳答案by lbz

gem looks for a configuration file .gemrcin your home directory, although you can specify another file on the command-line if you wish (with the --config-filemodifier).

gem.gemrc在您的主目录中查找配置文件,但您可以根据需要在命令行上指定另一个文件(使用--config-file修饰符)。

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_PATHsettings
  • 每次 gem 运行时使用的命令行参数
  • ''RDoc'' 的命令行选项(在生成文档时使用)
  • GEM_PATH设置

More at gem environment command doc.

更多在gem environment command doc

回答by ansorensen

'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:

“家”是一个 Linux/Mac 术语。指的是显示用户设置的文件夹。您可以通过执行以下操作找出您的设置目录的位置:

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

在 Unix/Linux 上,打开终端并键入以下命令:

echo $HOME

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

在 Windows 上,打开命令提示符并键入以下命令:

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').

对我来说(在 Windows 7 中),这是 C:\Users[name]。但是,看起来 Ruby 默认情况下不会在该文件夹中设置您的 .gemrc 。相反,您必须创建该文件。打开文本编辑器,复制您需要的 YAML 样式代码(文档),并将文件另存为 .gemrc 到您的主目录中(确保选择所有文件,而不是“.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.

这些设置只会影响该个人用户。但是,如果是您的个人计算机,您可能不需要更改所有用户的设置。

回答by bfaloona

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.

RubyGems 指南(在“ gem environment”下)提供了更新的 gemrc 规范。请注意,/etc/gemrc 适用于所有用户,而 ~/.gemrc 适用于个人。

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

如果键是 gem 命令(例如,install:),它指定要与该命令一起使用的参数。

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

回答by Jan Kyu Peblik

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

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

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

显然,您应该期望它在这一点上不断变化。