Documentation
¶
Index ¶
- func MirrorNameFromURI(uri string) (name string)
- type CommandError
- type CommandRunner
- type Cron
- type CronFactory
- type DefaultCommandRunner
- func (m *DefaultCommandRunner) CreateMirror(uri string, dirPath string) CommandError
- func (m *DefaultCommandRunner) CreateTagArchive(tag string, dirPath string) CommandError
- func (m *DefaultCommandRunner) Exec(directory string, args ...string) (string, CommandError)
- func (m *DefaultCommandRunner) FetchPrune(directory string) CommandError
- func (m *DefaultCommandRunner) GetRemote(directory string) (string, CommandError)
- func (m *DefaultCommandRunner) LsRemoteTags(uri string) (string, CommandError)
- type Mirror
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MirrorNameFromURI ¶
MirrorNameFromURI Creates a Name from a Git uri. It will panic if the uri is not in the expected format.
Types ¶
type CommandError ¶
type CommandError interface {
gmm.ApplicationError
}
CommandError represents an error executing a Git command
type CommandRunner ¶
type CommandRunner interface {
GetRemote(directory string) (string, CommandError)
LsRemoteTags(uri string) (string, CommandError)
FetchPrune(directory string) CommandError
CreateMirror(uri string, dirPath string) CommandError
CreateTagArchive(tag string, dirPath string) CommandError
Exec(directory string, args ...string) (string, CommandError)
}
CommandRunner invokes the Git CLI
type Cron ¶
Cron represents a simplified cron job
func CreateUpdateCron ¶
func CreateUpdateCron(mirror *Mirror, interval string) (Cron, gmm.ApplicationError)
CreateUpdateCron creates a Cron that updates a mirror
type CronFactory ¶
type CronFactory func(mirror *Mirror, interval string) (Cron, gmm.ApplicationError)
CronFactory creates a new Cron
type DefaultCommandRunner ¶
type DefaultCommandRunner struct {
Fs util.FileSystemUtil
Executor util.CommandExecutor
}
DefaultCommandRunner is the default implementation of CommandRunner
func (*DefaultCommandRunner) CreateMirror ¶
func (m *DefaultCommandRunner) CreateMirror(uri string, dirPath string) CommandError
CreateMirror creates a Git mirror on the filesystem
func (*DefaultCommandRunner) CreateTagArchive ¶
func (m *DefaultCommandRunner) CreateTagArchive(tag string, dirPath string) CommandError
CreateTagArchive builds a ZIP file for a given tag
func (*DefaultCommandRunner) Exec ¶
func (m *DefaultCommandRunner) Exec(directory string, args ...string) (string, CommandError)
Exec executes "git" binary commands
func (*DefaultCommandRunner) FetchPrune ¶
func (m *DefaultCommandRunner) FetchPrune(directory string) CommandError
FetchPrune updates a local repository with the default remote
func (*DefaultCommandRunner) GetRemote ¶
func (m *DefaultCommandRunner) GetRemote(directory string) (string, CommandError)
GetRemote fetches the URI for the default remote at given path
func (*DefaultCommandRunner) LsRemoteTags ¶
func (m *DefaultCommandRunner) LsRemoteTags(uri string) (string, CommandError)
LsRemoteTags lists the tags in a remote repository
type Mirror ¶
Mirror represents a Git mirror
func NewMirror ¶
func NewMirror( uri string, baseDir string, updateInterval string, cmd CommandRunner, fs util.FileSystemUtil, updateCronFactory CronFactory, ) (*Mirror, gmm.ApplicationError)
NewMirror creates a new Mirror struct, cloning the remote in separate subroutine
func (*Mirror) AssertValidRemote ¶
func (m *Mirror) AssertValidRemote(uri string) gmm.ApplicationError
AssertValidRemote ensures the repository at uri can be chatted with
func (*Mirror) Destroy ¶
func (m *Mirror) Destroy() gmm.ApplicationError
Destroy removes local data and jobs
func (*Mirror) Update ¶
func (m *Mirror) Update() gmm.ApplicationError
Update updates the local mirror with the remote