core

package
v0.2.11 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package core is a generated GoMock package.

Index

Constants

View Source
const DefaultUpdateCommand = "curl -sSL https://raw.githubusercontent.com/ensi-platform/elc/master/get.sh | sudo -E bash"

Variables

View Source
var Version string

Functions

func CheckHomeConfigIsEmpty

func CheckHomeConfigIsEmpty(configPath string) error

func GenerateHookScripts

func GenerateHookScripts(options *GlobalOptions, svcPath string, elcBinary string, scriptsFolder string) error

func SaveHomeConfig

func SaveHomeConfig(homeConfig *HomeConfig) error

Types

type Component

type Component struct {
	Name        string
	Config      *ComponentConfig
	Template    *ComponentConfig
	JustStarted bool
	Context     *Context
	Workspace   *Workspace
}

func NewComponent

func NewComponent(compName string, compCfg *ComponentConfig, ws *Workspace) *Component

func (*Component) Clone

func (comp *Component) Clone(options *GlobalOptions, noHook bool) error

func (*Component) Compose

func (comp *Component) Compose(params *GlobalOptions) (int, error)

func (*Component) Destroy

func (comp *Component) Destroy(options *GlobalOptions) error

func (*Component) DumpVars

func (comp *Component) DumpVars() error

func (*Component) Exec

func (comp *Component) Exec(options *GlobalOptions) (int, error)

func (*Component) IsCloned

func (comp *Component) IsCloned() (bool, error)

func (*Component) IsRunning

func (comp *Component) IsRunning(options *GlobalOptions) (bool, error)

func (*Component) Restart

func (comp *Component) Restart(hard bool, options *GlobalOptions) error

func (*Component) Run

func (comp *Component) Run(options *GlobalOptions) (int, error)

func (*Component) Start

func (comp *Component) Start(options *GlobalOptions) error

func (*Component) Stop

func (comp *Component) Stop(options *GlobalOptions) error

func (*Component) UpdateHooks

func (comp *Component) UpdateHooks(options *GlobalOptions, elcBinary string, scriptsFolder string) error

func (*Component) Wrap

func (comp *Component) Wrap(command []string, options *GlobalOptions) (int, error)

type ComponentConfig

type ComponentConfig struct {
	Alias          string              `yaml:"alias"`
	ComposeFile    string              `yaml:"compose_file"`
	Dependencies   map[string]ModeList `yaml:"dependencies"`
	ExecPath       string              `yaml:"exec_path"`
	Extends        string              `yaml:"extends"`
	HostedIn       string              `yaml:"hosted_in"`
	Hostname       string              `yaml:"hostname"`
	IsTemplate     bool                `yaml:"is_template"`
	Path           string              `yaml:"path"`
	Replace        bool                `yaml:"replace"`
	Variables      yaml.MapSlice       `yaml:"variables"`
	Repository     string              `yaml:"repository"`
	Tags           []string            `yaml:"tags"`
	AfterCloneHook string              `yaml:"after_clone_hook"`
}

func (*ComponentConfig) GetDeps

func (cc *ComponentConfig) GetDeps(mode string) []string

type Context

type Context [][]string

func (*Context) RenderString

func (ctx *Context) RenderString(str string) (string, error)

type GlobalOptions

type GlobalOptions struct {
	WorkspaceName string
	ComponentName string
	Debug         bool
	Cmd           []string
	Force         bool
	Mode          string
	WorkingDir    string
	UID           int
	Tag           string
	DryRun        bool
	NoTty         bool
}

type HomeConfig

type HomeConfig struct {
	Path             string           `yaml:"-"`
	CurrentWorkspace string           `yaml:"current_workspace"`
	UpdateCommand    string           `yaml:"update_command"`
	Workspaces       []HomeConfigItem `yaml:"workspaces"`
}

func CheckAndLoadHC

func CheckAndLoadHC() (*HomeConfig, error)

func LoadHomeConfig

func LoadHomeConfig(configPath string) (*HomeConfig, error)

func (*HomeConfig) AddWorkspace

func (hc *HomeConfig) AddWorkspace(name string, path string) error

func (*HomeConfig) FindWorkspace

func (hc *HomeConfig) FindWorkspace(name string) *HomeConfigItem

func (*HomeConfig) FindWorkspaceByPath

func (hc *HomeConfig) FindWorkspaceByPath() (*HomeConfigItem, error)

func (*HomeConfig) GetCurrentWorkspace

func (hc *HomeConfig) GetCurrentWorkspace(wsName string) (*HomeConfigItem, error)

func (*HomeConfig) GetCurrentWsPath

func (hc *HomeConfig) GetCurrentWsPath(wsName string) (string, error)

func (*HomeConfig) RemoveWorkspace

func (hc *HomeConfig) RemoveWorkspace(name string) error

type HomeConfigItem

type HomeConfigItem struct {
	Name     string `yaml:"name"`
	Path     string `yaml:"path"`
	RootPath string `yaml:"root_path"`
}

type MockPC

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

MockPC is a mock of PC interface.

func NewMockPC

func NewMockPC(ctrl *gomock.Controller) *MockPC

NewMockPC creates a new mock instance.

func (*MockPC) Args

func (m *MockPC) Args() []string

Args mocks base method.

func (*MockPC) Chmod

func (m *MockPC) Chmod(filename string, mode os.FileMode) error

Chmod mocks base method.

func (*MockPC) CreateDir

func (m *MockPC) CreateDir(path string) error

CreateDir mocks base method.

func (*MockPC) CreateFile

func (m *MockPC) CreateFile(filename string) error

CreateFile mocks base method.

func (*MockPC) EXPECT

func (m *MockPC) EXPECT() *MockPCMockRecorder

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

func (*MockPC) ExecInteractive

func (m *MockPC) ExecInteractive(command, env []string) (int, error)

ExecInteractive mocks base method.

func (*MockPC) ExecToString

func (m *MockPC) ExecToString(command, env []string) (int, string, error)

ExecToString mocks base method.

func (*MockPC) Exit

func (m *MockPC) Exit(code int)

Exit mocks base method.

func (*MockPC) FileExists

func (m *MockPC) FileExists(filepath string) bool

FileExists mocks base method.

func (*MockPC) Getuid

func (m *MockPC) Getuid() int

Getuid mocks base method.

func (*MockPC) Getwd

func (m *MockPC) Getwd() (string, error)

Getwd mocks base method.

func (*MockPC) HomeDir

func (m *MockPC) HomeDir() (string, error)

HomeDir mocks base method.

func (*MockPC) IsTerminal

func (m *MockPC) IsTerminal() bool

IsTerminal mocks base method.

func (*MockPC) Printf

func (m *MockPC) Printf(format string, a ...interface{}) (int, error)

Printf mocks base method.

func (*MockPC) Println

func (m *MockPC) Println(a ...interface{}) (int, error)

Println mocks base method.

func (*MockPC) ReadDir

func (m *MockPC) ReadDir(dirname string) ([]os.FileInfo, error)

ReadDir mocks base method.

func (*MockPC) ReadFile

func (m *MockPC) ReadFile(filename string) ([]byte, error)

ReadFile mocks base method.

func (*MockPC) WriteFile

func (m *MockPC) WriteFile(filename string, data []byte, perm os.FileMode) error

WriteFile mocks base method.

type MockPCMockRecorder

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

MockPCMockRecorder is the mock recorder for MockPC.

func (*MockPCMockRecorder) Args

func (mr *MockPCMockRecorder) Args() *gomock.Call

Args indicates an expected call of Args.

func (*MockPCMockRecorder) Chmod

func (mr *MockPCMockRecorder) Chmod(filename, mode interface{}) *gomock.Call

Chmod indicates an expected call of Chmod.

func (*MockPCMockRecorder) CreateDir

func (mr *MockPCMockRecorder) CreateDir(path interface{}) *gomock.Call

CreateDir indicates an expected call of CreateDir.

func (*MockPCMockRecorder) CreateFile

func (mr *MockPCMockRecorder) CreateFile(filename interface{}) *gomock.Call

CreateFile indicates an expected call of CreateFile.

func (*MockPCMockRecorder) ExecInteractive

func (mr *MockPCMockRecorder) ExecInteractive(command, env interface{}) *gomock.Call

ExecInteractive indicates an expected call of ExecInteractive.

func (*MockPCMockRecorder) ExecToString

func (mr *MockPCMockRecorder) ExecToString(command, env interface{}) *gomock.Call

ExecToString indicates an expected call of ExecToString.

func (*MockPCMockRecorder) Exit

func (mr *MockPCMockRecorder) Exit(code interface{}) *gomock.Call

Exit indicates an expected call of Exit.

func (*MockPCMockRecorder) FileExists

func (mr *MockPCMockRecorder) FileExists(filepath interface{}) *gomock.Call

FileExists indicates an expected call of FileExists.

func (*MockPCMockRecorder) Getuid

func (mr *MockPCMockRecorder) Getuid() *gomock.Call

Getuid indicates an expected call of Getuid.

func (*MockPCMockRecorder) Getwd

func (mr *MockPCMockRecorder) Getwd() *gomock.Call

Getwd indicates an expected call of Getwd.

func (*MockPCMockRecorder) HomeDir

func (mr *MockPCMockRecorder) HomeDir() *gomock.Call

HomeDir indicates an expected call of HomeDir.

func (*MockPCMockRecorder) IsTerminal

func (mr *MockPCMockRecorder) IsTerminal() *gomock.Call

IsTerminal indicates an expected call of IsTerminal.

func (*MockPCMockRecorder) Printf

func (mr *MockPCMockRecorder) Printf(format interface{}, a ...interface{}) *gomock.Call

Printf indicates an expected call of Printf.

func (*MockPCMockRecorder) Println

func (mr *MockPCMockRecorder) Println(a ...interface{}) *gomock.Call

Println indicates an expected call of Println.

func (*MockPCMockRecorder) ReadDir

func (mr *MockPCMockRecorder) ReadDir(dirname interface{}) *gomock.Call

ReadDir indicates an expected call of ReadDir.

func (*MockPCMockRecorder) ReadFile

func (mr *MockPCMockRecorder) ReadFile(filename interface{}) *gomock.Call

ReadFile indicates an expected call of ReadFile.

func (*MockPCMockRecorder) WriteFile

func (mr *MockPCMockRecorder) WriteFile(filename, data, perm interface{}) *gomock.Call

WriteFile indicates an expected call of WriteFile.

type ModeList

type ModeList []string

type PC

type PC interface {
	ExecInteractive(command []string, env []string) (int, error)
	ExecToString(command []string, env []string) (int, string, error)
	Args() []string
	Exit(code int)
	HomeDir() (string, error)
	Getuid() int
	Getwd() (dir string, err error)
	FileExists(filepath string) bool
	ReadFile(filename string) ([]byte, error)
	ReadDir(dirname string) ([]os.FileInfo, error)
	CreateFile(filename string) error
	Chmod(filename string, mode os.FileMode) error
	CreateDir(path string) error
	WriteFile(filename string, data []byte, perm os.FileMode) error
	Printf(format string, a ...interface{}) (n int, err error)
	Println(a ...interface{}) (n int, err error)
	IsTerminal() bool
}
var Pc PC

type RealPC

type RealPC struct{}

func (*RealPC) Args

func (r *RealPC) Args() []string

func (*RealPC) Chmod

func (r *RealPC) Chmod(filename string, mode os.FileMode) error

func (*RealPC) CreateDir

func (r *RealPC) CreateDir(path string) error

func (*RealPC) CreateFile

func (r *RealPC) CreateFile(filename string) error

func (*RealPC) ExecInteractive

func (r *RealPC) ExecInteractive(command []string, env []string) (int, error)

func (*RealPC) ExecToString

func (r *RealPC) ExecToString(command []string, env []string) (int, string, error)

func (*RealPC) Exit

func (r *RealPC) Exit(code int)

func (*RealPC) FileExists

func (r *RealPC) FileExists(filepath string) bool

func (*RealPC) Getuid

func (r *RealPC) Getuid() int

func (*RealPC) Getwd

func (r *RealPC) Getwd() (dir string, err error)

func (*RealPC) HomeDir

func (r *RealPC) HomeDir() (string, error)

func (*RealPC) IsTerminal

func (r *RealPC) IsTerminal() bool

func (*RealPC) Printf

func (r *RealPC) Printf(format string, a ...interface{}) (n int, err error)

func (*RealPC) Println

func (r *RealPC) Println(a ...interface{}) (n int, err error)

func (*RealPC) ReadDir

func (r *RealPC) ReadDir(dirname string) ([]os.FileInfo, error)

func (*RealPC) ReadFile

func (r *RealPC) ReadFile(filename string) ([]byte, error)

func (*RealPC) WriteFile

func (r *RealPC) WriteFile(filename string, data []byte, perm os.FileMode) error

type Workspace

type Workspace struct {
	Aliases    map[string]string
	ConfigPath string
	Config     *WorkspaceConfig
	Cwd        string
	WillStart  []string
	Context    *Context
	Components map[string]*Component
}

func GetWorkspaceConfig

func GetWorkspaceConfig(wsName string) (*Workspace, error)

func NewWorkspace

func NewWorkspace(wsPath string, cwd string) *Workspace

func (*Workspace) ComponentByName

func (ws *Workspace) ComponentByName(name string) (*Component, error)

func (*Workspace) ComponentByPath

func (ws *Workspace) ComponentByPath() (*Component, error)

func (*Workspace) ComponentNameByPath

func (ws *Workspace) ComponentNameByPath() (string, error)

func (*Workspace) FindComponentNamesByTag

func (ws *Workspace) FindComponentNamesByTag(tag string) []string

func (*Workspace) GetComponentNames

func (ws *Workspace) GetComponentNames() []string

func (*Workspace) GetComponentNamesList

func (ws *Workspace) GetComponentNamesList() []string

func (*Workspace) LoadConfig

func (ws *Workspace) LoadConfig() error

type WorkspaceConfig

type WorkspaceConfig struct {
	Name          string                     `yaml:"name"`
	ElcMinVersion string                     `yaml:"elc_min_version"`
	Components    map[string]ComponentConfig `yaml:"components"`
	Variables     yaml.MapSlice              `yaml:"variables"`

	// deprecated
	Aliases map[string]string `yaml:"aliases"`
	// deprecated
	Templates map[string]ComponentConfig `yaml:"templates"`
	// deprecated
	Services map[string]ComponentConfig `yaml:"services"`
	// deprecated
	Modules map[string]ComponentConfig `yaml:"modules"`
}

func NewWorkspaceConfig

func NewWorkspaceConfig() *WorkspaceConfig

Jump to

Keyboard shortcuts

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