drivers

package
v4.2.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2017 License: MIT Imports: 11 Imported by: 0

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() bool

	// CanMergePullRequest returns whether or not MergePullRequest should be
	// called when shipping
	CanMergePullRequest(branch, parentBranch string) (bool, 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)

	// 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(originURL string) CodeHostingDriver

GetDriver returns the code hosting driver to use based on given origin url

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(originURL string) CodeHostingDriver

DetermineActiveDriver determines the driver to use for the given hostname

func (*Registry) DriverNames

func (r *Registry) DriverNames() (result []string)

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

Jump to

Keyboard shortcuts

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