Help us understand the problem. What is going on with this article?

rubygemsに登録するときにはspec.metadata['allowed_push_host']あたりを消しておこう

More than 5 years have passed since last update.

よっしゃ!bundle exec rake release だ!

なんだこのエラーは・・・。

$ bundle exec rake release                           
sample_gem 0.1.0 built to pkg/sample_gem-0.1.0.gem.
Tag v0.1.0 has already been created.
rake aborted!
ERROR:  "https://rubygems.org" is not allowed by the gemspec, which only allows "TODO: Set to 'http://mygemserver.com'"
Pushing gem to https://rubygems.org...

Tasks: TOP => release => release:rubygem_push
(See full trace by running task with --trace)

原因はなにか

これは誤ってオレオレgemをrubygems.orgにpushしないための設定が
$ bundle gem sample_gemした時に下記のように記述されているためです。

# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
# delete this section to allow pushing this gem to any host.$
if spec.respond_to?(:metadata)$
  spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
else
  raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
end

rubygems.orgの解説サイト

どんなホストにでもpushしていいならここのセクション消してねって書いてありますね!ここを消せばとりあえずrubygemsにpushできます。

tossh
よくいるいるめがね族。
http://bochibochibocchi0095.hatenablog.com/
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした