Documentation
¶
Index ¶
- func Exec(dir, command string, args ...string) ([]byte, error)
- func GenerateConfig(dir string) error
- func Initialize(dir string) error
- func InitializeWithOutput(dir string, w io.Writer) error
- func IsManaged(dir string) bool
- type MiseOperationsMock
- func (mock *MiseOperationsMock) Exec(command string, args ...string) ([]byte, error)
- func (mock *MiseOperationsMock) ExecCalls() []struct{ ... }
- func (mock *MiseOperationsMock) HasTask(taskName string) bool
- func (mock *MiseOperationsMock) HasTaskCalls() []struct{ ... }
- func (mock *MiseOperationsMock) Initialize() error
- func (mock *MiseOperationsMock) InitializeCalls() []struct{}
- func (mock *MiseOperationsMock) InitializeWithOutput(w io.Writer) error
- func (mock *MiseOperationsMock) InitializeWithOutputCalls() []struct{ ... }
- func (mock *MiseOperationsMock) Install() error
- func (mock *MiseOperationsMock) InstallCalls() []struct{}
- func (mock *MiseOperationsMock) IsManaged() bool
- func (mock *MiseOperationsMock) IsManagedCalls() []struct{}
- func (mock *MiseOperationsMock) RunTask(taskName string) error
- func (mock *MiseOperationsMock) RunTaskCalls() []struct{ ... }
- func (mock *MiseOperationsMock) Trust() error
- func (mock *MiseOperationsMock) TrustCalls() []struct{}
- type Operations
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateConfig ¶
GenerateConfig creates a .mise.toml file in the given directory with co's required tools. Returns nil if a mise config already exists (doesn't overwrite).
func Initialize ¶
Initialize runs mise trust, install, and setup task if available.
func InitializeWithOutput ¶
InitializeWithOutput runs mise trust, install, and setup task if available.
Types ¶
type MiseOperationsMock ¶
type MiseOperationsMock struct {
// ExecFunc mocks the Exec method.
ExecFunc func(command string, args ...string) ([]byte, error)
// HasTaskFunc mocks the HasTask method.
HasTaskFunc func(taskName string) bool
// InitializeFunc mocks the Initialize method.
InitializeFunc func() error
// InitializeWithOutputFunc mocks the InitializeWithOutput method.
InitializeWithOutputFunc func(w io.Writer) error
// InstallFunc mocks the Install method.
InstallFunc func() error
// IsManagedFunc mocks the IsManaged method.
IsManagedFunc func() bool
// RunTaskFunc mocks the RunTask method.
RunTaskFunc func(taskName string) error
// TrustFunc mocks the Trust method.
TrustFunc func() error
// contains filtered or unexported fields
}
MiseOperationsMock is a mock implementation of Operations.
func TestSomethingThatUsesOperations(t *testing.T) {
// make and configure a mocked Operations
mockedOperations := &MiseOperationsMock{
ExecFunc: func(command string, args ...string) ([]byte, error) {
panic("mock out the Exec method")
},
HasTaskFunc: func(taskName string) bool {
panic("mock out the HasTask method")
},
InitializeFunc: func() error {
panic("mock out the Initialize method")
},
InitializeWithOutputFunc: func(w io.Writer) error {
panic("mock out the InitializeWithOutput method")
},
InstallFunc: func() error {
panic("mock out the Install method")
},
IsManagedFunc: func() bool {
panic("mock out the IsManaged method")
},
RunTaskFunc: func(taskName string) error {
panic("mock out the RunTask method")
},
TrustFunc: func() error {
panic("mock out the Trust method")
},
}
// use mockedOperations in code that requires Operations
// and then make assertions.
}
func (*MiseOperationsMock) Exec ¶
func (mock *MiseOperationsMock) Exec(command string, args ...string) ([]byte, error)
Exec calls ExecFunc.
func (*MiseOperationsMock) ExecCalls ¶
func (mock *MiseOperationsMock) ExecCalls() []struct { Command string Args []string }
ExecCalls gets all the calls that were made to Exec. Check the length with:
len(mockedOperations.ExecCalls())
func (*MiseOperationsMock) HasTask ¶
func (mock *MiseOperationsMock) HasTask(taskName string) bool
HasTask calls HasTaskFunc.
func (*MiseOperationsMock) HasTaskCalls ¶
func (mock *MiseOperationsMock) HasTaskCalls() []struct { TaskName string }
HasTaskCalls gets all the calls that were made to HasTask. Check the length with:
len(mockedOperations.HasTaskCalls())
func (*MiseOperationsMock) Initialize ¶
func (mock *MiseOperationsMock) Initialize() error
Initialize calls InitializeFunc.
func (*MiseOperationsMock) InitializeCalls ¶
func (mock *MiseOperationsMock) InitializeCalls() []struct { }
InitializeCalls gets all the calls that were made to Initialize. Check the length with:
len(mockedOperations.InitializeCalls())
func (*MiseOperationsMock) InitializeWithOutput ¶
func (mock *MiseOperationsMock) InitializeWithOutput(w io.Writer) error
InitializeWithOutput calls InitializeWithOutputFunc.
func (*MiseOperationsMock) InitializeWithOutputCalls ¶
func (mock *MiseOperationsMock) InitializeWithOutputCalls() []struct { W io.Writer }
InitializeWithOutputCalls gets all the calls that were made to InitializeWithOutput. Check the length with:
len(mockedOperations.InitializeWithOutputCalls())
func (*MiseOperationsMock) Install ¶
func (mock *MiseOperationsMock) Install() error
Install calls InstallFunc.
func (*MiseOperationsMock) InstallCalls ¶
func (mock *MiseOperationsMock) InstallCalls() []struct { }
InstallCalls gets all the calls that were made to Install. Check the length with:
len(mockedOperations.InstallCalls())
func (*MiseOperationsMock) IsManaged ¶
func (mock *MiseOperationsMock) IsManaged() bool
IsManaged calls IsManagedFunc.
func (*MiseOperationsMock) IsManagedCalls ¶
func (mock *MiseOperationsMock) IsManagedCalls() []struct { }
IsManagedCalls gets all the calls that were made to IsManaged. Check the length with:
len(mockedOperations.IsManagedCalls())
func (*MiseOperationsMock) RunTask ¶
func (mock *MiseOperationsMock) RunTask(taskName string) error
RunTask calls RunTaskFunc.
func (*MiseOperationsMock) RunTaskCalls ¶
func (mock *MiseOperationsMock) RunTaskCalls() []struct { TaskName string }
RunTaskCalls gets all the calls that were made to RunTask. Check the length with:
len(mockedOperations.RunTaskCalls())
func (*MiseOperationsMock) Trust ¶
func (mock *MiseOperationsMock) Trust() error
Trust calls TrustFunc.
func (*MiseOperationsMock) TrustCalls ¶
func (mock *MiseOperationsMock) TrustCalls() []struct { }
TrustCalls gets all the calls that were made to Trust. Check the length with:
len(mockedOperations.TrustCalls())
type Operations ¶
type Operations interface {
// IsManaged returns true if the directory has a mise config file.
IsManaged() bool
// Trust runs `mise trust` in the directory.
Trust() error
// Install runs `mise install` in the directory.
Install() error
// HasTask checks if a mise task exists in the directory.
HasTask(taskName string) bool
// RunTask runs a mise task in the directory.
RunTask(taskName string) error
// Exec runs a command with the mise environment in the directory.
Exec(command string, args ...string) ([]byte, error)
// Initialize runs mise trust, install, and setup task if available.
Initialize() error
// InitializeWithOutput runs mise trust, install, and setup task if available,
// writing progress messages to the provided writer.
InitializeWithOutput(w io.Writer) error
}
Operations defines the interface for mise operations. This abstraction enables testing without actual mise commands. Each Operations instance is bound to a specific directory.
func NewOperations ¶
func NewOperations(dir string) Operations
NewOperations creates a new Operations instance bound to the specified directory.