Rubygemsでライブラリを公開したので、手順をまとめる。
October 10, 2014
前提
- gemspecは準備済み
流れ
1. rubygemsに会員登録
2. API KEYの登録
- hypermktの箇所は自分のユーザー名
$ curl -u hypermkt https://rubygems.org/api/v1/api_key.yaml > ~/.gem/credentials; chmod 0600 ~/.gem/credentials Enter host password for user ‘hypermkt’: % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 56 0 56 0 0 15 0 —:—:— 0:00:03 —:—:— 15
3.
rubygemsに push。これで完了!
$ bundle exec rake release animemap-api-ruby 0.0.1 built to pkg/animemap-api-ruby-0.0.1.gem. Tagged v0.0.1. Pushed git commits and tags. Pushed animemap-api-ruby 0.0.1 to rubygems.org.
地味にハマったエラー
- エラー文言の通りGemfileに
rakeを入れれば解決
$ bundle exec rake release
/Users/hypermkt/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/rubygems_integration.rb:252:in block in replace_gem': rake is not part of the bundle. Add it to Gemfile. (Gem::LoadError)
from /Users/hypermkt/.rbenv/versions/2.1.2/bin/rake:22:in