Documentation ¶
Index ¶
- Variables
- func ByBranch(a, b *Repository) bool
- func ByName(a, b *Repository) bool
- func ByType(a, b *Repository) bool
- func NoFilter(r *Repository) bool
- type By
- type Filter
- type Manager
- func (m *Manager) AddRepository(name string, t RepositoryType) (*Repository, error)
- func (m *Manager) EnsureAll(ctx context.Context) error
- func (m *Manager) EnsureClone(ctx context.Context, repo *Repository) error
- func (m *Manager) EnsureFork(ctx context.Context, repo *Repository) error
- func (m *Manager) EnsureRemotes(ctx context.Context, repo *Repository) error
- func (m *Manager) EnsureRepository(ctx context.Context, name string) error
- func (m *Manager) List(filters ...Filter) []*Repository
- func (m *Manager) LoadAll() error
- func (m *Manager) LoadRepository(name string, t RepositoryType) (*Repository, error)
- type Repository
- type RepositoryType
Constants ¶
This section is empty.
Variables ¶
var ( ErrMalformatedFilterExpression error = errors.New("malformated filter expression") ErrUnknownFilterKey error = errors.New("unknown filter key") )
var ( ErrUnauthenticated error = errors.New("unauthenticated") ErrUnconfiguredRepository error = errors.New("unconfigured repository") ErrRepositoryNotCached error = errors.New("repository not cached") ErrRepositoryDoesntExist error = errors.New("repository doesnt exist") ErrRepositoryAlreadyExist error = errors.New("repository already exist") )
Functions ¶
Types ¶
type By ¶
type By func(a, b *Repository) bool
By can sort two Repositories
func (By) Sort ¶
func (by By) Sort(subject []*Repository)
Sort does an in-place sort of the supplied repositories
type Filter ¶
type Filter func(r *Repository) bool
A Filter is a prototype for a function that can be used to filter the results from a call to the List() method on the Manager.
func BranchFilter ¶
BranchFilter filters all repositories whose current branch matches the given branch name.
func BuildFilters ¶
BuildFilters takes an expression string and returns a list of Filter functions. Example: "branch=main type=controller"
func NameFilter ¶
NameFilter filters all repositories whose names matches the specified name
func NamePrefixFilter ¶
NamePrefixFilter filters all repositories whose name prefix matches the the given namePrefix
func TypeFilter ¶
TypeFilter filters a repository by a name prefix The only two possible types are 'controller' and 'core'
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is reponsible of managing local ACK local repositories and github forks.
func NewManager ¶
NewManager create a new manager.
func (*Manager) AddRepository ¶
func (m *Manager) AddRepository(name string, t RepositoryType) (*Repository, error)
AddRepository creates a new Repository object and adds it to the cache.
func (*Manager) EnsureClone ¶
func (m *Manager) EnsureClone(ctx context.Context, repo *Repository) error
func (*Manager) EnsureFork ¶
func (m *Manager) EnsureFork(ctx context.Context, repo *Repository) error
ensureFork ensures that your github account have a fork for a given ACK project. It will also rename the project if it's not following the standard: $ackprefix-$projectname
func (*Manager) EnsureRemotes ¶
func (m *Manager) EnsureRemotes(ctx context.Context, repo *Repository) error
EnsureRemotes ensures that the local repositories have both origin and upstream remotes setup and point to the correct URLs.
func (*Manager) EnsureRepository ¶
EnsureRepository ensures the current user owns a fork of the given repository and has cloned it.
func (*Manager) List ¶
func (m *Manager) List(filters ...Filter) []*Repository
List returns the list of all the cached repositories
func (*Manager) LoadAll ¶
LoadAll parses the configuration and loads informations about local repositories if they are found.
func (*Manager) LoadRepository ¶
func (m *Manager) LoadRepository(name string, t RepositoryType) (*Repository, error)
LoadRepository loads information about a single local repository
type Repository ¶
type Repository struct { // Name of the ACK upstream repo Name string // Repository Type Type RepositoryType // Expected fork name. Generally looking like ack-sagemaker ExpectedForkName string // Expected local full path FullPath string // Git HEAD commit or current branch GitHead string // contains filtered or unexported fields }
Repository represents an ACK project repository.
func NewRepository ¶
func NewRepository(name string, repoType RepositoryType) *Repository
NewRepository returns a pointer to a new repository.
type RepositoryType ¶
type RepositoryType int
const ( RepositoryTypeCore RepositoryType = iota RepositoryTypeTooling RepositoryTypeController RepositoryTypeUnknown )
func GetRepositoryTypeFromString ¶
func GetRepositoryTypeFromString(s string) RepositoryType
GetRepositoryTypeFromString casts a string to a RepositoryType
func (RepositoryType) String ¶
func (rt RepositoryType) String() string
String stringifies a Repository type