repo

package
v0.0.0-...-a18d6c5 Latest Latest
Warning

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

Go to latest
Published: May 23, 2020 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrRepositoryNameExisted = errors.New("repository with same name already existed")

ErrRepositoryNameExisted 同名的仓库已经存在

View Source
var ErrRepositoryNotExist = errors.New("repository is not exist")

ErrRepositoryNotExist 仓库不存在错误

Functions

This section is empty.

Types

type AuthConf

type AuthConf struct {
	Username       string          `json:"username"`
	Email          string          `json:"email"`
	GithubAuthConf *GithubAuthConf `json:"github_auth_conf"`
}

func (AuthConf) Auth

func (a AuthConf) Auth(authType AuthType) transport.AuthMethod

func (*AuthConf) Merge

func (a *AuthConf) Merge(other *AuthConf) *AuthConf

Merge 与其他的 AuthConf 合并

type AuthType

type AuthType string
const AuthTypeGithub AuthType = "github"

type Conf

type Conf struct {
	Repositories []RepositoryConf `json:"repositories"`
	AuthConf     *AuthConf        `json:"auth_conf"`
}

type GithubAuthConf

type GithubAuthConf struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

func (GithubAuthConf) Auth

Auth 转换为授权请求信息

func (GithubAuthConf) IsEmpty

func (ac GithubAuthConf) IsEmpty() bool

IsEmpty Github 鉴权信息是否为空

type ProgressWriter

type ProgressWriter struct{}

func NewProgressWriter

func NewProgressWriter() *ProgressWriter

func (ProgressWriter) Write

func (pw ProgressWriter) Write(p []byte) (n int, err error)

type Repo

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

Repo Git 仓库

func NewRepo

func NewRepo(cc container.Container) *Repo

NewRepo 创建 Repo 实例

func (Repo) AddRepository

func (repo Repo) AddRepository(r RepositoryConf) error

AddRepository 新增仓库配置

func (Repo) DeleteFile

func (repo Repo) DeleteFile(name string, filename string) error

DeleteFile 删除文档

func (Repo) GetFile

func (repo Repo) GetFile(name string, filename string) ([]byte, error)

GetFile 获取文档内容

func (Repo) GetRepoConfByCB

func (repo Repo) GetRepoConfByCB(cb func(r RepositoryConf) bool) (*RepositoryConf, error)

GetRepoConfByCB 通过 cb 回调函数来获取仓库配置

func (Repo) GetRepoConfByName

func (repo Repo) GetRepoConfByName(name string) (*RepositoryConf, error)

GetRepoConfByName 通过仓库名获取仓库配置

func (Repo) Inspection

func (repo Repo) Inspection(gitRepo *git.Repository)

Inspection 输出仓库信息

func (Repo) LoadConf

func (repo Repo) LoadConf() (*Conf, error)

LoadConf 加载仓库配置

func (Repo) OpenRepository

func (repo Repo) OpenRepository(name string) (*git.Repository, *RepositoryConf, error)

OpenRepository 根据名称打开一个仓库

func (*Repo) Pull

func (repo *Repo) Pull(name string) error

Pull 拉取更新

func (*Repo) Push

func (repo *Repo) Push(name string) error

Push 推送到远程仓库

func (Repo) RemoveRepository

func (repo Repo) RemoveRepository(name string) error

RemoveRepository 删除仓库配置

func (Repo) RepositoryTree

func (repo Repo) RepositoryTree(name string, ext ...string) (*dtree.VueTree, error)

RepositoryTree 获取仓库目录树

func (Repo) ResetRepository

func (repo Repo) ResetRepository(name string) error

ResetRepository 重置仓库

func (Repo) SaveFile

func (repo Repo) SaveFile(name string, filename string, original string, data []byte) error

SaveFile 保存文档

type RepositoryConf

type RepositoryConf struct {
	Name       string    `json:"name"`
	Branch     string    `json:"branch"`
	URL        string    `json:"url"`
	StorageDir string    `json:"storage_dir"`
	Type       AuthType  `json:"type"`
	AuthConf   *AuthConf `json:"auth_conf"`
	Readonly   bool      `json:"readonly"`
}

func (*RepositoryConf) Init

func (rc *RepositoryConf) Init(repoConf *Conf)

type ServiceProvider

type ServiceProvider struct{}

func (ServiceProvider) Boot

func (s ServiceProvider) Boot(app glacier.Glacier)

func (ServiceProvider) Register

func (s ServiceProvider) Register(app container.Container)

Jump to

Keyboard shortcuts

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