Documentation ¶
Overview ¶
Package repo deals with a Github repository of generators.
It provides functionality to store and update remote generators from a Github repository locally. It can track a Git branch, a tag, or a commit SHA1.
It uses the Github API and doesn't rely on Git.
Index ¶
- Constants
- type Repo
- func (r *Repo) Generate(name, dst string, opts *generator.Options, ref string) error
- func (r *Repo) GetState(ref string) (*State, error)
- func (r *Repo) GetStateOrCreate(ref string) (*State, error)
- func (r *Repo) List(ref string) ([]*generator.Definition, error)
- func (r *Repo) Update(ref string, force bool) (*State, bool, error)
- type State
Constants ¶
const ( // StatesDir is the name of the states directory. StatesDir = "states" // StateFile is the name of the state file. StateFile = "repo.json" // StateDirPerm is the file mode for a state directory. StateDirPerm = 0755 // StateFilePerm is the file mode for a state file. StateFilePerm = 0644 // SrcDir is the name of the directory where sources are stored. SrcDir = "src" // SrcPerm is the file mode for a state directory. SrcPerm = 0755 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Repo ¶
type Repo struct {
// contains filtered or unexported fields
}
Repo manages a Github repository.
func (*Repo) Generate ¶
Generate executes a generator by name. Ref can be a branch, a tag, or a commit SHA1.
func (*Repo) GetState ¶
GetState returns the state of the repository. Ref can be a branch, a tag, or a commit SHA1. If the repository does not exist locally, it returns nil.
func (*Repo) GetStateOrCreate ¶
GetStateOrCreate returns the state of the repository. If the repository does not exist locally, it creates it by calling Update(). Ref can be a branch, a tag, or a commit SHA1.
type State ¶
type State struct { // Owner is the Github username of the owner of the repository. Owner string `json:"owner"` // Repo is the name of the Github repository. Repo string `json:"repo"` // Ref is a branch, a tag, or a commit SHA1. Ref string `json:"ref"` // SHA1 is the commit SHA1 of the downloaded version. // It is used to check if an update is available on Github. SHA1 string `json:"sha1"` }
State describes a repository.