core

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package core is a generated GoMock package.

Package core is a generated GoMock package.

Package core is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CalculateCommandBuilder

type CalculateCommandBuilder struct {
	Scm             Scm
	Path            string
	AddFloatingTags bool
	Push            bool
}

CalculateCommand is an interface for the CalculateCommandImpl.

func NewCalculateCommandBuilder

func NewCalculateCommandBuilder() *CalculateCommandBuilder

NewCalculateCommandBuilder creates a new instance of CalculateCommandBuilder. It returns a pointer to the newly created CalculateCommandBuilder.

func (*CalculateCommandBuilder) Build

func (b *CalculateCommandBuilder) Build() Command

Build returns a Command built from the CalculateCommandBuilder. It creates a CalculateCommandImpl with the provided Scm.

func (*CalculateCommandBuilder) SetAddFloatingTags added in v1.2.0

func (b *CalculateCommandBuilder) SetAddFloatingTags(addFloatingTags bool) *CalculateCommandBuilder

SetAddFloatingTags sets the AddFloatingTags field of the CalculateCommandBuilder. It takes a boolean parameter 'addFloatingTags' and assigns it to the 'AddFloatingTags' field of the CalculateCommandBuilder. It returns a pointer to the CalculateCommandBuilder for method chaining.

func (*CalculateCommandBuilder) SetPath

SetPath sets the path for the CalculateCommandBuilder. It takes a string parameter 'path' and assigns it to the 'Path' field of the CalculateCommandBuilder. It returns a pointer to the CalculateCommandBuilder for method chaining.

func (*CalculateCommandBuilder) SetPush added in v1.2.0

SetPush sets the Push field of the CalculateCommandBuilder. It takes a boolean parameter 'push' and assigns it to the 'Push' field of the CalculateCommandBuilder. It returns a pointer to the CalculateCommandBuilder for method chaining.

func (*CalculateCommandBuilder) SetScm

SetScm sets the source control management (SCM) for the CalculateCommandBuilder. It takes an Scm parameter and returns a pointer to the CalculateCommandBuilder.

type CalculateCommandImpl

type CalculateCommandImpl struct {
	Command
	Scm             Scm
	AddFloatingTags bool
	Push            bool
}

CalculateCommandImpl represents an implementation of the CalculateCommand interface. It contains a Command and Scm field.

func (*CalculateCommandImpl) Execute

func (c *CalculateCommandImpl) Execute() (interface{}, error)

Execute executes the CalculateCommandImpl command and returns the next version tag string and any error encountered.

func (*CalculateCommandImpl) GetGreatestTag added in v0.4.0

func (c *CalculateCommandImpl) GetGreatestTag(nextTag semver.Version, tags []*semver.Version) semver.Version

type CalculateOutput added in v1.2.0

type CalculateOutput struct {
	NextVersion          string `json:"next_version"`
	FloatingVersionMajor string `json:"floating_version_major"`
	FloatingVersionMinor string `json:"floating_version_minor"`
}

type Command

type Command interface {
	Execute() (interface{}, error)
}

Command is an interface that represents a command. It defines the Execute method, which executes the command and returns a string and an error.

type CommitLog

type CommitLog struct {
	Hash       string            // The commit hash.
	Tags       []*semver.Version // The tags associated with the commit.
	Message    string            // The commit message.
	Date       time.Time         // The commit date.
	Author     string            // The author of the commit.
	Head       bool              // Indicates if the commit is the HEAD commit.
	BranchName string            // The name of the branch the commit belongs to.
}

CommitLog represents a commit in the Git repository.

type GitRepo

type GitRepo interface {
	PlainOpen(string) error
	Head() (*plumbing.Reference, error)
	Log(*git.LogOptions) (object.CommitIter, error)
	Tags() (storer.ReferenceIter, error)
	CommitObject(plumbing.Hash) (*object.Commit, error)
	CreateTag(name string, hash plumbing.Hash, opts *git.CreateTagOptions) (*plumbing.Reference, error)
	DeleteTag(name string) error
	Push(opts *git.PushOptions) error
}

GitRepo is an interface that defines the methods for interacting with a Git repository.

type GitRepoImpl

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

GitRepoImpl is an implementation of the GitRepo interface.

func (*GitRepoImpl) CommitObject

func (g *GitRepoImpl) CommitObject(hash plumbing.Hash) (*object.Commit, error)

CommitObject returns the commit object with the given hash.

func (*GitRepoImpl) CreateTag added in v1.2.0

func (g *GitRepoImpl) CreateTag(name string, hash plumbing.Hash, opts *git.CreateTagOptions) (*plumbing.Reference, error)

CreateTag creates a new tag with the given name and hash in the Git repository. It returns a reference to the newly created tag and any error encountered.

func (*GitRepoImpl) DeleteTag added in v1.2.0

func (g *GitRepoImpl) DeleteTag(name string) error

DeleteTag deletes the tag with the given name from the Git repository. It returns an error if the tag deletion fails.

func (*GitRepoImpl) Head

func (g *GitRepoImpl) Head() (*plumbing.Reference, error)

Head returns the reference to the HEAD commit in the Git repository.

func (*GitRepoImpl) Log

func (g *GitRepoImpl) Log(options *git.LogOptions) (object.CommitIter, error)

Log returns a commit iterator for the Git repository, based on the provided options. It retrieves the commit history of the repository. The returned commit iterator can be used to iterate over the commits in the repository. The options parameter allows specifying various options for filtering and sorting the commit history. It returns the commit iterator and an error if any occurred.

func (*GitRepoImpl) PlainOpen

func (g *GitRepoImpl) PlainOpen(path string) error

PlainOpen opens a Git repository at the specified path. It initializes the GitRepoImpl struct with the opened repository. Returns an error if the repository cannot be opened.

func (*GitRepoImpl) Push added in v1.2.0

func (g *GitRepoImpl) Push(opts *git.PushOptions) error

Push pushes the changes to the remote repository.

func (*GitRepoImpl) Tags

func (g *GitRepoImpl) Tags() (storer.ReferenceIter, error)

Tags returns an iterator over the tags in the Git repository. It returns a storer.ReferenceIter that can be used to iterate over the tags. If an error occurs, it is returned along with the iterator.

type MockCommitIter

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

MockCommitIter is a mock of CommitIter interface.

func NewMockCommitIter

func NewMockCommitIter(ctrl *gomock.Controller) *MockCommitIter

NewMockCommitIter creates a new mock instance.

func (*MockCommitIter) Close

func (m *MockCommitIter) Close()

Close mocks base method.

func (*MockCommitIter) EXPECT

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

func (*MockCommitIter) ForEach

func (m *MockCommitIter) ForEach(arg0 func(*object.Commit) error) error

ForEach mocks base method.

func (*MockCommitIter) Next

func (m *MockCommitIter) Next() (*object.Commit, error)

Next mocks base method.

type MockCommitIterMockRecorder

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

MockCommitIterMockRecorder is the mock recorder for MockCommitIter.

func (*MockCommitIterMockRecorder) Close

func (mr *MockCommitIterMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close.

func (*MockCommitIterMockRecorder) ForEach

func (mr *MockCommitIterMockRecorder) ForEach(arg0 interface{}) *gomock.Call

ForEach indicates an expected call of ForEach.

func (*MockCommitIterMockRecorder) Next

Next indicates an expected call of Next.

type MockGitRepo

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

MockGitRepo is a mock of GitRepo interface.

func NewMockGitRepo

func NewMockGitRepo(ctrl *gomock.Controller) *MockGitRepo

NewMockGitRepo creates a new mock instance.

func (*MockGitRepo) CommitObject

func (m *MockGitRepo) CommitObject(arg0 plumbing.Hash) (*object.Commit, error)

CommitObject mocks base method.

func (*MockGitRepo) CreateTag added in v1.2.0

func (m *MockGitRepo) CreateTag(name string, hash plumbing.Hash, opts *v5.CreateTagOptions) (*plumbing.Reference, error)

CreateTag mocks base method.

func (*MockGitRepo) DeleteTag added in v1.2.0

func (m *MockGitRepo) DeleteTag(name string) error

DeleteTag mocks base method.

func (*MockGitRepo) EXPECT

func (m *MockGitRepo) EXPECT() *MockGitRepoMockRecorder

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

func (*MockGitRepo) Head

func (m *MockGitRepo) Head() (*plumbing.Reference, error)

Head mocks base method.

func (*MockGitRepo) Log

func (m *MockGitRepo) Log(arg0 *v5.LogOptions) (object.CommitIter, error)

Log mocks base method.

func (*MockGitRepo) PlainOpen

func (m *MockGitRepo) PlainOpen(arg0 string) error

PlainOpen mocks base method.

func (*MockGitRepo) Push added in v1.2.0

func (m *MockGitRepo) Push(opts *v5.PushOptions) error

Push mocks base method.

func (*MockGitRepo) Tags

func (m *MockGitRepo) Tags() (storer.ReferenceIter, error)

Tags mocks base method.

type MockGitRepoMockRecorder

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

MockGitRepoMockRecorder is the mock recorder for MockGitRepo.

func (*MockGitRepoMockRecorder) CommitObject

func (mr *MockGitRepoMockRecorder) CommitObject(arg0 interface{}) *gomock.Call

CommitObject indicates an expected call of CommitObject.

func (*MockGitRepoMockRecorder) CreateTag added in v1.2.0

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

CreateTag indicates an expected call of CreateTag.

func (*MockGitRepoMockRecorder) DeleteTag added in v1.2.0

func (mr *MockGitRepoMockRecorder) DeleteTag(name interface{}) *gomock.Call

DeleteTag indicates an expected call of DeleteTag.

func (*MockGitRepoMockRecorder) Head

func (mr *MockGitRepoMockRecorder) Head() *gomock.Call

Head indicates an expected call of Head.

func (*MockGitRepoMockRecorder) Log

func (mr *MockGitRepoMockRecorder) Log(arg0 interface{}) *gomock.Call

Log indicates an expected call of Log.

func (*MockGitRepoMockRecorder) PlainOpen

func (mr *MockGitRepoMockRecorder) PlainOpen(arg0 interface{}) *gomock.Call

PlainOpen indicates an expected call of PlainOpen.

func (*MockGitRepoMockRecorder) Push added in v1.2.0

func (mr *MockGitRepoMockRecorder) Push(opts interface{}) *gomock.Call

Push indicates an expected call of Push.

func (*MockGitRepoMockRecorder) Tags

func (mr *MockGitRepoMockRecorder) Tags() *gomock.Call

Tags indicates an expected call of Tags.

type MockReferenceIter

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

MockReferenceIter is a mock of ReferenceIter interface.

func NewMockReferenceIter

func NewMockReferenceIter(ctrl *gomock.Controller) *MockReferenceIter

NewMockReferenceIter creates a new mock instance.

func (*MockReferenceIter) Close

func (m *MockReferenceIter) Close()

Close mocks base method.

func (*MockReferenceIter) EXPECT

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

func (*MockReferenceIter) ForEach

func (m *MockReferenceIter) ForEach(arg0 func(*plumbing.Reference) error) error

ForEach mocks base method.

func (*MockReferenceIter) Next

func (m *MockReferenceIter) Next() (*plumbing.Reference, error)

Next mocks base method.

type MockReferenceIterMockRecorder

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

MockReferenceIterMockRecorder is the mock recorder for MockReferenceIter.

func (*MockReferenceIterMockRecorder) Close

Close indicates an expected call of Close.

func (*MockReferenceIterMockRecorder) ForEach

func (mr *MockReferenceIterMockRecorder) ForEach(arg0 interface{}) *gomock.Call

ForEach indicates an expected call of ForEach.

func (*MockReferenceIterMockRecorder) Next

Next indicates an expected call of Next.

type MockScm

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

MockScm is a mock of Scm interface.

func NewMockScm

func NewMockScm(ctrl *gomock.Controller) *MockScm

NewMockScm creates a new mock instance.

func (*MockScm) EXPECT

func (m *MockScm) EXPECT() *MockScmMockRecorder

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

func (*MockScm) GetCommitLog

func (m *MockScm) GetCommitLog() ([]*CommitLog, error)

GetCommitLog mocks base method.

func (*MockScm) Push added in v1.2.0

func (m *MockScm) Push() error

Push mocks base method.

func (*MockScm) Tag added in v1.2.0

func (m *MockScm) Tag(name, hash string, floating bool) error

Tag mocks base method.

type MockScmMockRecorder

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

MockScmMockRecorder is the mock recorder for MockScm.

func (*MockScmMockRecorder) GetCommitLog

func (mr *MockScmMockRecorder) GetCommitLog() *gomock.Call

GetCommitLog indicates an expected call of GetCommitLog.

func (*MockScmMockRecorder) Push added in v1.2.0

func (mr *MockScmMockRecorder) Push() *gomock.Call

Push indicates an expected call of Push.

func (*MockScmMockRecorder) Tag added in v1.2.0

func (mr *MockScmMockRecorder) Tag(name, hash, floating interface{}) *gomock.Call

Tag indicates an expected call of Tag.

type Scm

type Scm interface {
	GetCommitLog() ([]*CommitLog, error) // GetCommitLog retrieves the commit history of the Git repository.
	Tag(name, hash string, floating bool) error
	Push() error
}

Scm is an interface that defines the methods for interacting with a source control management system.

type ScmGit

type ScmGit struct {
	Path string
	Repo GitRepo
}

ScmGit is an implementation of the Scm interface for Git repositories.

func (*ScmGit) GetCommitLog

func (s *ScmGit) GetCommitLog() ([]*CommitLog, error)

GetCommitLog retrieves the commit history of the Git repository. It returns a slice of CommitLog structs representing each commit, along with associated information such as the commit hash, message, tags, author, and date. If an error occurs during the retrieval process, it is returned as the second value.

func (*ScmGit) Push added in v1.2.0

func (s *ScmGit) Push() error

Push pushes the changes to the remote repository. It returns an error if the push operation fails.

func (*ScmGit) Tag added in v1.2.0

func (s *ScmGit) Tag(name, hash string, floating bool) error

Tag creates a new tag with the given name and hash in the Git repository. It returns an error if the tag creation fails.

type ScmGitBuilder

type ScmGitBuilder struct {
	Path string
	Repo GitRepo
}

ScmGitBuilder is a builder for creating ScmGit instances.

func NewScmGitBuilder

func NewScmGitBuilder() *ScmGitBuilder

NewScmGitBuilder creates a new ScmGitBuilder instance.

func (*ScmGitBuilder) Build

func (b *ScmGitBuilder) Build() Scm

Build creates a new Scm instance based on the builder configuration.

func (*ScmGitBuilder) SetPath

func (b *ScmGitBuilder) SetPath(path string) *ScmGitBuilder

SetPath sets the path of the Git repository.

func (*ScmGitBuilder) SetRepo

func (b *ScmGitBuilder) SetRepo(repo GitRepo) *ScmGitBuilder

SetRepo sets the Git repository implementation.

type SemanticVersionComponent added in v0.5.0

type SemanticVersionComponent int
const (
	MAJOR SemanticVersionComponent = iota
	MINOR
	PATCH
)

func GetVersionUpdate added in v0.5.0

func GetVersionUpdate(commitMessage string) SemanticVersionComponent

GetVersionUpdate determines the version update type (MAJOR, MINOR, PATCH) based on the conventional commit message.

Jump to

Keyboard shortcuts

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