sync

package
v0.0.1-windows Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 1 more Imports: 19 Imported by: 0

Documentation

Overview

Package sync is a generated GoMock package. mockgen -source=file.go -destination=file_mock.go -package=sync

Package sync is a generated GoMock package. mockgen -source=git.go -destination=git_mock.go -package=sync

Package sync uses the post-plugin extension point to push the generated PB stub code to a remote git repository.

Index

Constants

This section is empty.

Variables

View Source
var DefaultFileManager = &defaultFileManager{}

DefaultFileManager is a default file manager constructor which creates a FileManager.

View Source
var DefaultGitManager = &defaultGitManager{}

DefaultGitManager is the constructor of the default Git manager.

Functions

func AuthSupplier

func AuthSupplier(fileManager FileManager, gitManager GitManager) (transport.AuthMethod, error)

AuthSupplier provides access to a git remote repository via SSH by default.

Types

type FileManager

type FileManager interface {
	RemoveAll(path string) error
	WalkDir(root string, fn fs.WalkDirFunc) error
	MkdirAll(path string, perm os.FileMode) error
	UserHomeDir() (string, error)

	Open(name string) (*os.File, error)
	Create(name string) (*os.File, error)
	Close(*os.File)
	Copy(dst io.Writer, src io.Reader) (written int64, err error)
}

FileManager is an interface for managing operating system files.

type Git

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

Git provides git synchronization capabilities.

func NewGit

func NewGit(
	fileManager FileManager,
	gitManager GitManager,
	supplier func(FileManager, GitManager) (transport.AuthMethod, error),
) *Git

NewGit is a constructor for syncing stubs to a git repository. fileManager: File management interface gitManager: Git management interface supplier: Injection of Git access authorization methods

func (*Git) Check

func (s *Git) Check(_ *descriptor.FileDescriptor, opt *params.Option) bool

Check checks whether to perform remote synchronization.

func (*Git) Name

func (s *Git) Name() string

Name of the remote git repository sync plugin.

func (*Git) Run

func (s *Git) Run(fd *descriptor.FileDescriptor, opt *params.Option) error

Run syncs the remote Git repository.

type GitManager

type GitManager interface {
	PlainInit(path string, isBare bool) (*git.Repository, error)
	PlainClone(path string, isBare bool, o *git.CloneOptions) (*git.Repository, error)

	CreateRemote(r *git.Repository, c *config.RemoteConfig) (*git.Remote, error)
	Remote(r *git.Repository, name string) (*git.Remote, error)
	Worktree(r *git.Repository) (*git.Worktree, error)
	Push(r *git.Repository, o *git.PushOptions) error
	Tags(r *git.Repository) (storer.ReferenceIter, error)
	TagObject(r *git.Repository, h plumbing.Hash) (*object.Tag, error)
	TagObjects(r *git.Repository) (*object.TagIter, error)
	Head(r *git.Repository) (*plumbing.Reference, error)
	CreateTag(r *git.Repository, name string, hash plumbing.Hash,
		opts *git.CreateTagOptions) (*plumbing.Reference, error)

	AddWithOptions(w *git.Worktree, opts *git.AddOptions) error
	Commit(w *git.Worktree, msg string, opts *git.CommitOptions) (plumbing.Hash, error)

	NewPublicKeysFromFile(user, pemFile, password string) (*ssh.PublicKeys, error)
}

GitManager is the git operations interface.

type MockFileManager

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

MockFileManager is a mock of FileManager interface.

func NewMockFileManager

func NewMockFileManager(ctrl *gomock.Controller) *MockFileManager

NewMockFileManager creates a new mock instance.

func (*MockFileManager) Close

func (m *MockFileManager) Close(arg0 *os.File)

Close mocks base method.

func (*MockFileManager) Copy

func (m *MockFileManager) Copy(dst io.Writer, src io.Reader) (int64, error)

Copy mocks base method.

func (*MockFileManager) Create

func (m *MockFileManager) Create(name string) (*os.File, error)

Create mocks base method.

func (*MockFileManager) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockFileManager) MkdirAll

func (m *MockFileManager) MkdirAll(path string, perm os.FileMode) error

MkdirAll mocks base method.

func (*MockFileManager) Open

func (m *MockFileManager) Open(name string) (*os.File, error)

Open mocks base method.

func (*MockFileManager) RemoveAll

func (m *MockFileManager) RemoveAll(path string) error

RemoveAll mocks base method.

func (*MockFileManager) UserHomeDir

func (m *MockFileManager) UserHomeDir() (string, error)

UserHomeDir mocks base method.

func (*MockFileManager) WalkDir

func (m *MockFileManager) WalkDir(root string, fn fs.WalkDirFunc) error

WalkDir mocks base method.

type MockFileManagerMockRecorder

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

MockFileManagerMockRecorder is the mock recorder for MockFileManager.

func (*MockFileManagerMockRecorder) Close

func (mr *MockFileManagerMockRecorder) Close(arg0 interface{}) *gomock.Call

Close indicates an expected call of Close.

func (*MockFileManagerMockRecorder) Copy

func (mr *MockFileManagerMockRecorder) Copy(dst, src interface{}) *gomock.Call

Copy indicates an expected call of Copy.

func (*MockFileManagerMockRecorder) Create

func (mr *MockFileManagerMockRecorder) Create(name interface{}) *gomock.Call

Create indicates an expected call of Create.

func (*MockFileManagerMockRecorder) MkdirAll

func (mr *MockFileManagerMockRecorder) MkdirAll(path, perm interface{}) *gomock.Call

MkdirAll indicates an expected call of MkdirAll.

func (*MockFileManagerMockRecorder) Open

func (mr *MockFileManagerMockRecorder) Open(name interface{}) *gomock.Call

Open indicates an expected call of Open.

func (*MockFileManagerMockRecorder) RemoveAll

func (mr *MockFileManagerMockRecorder) RemoveAll(path interface{}) *gomock.Call

RemoveAll indicates an expected call of RemoveAll.

func (*MockFileManagerMockRecorder) UserHomeDir

func (mr *MockFileManagerMockRecorder) UserHomeDir() *gomock.Call

UserHomeDir indicates an expected call of UserHomeDir.

func (*MockFileManagerMockRecorder) WalkDir

func (mr *MockFileManagerMockRecorder) WalkDir(root, fn interface{}) *gomock.Call

WalkDir indicates an expected call of WalkDir.

type MockGitManager

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

MockGitManager is a mock of GitManager interface.

func NewMockGitManager

func NewMockGitManager(ctrl *gomock.Controller) *MockGitManager

NewMockGitManager creates a new mock instance.

func (*MockGitManager) AddWithOptions

func (m *MockGitManager) AddWithOptions(w *git.Worktree, opts *git.AddOptions) error

AddWithOptions mocks base method.

func (*MockGitManager) Commit

func (m *MockGitManager) Commit(w *git.Worktree, msg string, opts *git.CommitOptions) (plumbing.Hash, error)

Commit mocks base method.

func (*MockGitManager) CreateRemote

func (m *MockGitManager) CreateRemote(r *git.Repository, c *config.RemoteConfig) (*git.Remote, error)

CreateRemote mocks base method.

func (*MockGitManager) CreateTag

func (m *MockGitManager) CreateTag(r *git.Repository, name string, hash plumbing.Hash, opts *git.CreateTagOptions) (*plumbing.Reference, error)

CreateTag mocks base method.

func (*MockGitManager) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockGitManager) Head

Head mocks base method.

func (*MockGitManager) NewPublicKeysFromFile

func (m *MockGitManager) NewPublicKeysFromFile(user, pemFile, password string) (*ssh.PublicKeys, error)

NewPublicKeysFromFile mocks base method.

func (*MockGitManager) PlainClone

func (m *MockGitManager) PlainClone(path string, isBare bool, o *git.CloneOptions) (*git.Repository, error)

PlainClone mocks base method.

func (*MockGitManager) PlainInit

func (m *MockGitManager) PlainInit(path string, isBare bool) (*git.Repository, error)

PlainInit mocks base method.

func (*MockGitManager) Push

Push mocks base method.

func (*MockGitManager) Remote

func (m *MockGitManager) Remote(r *git.Repository, name string) (*git.Remote, error)

Remote mocks base method.

func (*MockGitManager) TagObject

func (m *MockGitManager) TagObject(r *git.Repository, h plumbing.Hash) (*object.Tag, error)

TagObject mocks base method.

func (*MockGitManager) TagObjects

func (m *MockGitManager) TagObjects(r *git.Repository) (*object.TagIter, error)

TagObjects mocks base method.

func (*MockGitManager) Tags

Tags mocks base method.

func (*MockGitManager) Worktree

func (m *MockGitManager) Worktree(r *git.Repository) (*git.Worktree, error)

Worktree mocks base method.

type MockGitManagerMockRecorder

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

MockGitManagerMockRecorder is the mock recorder for MockGitManager.

func (*MockGitManagerMockRecorder) AddWithOptions

func (mr *MockGitManagerMockRecorder) AddWithOptions(w, opts interface{}) *gomock.Call

AddWithOptions indicates an expected call of AddWithOptions.

func (*MockGitManagerMockRecorder) Commit

func (mr *MockGitManagerMockRecorder) Commit(w, msg, opts interface{}) *gomock.Call

Commit indicates an expected call of Commit.

func (*MockGitManagerMockRecorder) CreateRemote

func (mr *MockGitManagerMockRecorder) CreateRemote(r, c interface{}) *gomock.Call

CreateRemote indicates an expected call of CreateRemote.

func (*MockGitManagerMockRecorder) CreateTag

func (mr *MockGitManagerMockRecorder) CreateTag(r, name, hash, opts interface{}) *gomock.Call

CreateTag indicates an expected call of CreateTag.

func (*MockGitManagerMockRecorder) Head

func (mr *MockGitManagerMockRecorder) Head(r interface{}) *gomock.Call

Head indicates an expected call of Head.

func (*MockGitManagerMockRecorder) NewPublicKeysFromFile

func (mr *MockGitManagerMockRecorder) NewPublicKeysFromFile(user, pemFile, password interface{}) *gomock.Call

NewPublicKeysFromFile indicates an expected call of NewPublicKeysFromFile.

func (*MockGitManagerMockRecorder) PlainClone

func (mr *MockGitManagerMockRecorder) PlainClone(path, isBare, o interface{}) *gomock.Call

PlainClone indicates an expected call of PlainClone.

func (*MockGitManagerMockRecorder) PlainInit

func (mr *MockGitManagerMockRecorder) PlainInit(path, isBare interface{}) *gomock.Call

PlainInit indicates an expected call of PlainInit.

func (*MockGitManagerMockRecorder) Push

func (mr *MockGitManagerMockRecorder) Push(r, o interface{}) *gomock.Call

Push indicates an expected call of Push.

func (*MockGitManagerMockRecorder) Remote

func (mr *MockGitManagerMockRecorder) Remote(r, name interface{}) *gomock.Call

Remote indicates an expected call of Remote.

func (*MockGitManagerMockRecorder) TagObject

func (mr *MockGitManagerMockRecorder) TagObject(r, h interface{}) *gomock.Call

TagObject indicates an expected call of TagObject.

func (*MockGitManagerMockRecorder) TagObjects

func (mr *MockGitManagerMockRecorder) TagObjects(r interface{}) *gomock.Call

TagObjects indicates an expected call of TagObjects.

func (*MockGitManagerMockRecorder) Tags

func (mr *MockGitManagerMockRecorder) Tags(r interface{}) *gomock.Call

Tags indicates an expected call of Tags.

func (*MockGitManagerMockRecorder) Worktree

func (mr *MockGitManagerMockRecorder) Worktree(r interface{}) *gomock.Call

Worktree indicates an expected call of Worktree.

Jump to

Keyboard shortcuts

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