是否有 .gemrc.local 或等效文件?

rai*_*inz 3 ruby rubygems

像许多人一样,我创建了一个点文件存储库,并尝试将非私有的位提取到各自的点文件中。我通常会.whatever.local加载一个文件(如果存在),该文件可能包含我不想签入存储库的信息。Rubygems 使用~/.gemrc文件,但我看不到一种将私人信息从中提取到单独文件中的方法。有谁知道如何做到这一点?

我特别想要sources.gemrc 文件的外部列表。

Eri*_*ton 5

我没有看到.local与 v2.4.6 等效的版本(最近的版本,但不是最后一个版本)。

不过,RubyGems 的源代码说明了一些与您想要实现的目标相关的内容。例如,在src/ruby-2.3.0/lib/rubygems/config_file.rb

##
# Gem::ConfigFile RubyGems options and gem command options from gemrc.
#
# gemrc is a YAML file that uses strings to match gem command arguments and
# symbols to match RubyGems options.
#
# Gem command arguments use a String key that matches the command name and
# +:sources+:: Sets Gem::sources
# +:verbose+:: See #verbose
#
# gemrc files may exist in various locations and are read and merged in
# the following order:
#
# - system wide (/etc/gemrc)
# - per user (~/.gemrc)
# - per environment (gemrc files listed in the GEMRC environment variable)
Run Code Online (Sandbox Code Playgroud)

因此,您GEMRC也可以使用环境变量来加载额外的私有文件。