brewer

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2019 License: BSD-3-Clause Imports: 5 Imported by: 0

README

brewer

CLI app to update Homebrew formulae.

Installation

To get the most up to date binaries, check the releases for the pre-built binary for your system.

You can also go get to install from source.

go get -u github.com/tombell/brewer/cmd/brewer

Usage

Use the -h/--help flag to see all the available flags when running brewer.

You will need a GitHub API token when running brewer. It's advised you create a token specifically for brewer.

You can update four different parts of a formula with brewer.

  • the tag as part of the URL :tag => "..." with --tag
  • the revision as part of the URL :revision => "..." with --revision
  • the URL url "..." with --url
  • the SHA256 sha256 "..." with --sha256

The path in the repository to the formula to update is passed as the --formula flag.

You also have to specify the repository owner and name (the name defaults to homebrew-formulae if omitted).

The commit message, author, and author's email must be given for the commit that updates the formula.

brewer --token $GITHUB_TOKEN \
       --owner tombell \
       --name homebrew-formulae \
       --formula Formula/brewer.rb \
       --tag v1.0.0 \
       --revision beea04da6f030de641408ca265e31fb01e7dc22f \
       --commit-message "Update Formula/brewer.rb to v1.0.0" \
       --commit-author "Tom Bell" \
       --commit-email "tomb@tomb.io"

This will pull down Formula/brewer.rb from the repository, and update the tag and revision lines with v1.0.0 and beea04da6f030de641408ca265e31fb01e7dc22f. With the commit message Update Formula/brewer.rb to v1.0.0, by Tom Bell.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(config Config) error

Run performs the updating of the given Homebrew formula.

Types

type Config

type Config struct {
	Token string
	Owner string
	Repo  string

	Path     string
	Tag      string
	Revision string
	URL      string
	SHA256   string

	CommitMessage string
	CommitAuthor  string
	CommitEmail   string
}

Config represents the command line flags passed into the Run function.

type Formula

type Formula struct {
	Path     string
	Contents string
	FileSHA  string
}

Formula represents a Homebrew formula that can be updated.

func (*Formula) Revision

func (f *Formula) Revision() string

Revision returns the value for `:revision => "{{revision}}"` if the formula has one.

func (*Formula) SHA256

func (f *Formula) SHA256() string

SHA256 returns the value for the `sha256 "{{sha}}"` if the formula has one.

func (*Formula) Tag

func (f *Formula) Tag() string

Tag returns the value for `:tag => "{{tag}}"` if the formula has one.

func (*Formula) URL

func (f *Formula) URL() string

URL returns the value for `url "{{url}}"` if the formula has one.

func (*Formula) UpdateRevision

func (f *Formula) UpdateRevision(rev string) error

UpdateRevision updates the `:revision => "{{revision}}"` part of a formula.

func (*Formula) UpdateSHA256

func (f *Formula) UpdateSHA256(sha string) error

UpdateSHA256 updates the `sha256 "{{sha}}"` part of a formula.

func (*Formula) UpdateTag

func (f *Formula) UpdateTag(tag string) error

UpdateTag updates the `:tag => "{{tag}}"` part of a formula.

func (*Formula) UpdateURL

func (f *Formula) UpdateURL(url string) error

UpdateURL updates the `url "{{url}}"` part of a formula.

Directories

Path Synopsis
cmd
brewer command

Jump to

Keyboard shortcuts

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