github

package
v2.2.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2015 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GitHubHost    string = "github.com"
	GitHubApiHost string = "api.github.com"
	UserAgent     string = "Hub"
	OAuthAppURL   string = "http://hub.github.com/"
)

Variables

View Source
var (
	GitHubHostEnv = os.Getenv("GITHUB_HOST")
)
View Source
var (
	OriginNamesInLookupOrder = []string{"upstream", "github", "origin"}
)

Functions

func CaptureCrash

func CaptureCrash()

func DefaultGitHubHost

func DefaultGitHubHost() string

func FormatError

func FormatError(action string, err error) (ee error)

func IsHttpsProtocol

func IsHttpsProtocol() bool

Types

type AuthError

type AuthError struct {
	Err error
}

func (*AuthError) Error

func (e *AuthError) Error() string

func (*AuthError) IsDuplicatedTokenError

func (e *AuthError) IsDuplicatedTokenError() bool

func (*AuthError) IsRequired2FACodeError

func (e *AuthError) IsRequired2FACodeError() bool

type Branch

type Branch struct {
	Repo *GitHubRepo
	Name string
}

func (*Branch) IsMaster

func (b *Branch) IsMaster() bool

func (*Branch) IsRemote

func (b *Branch) IsRemote() bool

func (*Branch) LongName

func (b *Branch) LongName() string

func (*Branch) PushTarget

func (b *Branch) PushTarget(owner string, preferUpstream bool) (branch *Branch)

func (*Branch) RemoteName

func (b *Branch) RemoteName() string

func (*Branch) ShortName

func (b *Branch) ShortName() string

func (*Branch) Upstream

func (b *Branch) Upstream() (u *Branch, err error)

type Client

type Client struct {
	Host *Host
}

func NewClient

func NewClient(h string) *Client

func NewClientWithHost

func NewClientWithHost(host *Host) *Client

func (*Client) CIStatus

func (client *Client) CIStatus(project *Project, sha string) (status *octokit.Status, err error)

func (*Client) CommitPatch

func (client *Client) CommitPatch(project *Project, sha string) (patch io.ReadCloser, err error)

func (*Client) CreateIssue

func (client *Client) CreateIssue(project *Project, title, body string, labels []string) (issue *octokit.Issue, err error)

func (*Client) CreatePullRequest

func (client *Client) CreatePullRequest(project *Project, base, head, title, body string) (pr *octokit.PullRequest, err error)

func (*Client) CreatePullRequestForIssue

func (client *Client) CreatePullRequestForIssue(project *Project, base, head, issue string) (pr *octokit.PullRequest, err error)

func (*Client) CreateRelease

func (client *Client) CreateRelease(project *Project, params octokit.ReleaseParams) (release *octokit.Release, err error)

func (*Client) CreateRepository

func (client *Client) CreateRepository(project *Project, description, homepage string, isPrivate bool) (repo *octokit.Repository, err error)

func (*Client) CurrentUser

func (client *Client) CurrentUser() (user *octokit.User, err error)

func (*Client) FindOrCreateToken

func (client *Client) FindOrCreateToken(user, password, twoFactorCode string) (token string, err error)

func (*Client) ForkRepository

func (client *Client) ForkRepository(project *Project) (repo *octokit.Repository, err error)

func (*Client) GhLatestTagName

func (client *Client) GhLatestTagName() (tagName string, err error)

func (*Client) GistPatch

func (client *Client) GistPatch(id string) (patch io.ReadCloser, err error)

func (*Client) IsRepositoryExist

func (client *Client) IsRepositoryExist(project *Project) bool

func (*Client) Issues

func (client *Client) Issues(project *Project) (issues []octokit.Issue, err error)

func (*Client) PullRequest

func (client *Client) PullRequest(project *Project, id string) (pr *octokit.PullRequest, err error)

func (*Client) PullRequestPatch

func (client *Client) PullRequestPatch(project *Project, id string) (patch io.ReadCloser, err error)

func (*Client) Release

func (client *Client) Release(project *Project, tagName string) (release *octokit.Release, err error)

func (*Client) Releases

func (client *Client) Releases(project *Project) (releases []octokit.Release, err error)

func (*Client) Repository

func (client *Client) Repository(project *Project) (repo *octokit.Repository, err error)

func (*Client) UploadReleaseAsset

func (client *Client) UploadReleaseAsset(uploadUrl *url.URL, asset *os.File, contentType string) (err error)

type Config

type Config struct {
	Hosts []Host `toml:"hosts"`
}

func CreateTestConfigs

func CreateTestConfigs(user, token string) *Config

Public for testing purpose

func CurrentConfig

func CurrentConfig() *Config

func (*Config) DefaultHost

func (c *Config) DefaultHost() (host *Host, err error)

func (*Config) Find

func (c *Config) Find(host string) *Host

func (*Config) PromptForHost

func (c *Config) PromptForHost(host string) (h *Host, err error)

func (*Config) PromptForOTP

func (c *Config) PromptForOTP() string

func (*Config) PromptForPassword

func (c *Config) PromptForPassword(host, user string) (pass string)

func (*Config) PromptForUser

func (c *Config) PromptForUser(host string) (user string)

type Editor

type Editor struct {
	Program string
	Topic   string
	File    string
	Message string
	CS      string
	// contains filtered or unexported fields
}

func NewEditor

func NewEditor(filePrefix, topic, message string) (editor *Editor, err error)

func (*Editor) DeleteFile

func (e *Editor) DeleteFile() error

func (*Editor) EditTitleAndBody

func (e *Editor) EditTitleAndBody() (title, body string, err error)

type GitHubHosts

type GitHubHosts []string

func (GitHubHosts) Include

func (h GitHubHosts) Include(host string) bool

type GitHubRepo

type GitHubRepo struct {
	// contains filtered or unexported fields
}

func LocalRepo

func LocalRepo() (repo *GitHubRepo, err error)

func (*GitHubRepo) CurrentBranch

func (r *GitHubRepo) CurrentBranch() (branch *Branch, err error)

func (*GitHubRepo) CurrentProject

func (r *GitHubRepo) CurrentProject() (project *Project, err error)

func (*GitHubRepo) MainProject

func (r *GitHubRepo) MainProject() (project *Project, err error)

func (*GitHubRepo) MasterBranch

func (r *GitHubRepo) MasterBranch() (branch *Branch)

func (*GitHubRepo) OriginRemote

func (r *GitHubRepo) OriginRemote() (remote *Remote, err error)

func (*GitHubRepo) RemoteBranchAndProject

func (r *GitHubRepo) RemoteBranchAndProject(owner string, preferUpstream bool) (branch *Branch, project *Project, err error)

func (*GitHubRepo) RemoteByName

func (r *GitHubRepo) RemoteByName(name string) (*Remote, error)

func (*GitHubRepo) UpstreamProject

func (r *GitHubRepo) UpstreamProject() (project *Project, err error)

type Host

type Host struct {
	Host        string `toml:"host"`
	User        string `toml:"user"`
	AccessToken string `toml:"access_token"`
	Protocol    string `toml:"protocol"`
}

type Project

type Project struct {
	Name     string
	Owner    string
	Host     string
	Protocol string
}

func NewProject

func NewProject(owner, name, host string) *Project

func NewProjectFromURL

func NewProjectFromURL(url *url.URL) (p *Project, err error)

func (*Project) GitURL

func (p *Project) GitURL(name, owner string, isSSH bool) (url string)

func (*Project) SameAs

func (p *Project) SameAs(other *Project) bool

func (Project) String

func (p Project) String() string

func (*Project) WebURL

func (p *Project) WebURL(name, owner, path string) string

type Remote

type Remote struct {
	Name string
	URL  *url.URL
}

func Remotes

func Remotes() (remotes []Remote, err error)

func (*Remote) Project

func (remote *Remote) Project() (*Project, error)

func (*Remote) String

func (remote *Remote) String() string

type URL

type URL struct {
	url.URL
	*Project
}

func ParseURL

func ParseURL(rawurl string) (*URL, error)

func (URL) ProjectPath

func (url URL) ProjectPath() (projectPath string)

Jump to

Keyboard shortcuts

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