use github rubygems registry
mouse 1323 · person cloud · link
Last update
2023-11-22
2023
11-22
«free rubygems repository with github
using personal access token»

Working with the RubyGems registry

  • generate a personal access token and grant it repo permissions (replace MY_GITHUB_TOKEN with its content)

  • cat ~/.gem/credentials

    1
    2
    ---
    :github: Bearer MY_GITHUB_TOKEN
    
  • cat .bundle/config

    Note: replace any - with ___.

    1
    2
    ---
    BUNDLE_HTTPS://RUBYGEMS__PKG__GITHUB__COM/ACAVALIN/: "acavalin:MY_GITHUB_TOKEN"
    
  • cat .gemrc

    1
    2
    3
    4
    5
    6
    7
    8
    gem: --no-document
    backtrace: false
    bulk_threshold: 1000
    sources:
    - https://rubygems.org/
    - https://acavalin:MY_GITHUB_TOKEN@rubygems.pkg.github.com/acavalin/
    update_sources: true
    verbose: true
    
  • build the gem, examples:

    • gem build name.gemspec
    • rake --tasks ; rake build
  • push gem to registry

    1
    gem push --key github --host https://rubygems.pkg.github.com/acavalin name-0.0.1.gem
    
  • use gem in project

    • Gemfile: gem "name "0.0.1", source: "https://rubygems.pkg.github.com/acavalin"
    • cmdline: gem install --clear-sources --source https://acavalin:MY_GITHUB_TOKEN@rubygems.pkg.github.com/acavalin deluge-rpc