gem

package
v0.6.11 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultRubyVersion   = "3.2"
	DefaultBaseURIFormat = "https://rubygems.org/api/v1/gems/%s.json"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GemContext

type GemContext struct {
	// RubyVersion is the version of ruby used when generating melange files.
	RubyVersion string

	// OutDir is the output directory for the generated melange files.
	OutDir string

	// BaseURIFormat is the base URI which should contain a %s for the
	// package name.
	BaseURIFormat string

	// AdditionalRepositories contains any additional apk repos to add
	// to the manifest.
	AdditionalRepositories []string

	// AdditionalKeyrings contains any additional apk keys to add
	// to the manifest.
	AdditionalKeyrings []string

	// Client is a rate limited client used to make http calls
	Client *rlhttp.RLHTTPClient

	// ToGenerate is the map of dependencies that have been visited when the
	// transitive dependency list is being calculated.
	ToGenerate map[string]GemMeta

	// ToCheck is the list of dependencies that have yet to be checked for
	// transitive dependencies.
	ToCheck []string
}

GemContext is the execution context for the gem subcommand.

func New

func New() (GemContext, error)

New initialises a new GemContext.

TODO: Add a check for ruby-* packages in wolfios once the name has been \
	standardised. Otherwise, we risk skipping ruby packages if the apk \
	exists but is not actually a ruby gem.

func (*GemContext) Generate

func (c *GemContext) Generate(ctx context.Context, packageName string) error

Generate is the entrypoint to generate a ruby gem melange file. It handles recursively finding all dependencies for a gem and generating a melange file for each.

type GemMeta

type GemMeta struct {
	Name          string              `json:"name"`
	Version       string              `json:"version"`
	Info          string              `json:"info"`
	Licenses      []string            `json:"licenses"`
	SourceCodeURI string              `json:"source_code_uri"`
	HomepageURI   string              `json:"homepage_uri"`
	Dependencies  GemMetaDependencies `json:"dependencies"`

	// RepoURI is not a part of the gem metadata returned by rubygems.org,
	// however it is intended to be the source of truth for the repository
	// URI since some gems use HomepageURI and some use SourceCodeURI.
	RepoURI string `json:"-"`
}

GemMeta is the json response from rubygems.org

type GemMetaDependencies

type GemMetaDependencies struct {
	Runtime []GemMetaDependency `json:"runtime"`
}

type GemMetaDependency

type GemMetaDependency struct {
	Name         string `json:"name"`
	Requirements string `json:"requirements"`
}

Jump to

Keyboard shortcuts

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