github

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2017 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AccessTokenNote = "Access token automatically managed my Klone. More information: https://github.com/kris-nova/klone."
)

Variables

View Source
var (
	Cache              = fmt.Sprintf("%s/.klone/auth", local.Home())
	RefreshCredentials = false
	Testing            = false
)

Functions

This section is empty.

Types

type GitHubCredentials

type GitHubCredentials struct {
	User  string
	Pass  string
	Token string
}

GitHubCredentials are how we log into GitHub.com

type GitServer

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

GitServer is a representation of GitHub.com, by design we never store credentials here in memory Todo (@kris-nova) encrypt these creds please!

func (*GitServer) Authenticate

func (s *GitServer) Authenticate() error

Authenticate will parse configuration with the following hierarchy. 1. Access token from local cache 2. Access token from env var 3. Username/Password from env var Authenticate will then attempt to log in (prompting for MFA if necessary) Authenticate will then attempt to ensure a unique access token created by klone for future access To ensure a new auth token, simply set the env var and klone will re-cache the new token

func (*GitServer) DeleteRepo

func (s *GitServer) DeleteRepo(name string) (bool, error)

func (*GitServer) DeleteRepoByOwner

func (s *GitServer) DeleteRepoByOwner(name, owner string) (bool, error)

func (*GitServer) Fork

func (s *GitServer) Fork(parent provider.Repo, newOwner string) (provider.Repo, error)

func (*GitServer) GetRepo

func (s *GitServer) GetRepo(name string) (provider.Repo, error)

GetRepo is the most effecient way to look up a repository exactly by it's name and assumed owner (you)

func (*GitServer) GetRepoByOwner

func (s *GitServer) GetRepoByOwner(owner, name string) (provider.Repo, error)

GetRepoByOwner is the most effecient way to look up a repository exactly by it's name and owner

func (*GitServer) GetRepos

func (s *GitServer) GetRepos() (map[string]provider.Repo, error)

GetRepos will return (and cache) a hash map of repositories by name for some convenient O(n*log(n)) look up!

func (*GitServer) GetServerString

func (s *GitServer) GetServerString() string

GetServerString returns a server string is the string we would want to use in things like $GOPATH In this case we know we are dealing with GitHub.com so we can safely return it.

func (*GitServer) NewRepo

func (s *GitServer) NewRepo(name, desc string) (provider.Repo, error)

func (*GitServer) OwnerEmail

func (s *GitServer) OwnerEmail() string

func (*GitServer) OwnerName

func (s *GitServer) OwnerName() string

type KloneProvider

type KloneProvider struct {
}

func (*KloneProvider) NewGitServer

func (k *KloneProvider) NewGitServer() (provider.GitServer, error)

type Repo

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

func (*Repo) Description

func (r *Repo) Description() string

func (*Repo) ForkedFrom

func (r *Repo) ForkedFrom() provider.Repo

func (*Repo) GetKlonefile

func (r *Repo) GetKlonefile() []byte

func (*Repo) GitCloneUrl

func (r *Repo) GitCloneUrl() string

func (*Repo) GitRemoteUrl

func (r *Repo) GitRemoteUrl() string

func (*Repo) HttpsCloneUrl

func (r *Repo) HttpsCloneUrl() string

func (*Repo) Language

func (r *Repo) Language() string

func (*Repo) Name

func (r *Repo) Name() string

func (*Repo) Owner

func (r *Repo) Owner() string

func (*Repo) SetImplementation

func (r *Repo) SetImplementation(impl interface{})

Jump to

Keyboard shortcuts

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