是否有.gemrc.local或同等的?

时间:2016-01-27 21:51:06

标签: ruby rubygems

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

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

1 个答案:

答案 0 :(得分:2)

根据v2.4.6(最新版本,但不是最新版本),我没有看到等同于.local的内容。

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)

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

相关问题