formula_updater_types

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: Apache-2.0 Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangePusher

type ChangePusher interface {
	// The error value may be ErrAlreadyUpdated if the repo has already been updated
	UpdateAndPush(
		ctx context.Context,
		version string,
		versionSha string,
		branchName string,
		commitMessage string,
		perPlatformShas *PerPlatformSha256,
		formulaOptions *FormulaOptions,
	) error
}

Update the formula text, and push that change to its destination There are two different implementations of this: 1. when WE own the repo, and 2. when we don't (often homebrew-core). The difference is that in case 2, we can't do a git pull -ff through the github API, so we need to clone and update

type FormulaOptions

type FormulaOptions struct {
	Name            string // Descriptive name to be used for logging and general identification
	FormulaName     string // proper formula name without file extension
	Path            string // repo relative path with file extension
	RepoOwner       string // repo owner for Formula change
	RepoName        string // repo name for Formula change
	PRRepoOwner     string // optional, empty means use RepoOwner
	PRRepoName      string // optional, empty means use RepoName
	PRBranch        string // optional, default to master
	PRDescription   string
	PRCommitName    string
	PRCommitEmail   string
	VersionRegex    string
	VersionShaRegex string
	DarwinShaRegex  string
	LinuxShaRegex   string
	WindowsShaRegex string

	// If true, open a PR even if this version is something other than a stable version. For example, "x.y.z-beta1"
	// Note that per https://docs.brew.sh/Acceptable-Formulae#stable-versions, this is not allowed for homebrew-core
	PublishUnstableVersion bool
	DryRun                 bool
}

type FormulaStatus

type FormulaStatus struct {
	Name    string
	Updated bool
	Err     error
}

type GitClient

type GitClient interface {
	// a `ref string` is a fully qualified git ref name, like `refs/tags/1.3.0`
	GetRefSha(ctx context.Context, owner string, repo string, ref string) (string, error)

	GetReleaseAssetsByTag(ctx context.Context, owner, repo, version string) ([]ReleaseAsset, error)

	// Optionally create a pull request. We may avoid opening the PR if dry run is enabled.
	// This method will no-op and return nil if the version is a non-stable release version, and publishing non-stable versions has been disabled in the FormulaOptions
	// Expects the version string without the leading "v"
	CreatePullRequest(
		ctx context.Context,
		formulaOptions *FormulaOptions,
		commitMessage string,
		branchName string,
	) error
}

look up git metadata; the source can be from GitHub

type PerPlatformSha256

type PerPlatformSha256 struct {
	DarwinSha  string // sha256 for <ctl>-darwin binary
	LinuxSha   string // sha256 for <ctl>-linux binary
	WindowsSha string // sha256 for <ctl>-windows binary
}

type ReleaseAsset

type ReleaseAsset struct {
	Name               string
	BrowserDownloadUrl string
}

type RemoteShaGetter

type RemoteShaGetter interface {
	// reach out to a URL and download the sha metadata there;
	// expected to be formatted like `<sha> <filename>`
	GetShaFromUrl(url string) (sha string, err error)
}

Directories

Path Synopsis
Package mock_formula_updater_types is a generated GoMock package.
Package mock_formula_updater_types is a generated GoMock package.

Jump to

Keyboard shortcuts

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