gems

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxGemBytes = 256 << 20
)
View Source
const MaxIndexBytes = 32 << 20

Variables

This section is empty.

Functions

func CompactInfo

func CompactInfo(name string, packages []Package) []byte

func CompactNames

func CompactNames(packages []Package) []byte

func CompactVersions

func CompactVersions(packages []Package) []byte

func CompareVersions

func CompareVersions(a, b string) int

CompareVersions compares the numeric and prerelease parts used by RubyGems. A release ranks above a prerelease at the same numeric version.

func DerivedPath

func DerivedPath(p string) bool

func Filename

func Filename(p Package) string

func Files

func Files(ctx context.Context, st store.Store, c repo.Config) ([]types.Item, error)

func GzipMarshal

func GzipMarshal(v any) ([]byte, error)

func InfoMD5

func InfoMD5(body []byte) string

InfoMD5 is the Compact Index's required cache validator, not an integrity digest.

func Marshal

func Marshal(
	v any,
) []byte

func ParseCompactVersions

func ParseCompactVersions(b []byte) (map[string]CompactVersionEntry, error)

ParseCompactVersions accepts only bounded, complete index rows. The MD5 is checked against each info file before virtual metadata can disclose it.

func QuickSpec

func QuickSpec(p Package, at time.Time) ([]byte, error)

func Serves

func Serves(t repo.PackageType) bool

func Specs

func Specs(packages []Package, latest, prerelease bool) ([]byte, error)

func ValidName

func ValidName(name string) bool

func ValidPath

func ValidPath(path string) bool

func ValidVersion

func ValidVersion(version string) bool

func VersionToken

func VersionToken(p Package) string

Types

type CompactVersionEntry

type CompactVersionEntry struct {
	MD5      string
	Versions map[string]bool
}

CompactVersionEntry binds the listed versions to their compact info body.

type Dependency

type Dependency struct {
	Name        string `json:"name"`
	Requirement string `json:"requirements"`
}

type Handler

type Handler struct{ generic.Handler }

func (Handler) Admit

func (Handler) Admit(
	ctx context.Context,
	env format.Env,
	c repo.Config,
	w format.Write,
) (format.Write, error)

func (Handler) Classify

func (Handler) Classify(_ repo.Config, p string) format.Class

func (Handler) Deployed

func (Handler) Deployed(ctx context.Context, env format.Env, c repo.Config, it types.Item) error

func (Handler) Inspect

func (Handler) Inspect(
	ctx context.Context,
	env format.Env,
	_ repo.Config,
	w format.Write,
) (any, error)

func (Handler) Reindex

func (Handler) Reindex(ctx context.Context, env format.Env, c repo.Config) error

type Package

type Package struct {
	Name         string       `json:"name"`
	Version      string       `json:"version"`
	Platform     string       `json:"platform"`
	Summary      string       `json:"summary"`
	Description  string       `json:"description"`
	Homepage     string       `json:"homepage"`
	Authors      []string     `json:"authors"`
	Licenses     []string     `json:"licenses"`
	Ruby         string       `json:"ruby"`
	RubyGems     string       `json:"rubygems"`
	Dependencies []Dependency `json:"dependencies"`
	Path         string       `json:"path"`
	SHA256       string       `json:"sha256"`
}

func ParseCompactInfo

func ParseCompactInfo(name string, b []byte) ([]Package, error)

func Read

func Read(ctx context.Context, r io.Reader, size int64, path string) (Package, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL