使用 RubyGems CLI 将包上传到 Gemfury 无提示失败

Uploading packages to Gemfury using RubyGems CLI silently failing

我正尝试按照 here 所述使用 RubyGems 将包上传到 Gemfury。以下命令失败且没有错误消息:

$ gem push fizzbuzz-0.1.8.gem --key fury_push_token --host https://push.fury.io/dlresende/
Pushing gem to https://push.fury.io/dlresende/...

$ echo $?
1

启用 debugbacktrace 会显示一个似乎与上传本身无关的错误:

$ gem push fizzbuzz-0.1.8.gem --key fury_push_token --host https://push.fury.io/dlresende/ --debug --backtrace
NOTE:  Debugging mode prints all exceptions even when rescued
Exception `Errno::EEXIST' at /Users/dlresende/.rbenv/versions/2.7.1/lib/ruby/2.7.0/fileutils.rb:250 - File exists @ dir_s_mkdir - /Users/dlresende/.gem/specs/rubygems.org%443
Pushing gem to https://push.fury.io/dlresende/...

$ echo $?
1

原来是URL问题...

启用 verbose 在 URL 中显示了一个额外的 /,这似乎是导致问题的原因:

$ gem push fizzbuzz-0.1.8.gem --key fury_push_token --host https://push.fury.io/dlresende/ --debug --backtrace --verbose
NOTE:  Debugging mode prints all exceptions even when rescued
Exception `Errno::EEXIST' at /Users/dlresende/.rbenv/versions/2.7.1/lib/ruby/2.7.0/fileutils.rb:250 - File exists @ dir_s_mkdir - /Users/dlresende/.gem/specs/rubygems.org%443
GET https://rubygems.org/latest_specs.4.8.gz
304 Not Modified
Pushing gem to https://push.fury.io/dlresende/...
POST https://push.fury.io/dlresende//api/v1/gems
301 Moved Permanently

$ echo $?
1

使用 https://push.fury.io/dlresende 而不是 https://push.fury.io/dlresende/(最后没有 /,与 docs 中描述的相反)解决了问题:

$ gem push fizzbuzz-0.1.8.gem --key fury_push_token --host https://push.fury.io/dlresende --debug --backtrace --verbose
NOTE:  Debugging mode prints all exceptions even when rescued
Exception `Errno::EEXIST' at /Users/dlresende/.rbenv/versions/2.7.1/lib/ruby/2.7.0/fileutils.rb:250 - File exists @ dir_s_mkdir - /Users/dlresende/.gem/specs/rubygems.org%443
GET https://rubygems.org/latest_specs.4.8.gz
304 Not Modified
Pushing gem to https://push.fury.io/dlresende...
POST https://push.fury.io/dlresende/api/v1/gems
200 OK
~~> Processing package upload
    Uploading            ... ok
$ echo $?
0