LoginSignup
25
17

More than 5 years have passed since last update.

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

Posted at

よっしゃ!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できます。

25
17
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
25
17