Documentation ¶
Index ¶
Constants ¶
const ( // GitHub the name used in a Uses Git URI to reference a git server GitHub = "github" // Lighthouse the name used in a Uses Git URI to reference the git server lighthouse is configured to run against Lighthouse = "lighthouse" // GitHubURL the github server URL GitHubURL = "https://github.com" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FetchCache ¶ added in v1.1.13
type FetchCache interface { // ShouldFetch returns true if we should fetch for the given owner, repo and ref ShouldFetch(fullName, ref string) bool }
FetchCache whether or not we should fetch the given repo ref we only need to fetch a given repo ref once per webhook request
func NewFetchCache ¶ added in v1.1.13
func NewFetchCache() FetchCache
NewFetchCache creates a default fetch cache
type FileBrowsers ¶ added in v0.0.920
type FileBrowsers struct {
// contains filtered or unexported fields
}
FileBrowsers contains the file browsers for the supported git servers
func NewFileBrowsers ¶ added in v0.0.920
func NewFileBrowsers(serverURL string, fb Interface) (*FileBrowsers, error)
NewFileBrowsers creates a new file browsers service for the lighthouse git server URL and file browser if the current server URL is not github.com then creates a second file browser so that we can use the uses: Git URI syntax for accessing github resources as well as to access the lighthouse git server too
func (*FileBrowsers) GetFileBrowser ¶ added in v0.0.920
func (f *FileBrowsers) GetFileBrowser(name string) Interface
GetFileBrowser returns the file browser for the given git server name.
func (*FileBrowsers) GitHubFileBrowser ¶ added in v0.0.920
func (f *FileBrowsers) GitHubFileBrowser() Interface
GitHubFileBrowser returns a git file browser for github.com
func (*FileBrowsers) LighthouseGitFileBrowser ¶ added in v0.0.920
func (f *FileBrowsers) LighthouseGitFileBrowser() Interface
LighthouseGitFileBrowser returns the git file browser for the git server that lighthouse is configured against
type Interface ¶
type Interface interface { // GetMainAndCurrentBranchRefs returns the main branch then the ref value if its different GetMainAndCurrentBranchRefs(owner, repo, ref string) ([]string, error) // GetFile returns a file from the given path in the repository with the given sha GetFile(owner, repo, path, ref string, fc FetchCache) ([]byte, error) // ListFiles returns the file and directory entries in the given path in the repository with the given sha ListFiles(owner, repo, path, ref string, fc FetchCache) ([]*scm.FileEntry, error) // WithDir processes the given repository and reference at the given directory WithDir(owner, repo, ref string, fc FetchCache, f func(dir string) error) error }
Interface an interface to represent browsing files in a repository
func NewFileBrowserFromGitClient ¶
func NewFileBrowserFromGitClient(clientFactory git.ClientFactory) Interface
NewFileBrowserFromGitClient creates a new file browser from an Scm client