gpt4 book ai didi

ruby - 防止 gem 推送到 RubyGems

转载 作者:数据小太阳 更新时间:2023-10-29 06:36:55 25 4
gpt4 key购买 nike

NPM 有能力阻止 gem 被发布。有没有办法做同样的事情并防止 gem 被意外发布到 ruby​​gems?

最佳答案

RubyGems 2.2.0最近才发布,增加了对此的支持。您需要将 allowed_push_host 设置为您自己的 gem 服务器。 documentation如此描述:

If you want to control who can install a gem, or directly track the activity surrounding a gem, then you’ll want to set up a private gem server. You can set up your own gem server or use a commercial service such as Gemfury.

RubyGems 2.2.0 and newer support the allowed_push_host metadata value to restrict gem pushes to a single host. If you are publishing private gems you should set this value to prevent accidental pushes to rubygems.org:

Gem::Specification.new 'my_gem', '1.0' do |s|
# ...
s.metadata['allowed_push_host'] = 'https://gems.my-company.example'
end

要升级 RubyGems,只需运行以下命令:

gem update --system

关于ruby - 防止 gem 推送到 RubyGems,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17157355/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com