Documentation
¶
Index ¶
- type AptProvider
- type BrewProvider
- type BunProvider
- type CocoapodsProvider
- type ComposerProvider
- type DefaultExecutor
- type DenoProvider
- type DetectRequest
- type Executor
- type ExecutorMock
- func (mock *ExecutorMock) LookPath(file string) (string, error)
- func (mock *ExecutorMock) LookPathCalls() []struct{ ... }
- func (mock *ExecutorMock) Output(cmd *exec.Cmd) ([]byte, error)
- func (mock *ExecutorMock) OutputCalls() []struct{ ... }
- func (mock *ExecutorMock) ReadDir(name string) ([]os.DirEntry, error)
- func (mock *ExecutorMock) ReadDirCalls() []struct{ ... }
- func (mock *ExecutorMock) Stat(name string) (os.FileInfo, error)
- func (mock *ExecutorMock) StatCalls() []struct{ ... }
- type GoProvider
- type GolangCILintProvider
- type GradleProvider
- type MavenProvider
- type MiseProvider
- type ModeProvider
- type ModeProviderMock
- func (mock *ModeProviderMock) Detect(ctx context.Context, req DetectRequest) (bool, error)
- func (mock *ModeProviderMock) DetectCalls() []struct{ ... }
- func (mock *ModeProviderMock) Name() string
- func (mock *ModeProviderMock) NameCalls() []struct{}
- func (mock *ModeProviderMock) Plan(ctx context.Context, req PlanRequest) (PlanResult, error)
- func (mock *ModeProviderMock) PlanCalls() []struct{ ... }
- type Modes
- type NixProvider
- type NpmProvider
- type PlanRequest
- type PlanResult
- type PlaywrightProvider
- type PnpmProvider
- type PoetryProvider
- type PythonProvider
- type RubyProvider
- type RustProvider
- type SwiftPMProvider
- type UVProvider
- type XcodeProvider
- type YarnProvider
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AptProvider ¶
type AptProvider struct{}
func (AptProvider) Detect ¶
func (p AptProvider) Detect(ctx context.Context, req DetectRequest) (bool, error)
func (AptProvider) Name ¶
func (p AptProvider) Name() string
func (AptProvider) Plan ¶
func (p AptProvider) Plan(ctx context.Context, req PlanRequest) (PlanResult, error)
type BrewProvider ¶
type BrewProvider struct{}
func (BrewProvider) Detect ¶
func (p BrewProvider) Detect(ctx context.Context, req DetectRequest) (bool, error)
func (BrewProvider) Name ¶
func (p BrewProvider) Name() string
func (BrewProvider) Plan ¶
func (p BrewProvider) Plan(ctx context.Context, req PlanRequest) (PlanResult, error)
type BunProvider ¶
type BunProvider struct{}
func (BunProvider) Detect ¶
func (p BunProvider) Detect(ctx context.Context, req DetectRequest) (bool, error)
func (BunProvider) Name ¶
func (p BunProvider) Name() string
func (BunProvider) Plan ¶
func (p BunProvider) Plan(ctx context.Context, req PlanRequest) (PlanResult, error)
type CocoapodsProvider ¶
type CocoapodsProvider struct{}
func (CocoapodsProvider) Detect ¶
func (p CocoapodsProvider) Detect(ctx context.Context, req DetectRequest) (bool, error)
func (CocoapodsProvider) Name ¶
func (p CocoapodsProvider) Name() string
func (CocoapodsProvider) Plan ¶
func (p CocoapodsProvider) Plan(ctx context.Context, req PlanRequest) (PlanResult, error)
type ComposerProvider ¶
type ComposerProvider struct{}
func (ComposerProvider) Detect ¶
func (p ComposerProvider) Detect(ctx context.Context, req DetectRequest) (bool, error)
func (ComposerProvider) Name ¶
func (p ComposerProvider) Name() string
func (ComposerProvider) Plan ¶
func (p ComposerProvider) Plan(ctx context.Context, req PlanRequest) (PlanResult, error)
type DefaultExecutor ¶
type DefaultExecutor struct{}
type DenoProvider ¶
type DenoProvider struct{}
func (DenoProvider) Detect ¶
func (p DenoProvider) Detect(ctx context.Context, req DetectRequest) (bool, error)
func (DenoProvider) Name ¶
func (p DenoProvider) Name() string
func (DenoProvider) Plan ¶
func (p DenoProvider) Plan(ctx context.Context, req PlanRequest) (PlanResult, error)
type DetectRequest ¶
type DetectRequest struct {
Exec Executor
}
type ExecutorMock ¶
type ExecutorMock struct {
// LookPathFunc mocks the LookPath method.
LookPathFunc func(file string) (string, error)
// OutputFunc mocks the Output method.
OutputFunc func(cmd *exec.Cmd) ([]byte, error)
// ReadDirFunc mocks the ReadDir method.
ReadDirFunc func(name string) ([]os.DirEntry, error)
// StatFunc mocks the Stat method.
StatFunc func(name string) (os.FileInfo, error)
// contains filtered or unexported fields
}
ExecutorMock is a mock implementation of Executor.
func TestSomethingThatUsesExecutor(t *testing.T) {
// make and configure a mocked Executor
mockedExecutor := &ExecutorMock{
LookPathFunc: func(file string) (string, error) {
panic("mock out the LookPath method")
},
OutputFunc: func(cmd *exec.Cmd) ([]byte, error) {
panic("mock out the Output method")
},
ReadDirFunc: func(name string) ([]os.DirEntry, error) {
panic("mock out the ReadDir method")
},
StatFunc: func(name string) (os.FileInfo, error) {
panic("mock out the Stat method")
},
}
// use mockedExecutor in code that requires Executor
// and then make assertions.
}
func (*ExecutorMock) LookPath ¶
func (mock *ExecutorMock) LookPath(file string) (string, error)
LookPath calls LookPathFunc.
func (*ExecutorMock) LookPathCalls ¶
func (mock *ExecutorMock) LookPathCalls() []struct { File string }
LookPathCalls gets all the calls that were made to LookPath. Check the length with:
len(mockedExecutor.LookPathCalls())
func (*ExecutorMock) Output ¶
func (mock *ExecutorMock) Output(cmd *exec.Cmd) ([]byte, error)
Output calls OutputFunc.
func (*ExecutorMock) OutputCalls ¶
func (mock *ExecutorMock) OutputCalls() []struct { Cmd *exec.Cmd }
OutputCalls gets all the calls that were made to Output. Check the length with:
len(mockedExecutor.OutputCalls())
func (*ExecutorMock) ReadDir ¶
func (mock *ExecutorMock) ReadDir(name string) ([]os.DirEntry, error)
ReadDir calls ReadDirFunc.
func (*ExecutorMock) ReadDirCalls ¶
func (mock *ExecutorMock) ReadDirCalls() []struct { Name string }
ReadDirCalls gets all the calls that were made to ReadDir. Check the length with:
len(mockedExecutor.ReadDirCalls())
func (*ExecutorMock) Stat ¶
func (mock *ExecutorMock) Stat(name string) (os.FileInfo, error)
Stat calls StatFunc.
func (*ExecutorMock) StatCalls ¶
func (mock *ExecutorMock) StatCalls() []struct { Name string }
StatCalls gets all the calls that were made to Stat. Check the length with:
len(mockedExecutor.StatCalls())
type GoProvider ¶
type GoProvider struct{}
func (GoProvider) Detect ¶
func (p GoProvider) Detect(ctx context.Context, req DetectRequest) (bool, error)
func (GoProvider) Name ¶
func (p GoProvider) Name() string
func (GoProvider) Plan ¶
func (p GoProvider) Plan(ctx context.Context, req PlanRequest) (PlanResult, error)
type GolangCILintProvider ¶
type GolangCILintProvider struct{}
func (GolangCILintProvider) Detect ¶
func (p GolangCILintProvider) Detect(ctx context.Context, req DetectRequest) (bool, error)
func (GolangCILintProvider) Name ¶
func (p GolangCILintProvider) Name() string
func (GolangCILintProvider) Plan ¶
func (p GolangCILintProvider) Plan(ctx context.Context, req PlanRequest) (PlanResult, error)
type GradleProvider ¶
type GradleProvider struct{}
func (GradleProvider) Detect ¶
func (p GradleProvider) Detect(ctx context.Context, req DetectRequest) (bool, error)
func (GradleProvider) Name ¶
func (p GradleProvider) Name() string
func (GradleProvider) Plan ¶
func (p GradleProvider) Plan(ctx context.Context, req PlanRequest) (PlanResult, error)
type MavenProvider ¶
type MavenProvider struct{}
func (MavenProvider) Detect ¶
func (p MavenProvider) Detect(ctx context.Context, req DetectRequest) (bool, error)
func (MavenProvider) Name ¶
func (p MavenProvider) Name() string
func (MavenProvider) Plan ¶
func (p MavenProvider) Plan(ctx context.Context, req PlanRequest) (PlanResult, error)
type MiseProvider ¶
type MiseProvider struct{}
func (MiseProvider) Detect ¶
func (p MiseProvider) Detect(ctx context.Context, req DetectRequest) (bool, error)
func (MiseProvider) Name ¶
func (p MiseProvider) Name() string
func (MiseProvider) Plan ¶
func (p MiseProvider) Plan(ctx context.Context, req PlanRequest) (PlanResult, error)
type ModeProvider ¶
type ModeProvider interface {
Name() string
Detect(ctx context.Context, req DetectRequest) (bool, error)
Plan(ctx context.Context, req PlanRequest) (PlanResult, error)
}
type ModeProviderMock ¶
type ModeProviderMock struct {
// DetectFunc mocks the Detect method.
DetectFunc func(ctx context.Context, req DetectRequest) (bool, error)
// NameFunc mocks the Name method.
NameFunc func() string
// PlanFunc mocks the Plan method.
PlanFunc func(ctx context.Context, req PlanRequest) (PlanResult, error)
// contains filtered or unexported fields
}
ModeProviderMock is a mock implementation of ModeProvider.
func TestSomethingThatUsesModeProvider(t *testing.T) {
// make and configure a mocked ModeProvider
mockedModeProvider := &ModeProviderMock{
DetectFunc: func(ctx context.Context, req DetectRequest) (bool, error) {
panic("mock out the Detect method")
},
NameFunc: func() string {
panic("mock out the Name method")
},
PlanFunc: func(ctx context.Context, req PlanRequest) (PlanResult, error) {
panic("mock out the Plan method")
},
}
// use mockedModeProvider in code that requires ModeProvider
// and then make assertions.
}
func (*ModeProviderMock) Detect ¶
func (mock *ModeProviderMock) Detect(ctx context.Context, req DetectRequest) (bool, error)
Detect calls DetectFunc.
func (*ModeProviderMock) DetectCalls ¶
func (mock *ModeProviderMock) DetectCalls() []struct { Ctx context.Context Req DetectRequest }
DetectCalls gets all the calls that were made to Detect. Check the length with:
len(mockedModeProvider.DetectCalls())
func (*ModeProviderMock) NameCalls ¶
func (mock *ModeProviderMock) NameCalls() []struct { }
NameCalls gets all the calls that were made to Name. Check the length with:
len(mockedModeProvider.NameCalls())
func (*ModeProviderMock) Plan ¶
func (mock *ModeProviderMock) Plan(ctx context.Context, req PlanRequest) (PlanResult, error)
Plan calls PlanFunc.
func (*ModeProviderMock) PlanCalls ¶
func (mock *ModeProviderMock) PlanCalls() []struct { Ctx context.Context Req PlanRequest }
PlanCalls gets all the calls that were made to Plan. Check the length with:
len(mockedModeProvider.PlanCalls())
type Modes ¶
type Modes []ModeProvider
Example ¶
package main
import (
"context"
"encoding/json"
"os"
"github.com/namespacelabs/spacectl/internal/cache/mode"
)
func main() {
detected, err := mode.DefaultModes().Detect(context.Background(), mode.DetectRequest{})
if err != nil {
panic(err)
}
result, err := detected.Plan(context.Background(), mode.PlanRequest{})
if err != nil {
panic(err)
}
err = json.NewEncoder(os.Stdout).Encode(result)
if err != nil {
panic(err)
}
}
Output:
func DefaultModes ¶
func DefaultModes() Modes
func (Modes) Detect ¶
Detect runs detection for all modes in parallel and returns those that were detected.
func (Modes) Plan ¶
func (modes Modes) Plan(ctx context.Context, req PlanRequest) (map[string]PlanResult, error)
Plan runs planning for all modes in parallel and returns their results.
type NixProvider ¶
type NixProvider struct{}
func (NixProvider) Detect ¶
func (p NixProvider) Detect(ctx context.Context, req DetectRequest) (bool, error)
func (NixProvider) Name ¶
func (p NixProvider) Name() string
func (NixProvider) Plan ¶
func (p NixProvider) Plan(ctx context.Context, req PlanRequest) (PlanResult, error)
type NpmProvider ¶ added in v0.8.0
type NpmProvider struct{}
func (NpmProvider) Detect ¶ added in v0.8.0
func (p NpmProvider) Detect(ctx context.Context, req DetectRequest) (bool, error)
func (NpmProvider) Name ¶ added in v0.8.0
func (p NpmProvider) Name() string
func (NpmProvider) Plan ¶ added in v0.8.0
func (p NpmProvider) Plan(ctx context.Context, req PlanRequest) (PlanResult, error)
type PlanRequest ¶
type PlanResult ¶
type PlaywrightProvider ¶
type PlaywrightProvider struct{}
func (PlaywrightProvider) Detect ¶
func (p PlaywrightProvider) Detect(ctx context.Context, req DetectRequest) (bool, error)
func (PlaywrightProvider) Name ¶
func (p PlaywrightProvider) Name() string
func (PlaywrightProvider) Plan ¶
func (p PlaywrightProvider) Plan(ctx context.Context, req PlanRequest) (PlanResult, error)
type PnpmProvider ¶
type PnpmProvider struct{}
func (PnpmProvider) Detect ¶
func (p PnpmProvider) Detect(ctx context.Context, req DetectRequest) (bool, error)
func (PnpmProvider) Name ¶
func (p PnpmProvider) Name() string
func (PnpmProvider) Plan ¶
func (p PnpmProvider) Plan(ctx context.Context, req PlanRequest) (PlanResult, error)
type PoetryProvider ¶
type PoetryProvider struct{}
func (PoetryProvider) Detect ¶
func (p PoetryProvider) Detect(ctx context.Context, req DetectRequest) (bool, error)
func (PoetryProvider) Name ¶
func (p PoetryProvider) Name() string
func (PoetryProvider) Plan ¶
func (p PoetryProvider) Plan(ctx context.Context, req PlanRequest) (PlanResult, error)
type PythonProvider ¶
type PythonProvider struct{}
func (PythonProvider) Detect ¶
func (p PythonProvider) Detect(ctx context.Context, req DetectRequest) (bool, error)
func (PythonProvider) Name ¶
func (p PythonProvider) Name() string
func (PythonProvider) Plan ¶
func (p PythonProvider) Plan(ctx context.Context, req PlanRequest) (PlanResult, error)
type RubyProvider ¶
type RubyProvider struct{}
func (RubyProvider) Detect ¶
func (p RubyProvider) Detect(ctx context.Context, req DetectRequest) (bool, error)
func (RubyProvider) Name ¶
func (p RubyProvider) Name() string
func (RubyProvider) Plan ¶
func (p RubyProvider) Plan(ctx context.Context, req PlanRequest) (PlanResult, error)
type RustProvider ¶
type RustProvider struct{}
func (RustProvider) Detect ¶
func (p RustProvider) Detect(ctx context.Context, req DetectRequest) (bool, error)
func (RustProvider) Name ¶
func (p RustProvider) Name() string
func (RustProvider) Plan ¶
func (p RustProvider) Plan(ctx context.Context, req PlanRequest) (PlanResult, error)
type SwiftPMProvider ¶
type SwiftPMProvider struct{}
func (SwiftPMProvider) Detect ¶
func (p SwiftPMProvider) Detect(ctx context.Context, req DetectRequest) (bool, error)
func (SwiftPMProvider) Name ¶
func (p SwiftPMProvider) Name() string
func (SwiftPMProvider) Plan ¶
func (p SwiftPMProvider) Plan(ctx context.Context, req PlanRequest) (PlanResult, error)
type UVProvider ¶
type UVProvider struct{}
func (UVProvider) Detect ¶
func (p UVProvider) Detect(ctx context.Context, req DetectRequest) (bool, error)
func (UVProvider) Name ¶
func (p UVProvider) Name() string
func (UVProvider) Plan ¶
func (p UVProvider) Plan(ctx context.Context, req PlanRequest) (PlanResult, error)
type XcodeProvider ¶
type XcodeProvider struct{}
func (XcodeProvider) Detect ¶
func (p XcodeProvider) Detect(ctx context.Context, req DetectRequest) (bool, error)
func (XcodeProvider) Name ¶
func (p XcodeProvider) Name() string
func (XcodeProvider) Plan ¶
func (p XcodeProvider) Plan(ctx context.Context, req PlanRequest) (PlanResult, error)
Experimental: Xcode compilation cache can be huge.
type YarnProvider ¶
type YarnProvider struct{}
func (YarnProvider) Detect ¶
func (p YarnProvider) Detect(ctx context.Context, req DetectRequest) (bool, error)
func (YarnProvider) Name ¶
func (p YarnProvider) Name() string
func (YarnProvider) Plan ¶
func (p YarnProvider) Plan(ctx context.Context, req PlanRequest) (PlanResult, error)