gitwatch

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package gitwatch provides a simple tool to first clone a set of git repositories to a local directory and then periodically check them all for any updates.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRepoPath

func GetRepoPath(cache, repo string) (path string, err error)

GetRepoPath returns the local path of a cached repo from the given cache

Types

type Event

type Event struct {
	URL       string
	Path      string
	Timestamp time.Time
}

Event represents an update detected on one of the watched repositories

type Session

type Session struct {
	Repositories []string      // list of local or remote repository URLs to watch
	Interval     time.Duration // the interval between remote checks
	Directory    string        // the directory to store repositories
	InitialEvent bool          // if true, an event for each repo will be emitted upon construction
	InitialDone  chan struct{} // if InitialEvent true, this is pushed to after initial setup done
	Events       chan Event    // when a change is detected, events are pushed here
	// contains filtered or unexported fields
}

Session represents a git watch session configuration

func New

func New(
	ctx context.Context,
	repos []string,
	interval time.Duration,
	dir string,
	initialEvent bool,
) (session *Session, err error)

New constructs a new git watch session on the given repositories

func (*Session) Close

func (s *Session) Close()

Close gracefully shuts down the git watcher

func (*Session) Run

func (s *Session) Run() (err error)

Run begins the watcher and blocks until an error occurs

Jump to

Keyboard shortcuts

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