Documentation
¶
Overview ¶
Package rubygems exposes rubygems.org as a kit Domain.
A multi-domain host (ant) enables it with a single blank import:
import _ "github.com/tamnd/rubygems-cli/rubygems"
The same Domain also builds the standalone rubygems binary.
Package rubygems is the library behind the rubygems command line: the HTTP client, request shaping, and the typed data models for rubygems.org.
The Client paces requests, sets an honest User-Agent, and retries transient failures (429 and 5xx). No API key is required.
Index ¶
- Constants
- type Client
- func (c *Client) GemInfo(ctx context.Context, name string) (Gem, error)
- func (c *Client) ReverseDeps(ctx context.Context, name string, limit int) ([]ReverseDep, error)
- func (c *Client) Search(ctx context.Context, query string, limit int) ([]Gem, error)
- func (c *Client) Versions(ctx context.Context, name string, limit int) ([]Version, error)
- type Config
- type Domain
- type Gem
- type ReverseDep
- type Version
Constants ¶
const DefaultUserAgent = "rubygems/dev (+https://github.com/tamnd/rubygems-cli)"
DefaultUserAgent identifies the client to RubyGems.
const Host = "rubygems.org"
Host is the site this client talks to.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to RubyGems over HTTP.
func (*Client) ReverseDeps ¶ added in v0.1.1
ReverseDeps lists gems that depend on the given gem. The API returns a flat array of gem name strings; the client converts them to ReverseDep. limit clips the result; 0 means return all.
type Config ¶ added in v0.1.1
type Config struct {
BaseURL string
UserAgent string
Rate time.Duration
Timeout time.Duration
Retries int
}
Config holds all tunable parameters for the Client.
func DefaultConfig ¶ added in v0.1.1
func DefaultConfig() Config
DefaultConfig returns a Config with sensible defaults.
type Domain ¶
type Domain struct{}
Domain is the rubygems driver.
func (Domain) Info ¶
func (Domain) Info() kit.DomainInfo
Info describes the scheme, hostnames, and binary identity.
type Gem ¶ added in v0.1.1
type Gem struct {
Rank int `json:"rank"`
Name string `json:"name"`
Version string `json:"version"`
Downloads int64 `json:"downloads"`
Authors string `json:"authors"`
Info string `json:"info"`
HomepageURI string `json:"homepage_uri"`
SourceURI string `json:"source_uri"`
}
Gem is one Ruby gem record from rubygems.org.
type ReverseDep ¶ added in v0.1.1
ReverseDep is a gem that reverse-depends on the queried gem.