gpt4 book ai didi

ruby-on-rails - gemspec 不允许 "https://rubygems.org",它只允许 "' http ://rubygems. org '"

转载 作者:行者123 更新时间:2023-12-02 21:00:38 29 4
gpt4 key购买 nike

我正在尝试编译我的第一个 gem 并将其推送到 ruby​​gems.org。它不断抛出错误,说我无法推送到 https://rubygems.org :

gem build simplesms.gemspec 
WARNING: licenses is empty, but is recommended. Use a license identifier from
http://spdx.org/licenses or 'Nonstandard' for a nonstandard license.
WARNING: no homepage specified
WARNING: See http://guides.rubygems.org/specification-reference/ for help
Successfully built RubyGem
Name: simplesms
Version: 0.1.0
File: simplesms-0.1.0.gem
Toms-MacBook-Pro-2:simplesms t$ gem push simplesms-0.1.0.gem
Pushing gem to https://rubygems.org...
ERROR: "https://rubygems.org" is not allowed by the gemspec, which only allows "'http://rubygems.org'"

但在我的规范中:

# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'simplesms/version'

Gem::Specification.new do |spec|
spec.name = "simplesms"
spec.version = Simplesms::VERSION
spec.authors = ["Tom"]
spec.email = ["tom@example.com"]

spec.summary = %q{Easily add sms to your project by integrating the Simple SMS Heroku Addon into your app.}
spec.homepage = ""

# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
# to allow pushing to a single host or delete this section to allow pushing to any host.
if spec.respond_to?(:metadata)
spec.metadata['allowed_push_host'] = "'http://rubygems.org'"
else
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
end

spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.add_development_dependency "bundler", "~> 1.12"
spec.add_development_dependency "rake", "~> 10.0"
end

在 gemfile 中:

source 'http://rubygems.org'

# Specify your gem's dependencies in simplesms.gemspec
gemspec

只是为了好玩,我还尝试将它们设置为“https://rubygems.org” ',但是它仍然会引发相同的错误。

知道我需要做什么才能将其推送到 ruby​​gems.org 吗?我已经使用我的电子邮件/密码登录并确认凭据位于 ~/.gem/credentials

最佳答案

这一行:

spec.metadata['allowed_push_host'] = "'http://rubygems.org'"

您正在将 allowed_push_host 设置为 'http://rubygems.org'。它应该只是 http://rubygems.org(没有单引号)。将其更改为:

spec.metadata['allowed_push_host'] = "http://rubygems.org"

改为允许 https://rubygems.org 应该是安全的(并且是首选)。

关于ruby-on-rails - gemspec 不允许 "https://rubygems.org",它只允许 "' http ://rubygems. org '",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38493820/

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