Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateHasDriver ¶
func ValidateHasDriver() error
ValidateHasDriver returns an error if there is no code hosting driver
Types ¶
type CodeHostingDriver ¶
type CodeHostingDriver interface {
// CanBeUsed returns whether this driver can manage
// a repository with the given hostname
CanBeUsed(driverType string) bool
// CanMergePullRequest returns whether or not MergePullRequest should be
// called when shipping. If true, also returns the default commit message
CanMergePullRequest(branch, parentBranch string) (bool, string, error)
// GetNewPullRequestURL returns the URL of the page
// to create a new pull request online
GetNewPullRequestURL(branch, parentBranch string) string
// MergePullRequest merges the pull request through the hosting service api
MergePullRequest(MergePullRequestOptions) (string, error)
// GetRepositoryURL returns the URL where the given repository
// can be found online
GetRepositoryURL() string
// HostingServiceName returns the name of the code hosting service
HostingServiceName() string
// SetOriginURL configures the driver with the origin URL of the Git repo
SetOriginURL(originURL string)
// SetOriginHostname configures the driver with the origin hostname of the Git repo
SetOriginHostname(originHostname string)
// GetAPITokenKey returns the git config key value that the API token is stored under
GetAPITokenKey() string
// SetAPIToken configures the driver with API token
SetAPIToken(apiToken string)
}
CodeHostingDriver defines the structure of drivers for the different code hosting services
func GetActiveDriver ¶
func GetActiveDriver() CodeHostingDriver
GetActiveDriver returns the code hosting driver to use based on the git config
func GetDriver ¶
func GetDriver(driverOptions DriverOptions) CodeHostingDriver
GetDriver returns the code hosting driver to use based on given origin url
type DriverOptions ¶
DriverOptions is the options passed to GetDriver
type MergePullRequestOptions ¶
type MergePullRequestOptions struct {
Branch string
CommitMessage string
LogRequests bool
ParentBranch string
}
MergePullRequestOptions defines the options to the MergePullRequest function
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry collects and manages all CodeHostingDriver instances
func (*Registry) DetermineActiveDriver ¶
func (r *Registry) DetermineActiveDriver(driverOptions DriverOptions) CodeHostingDriver
DetermineActiveDriver determines the driver to use for the given hostname
func (*Registry) DriverNames ¶
DriverNames returns the names of all drivers, sorted alphabetically
func (*Registry) RegisterDriver ¶
func (r *Registry) RegisterDriver(driver CodeHostingDriver)
RegisterDriver allows driver implementations to register themselves with the registry
type UnsupportedHostingServiceError ¶
type UnsupportedHostingServiceError struct {
// contains filtered or unexported fields
}
UnsupportedHostingServiceError represents the error condition when no suitable hosting service is found in the respective Registry
func (UnsupportedHostingServiceError) Error ¶
func (e UnsupportedHostingServiceError) Error() string