packages

package
v1.5.6 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Undefined  = ""
	PHP        = "php"
	Javascript = "javascript"
	Ruby       = "ruby"
	Python     = "python"
	Go         = "go"
)

language constants

Variables

View Source
var (
	ErrUnknownLang                   = errors.New("command language is not defined")
	ErrRuntimeNotFound               = errors.New("unable to locate runtime")
	ErrRuntimeNoVersionFound         = errors.New("unable to determine installed version, minimum version required")
	ErrRuntimeMinimumVersionRequired = errors.New("higher version is required to install this command")
	ErrPackageManagerNotFound        = errors.New("unable to locate package manager in PATH")
	ErrPackageManagerExec            = errors.New("unable to execute package manager")
	ErrPackageNeedsReinstall         = errors.New("you must reinstall this package to continue")
	ErrPackageCompileFailure         = errors.New("unable to build binary")
	ErrPackageExecutableNotFound     = errors.New("package executable not found")
	ErrVirtualEnvCreation            = errors.New("unable to create virtual environment")
	ErrVirtualEnvActivation          = errors.New("unable to activate virtual environment")
	ErrVenvNotFound                  = errors.New("venv python package not found. Please verify your setup")
	ErrPipNotFound                   = errors.New("pip not found. Please verify your setup")
	ErrRequirementsTxtNotFound       = errors.New("requirements.txt not found in the subcommand")
	ErrRequirementsInstall           = errors.New("failed to install required python packages from requirements.txt")
	ErrPipUpgrade                    = errors.New("unable to install/upgrade pip")
	ErrPipSetuptoolsUpgrade          = errors.New("unable to execute 'python3 -m pip install --user --no-cache --upgrade pip setuptools'")
	ErrNoExeFound                    = errors.New("no executables found")
	ErrOSNotSupported                = errors.New("OS not supported")
	ErrPythonVersionNotSupported     = errors.New("python version not supported")
	ErrDirectoryCreation             = errors.New("unable to create directory")
)

Defined errors

Functions

This section is empty.

Types

type LangManager

type LangManager interface {
	// Install builds and installs contents of a directory based on provided language requirements
	Install(ctx context.Context, dir string, requirements LanguageRequirements, commands, ldFlags []string) error
	// FindExec locates language's CLI executable
	FindExec(ctx context.Context, requirements LanguageRequirements, cmdExec string) ([]string, error)
	// PrepareExecution performs any operation required before the external command invocation
	PrepareExecution(ctx context.Context, languageRequirements LanguageRequirements, dirName string) error
	// FinishExecution perform any required tear down steps for external command invocation
	FinishExecution(ctx context.Context, languageRequirements LanguageRequirements, dirName string)
	// GetShell returns the available shell
	GetShell(goos string) (string, error)
	// GetOS is a wrapper around executor.GetOS()
	GetOS() string
	// FileExists checks if the given path exists
	FileExists(path string) (bool, error)
}

LangManager allows operations on different programming languages

func NewLangManager

func NewLangManager() LangManager

NewLangManager returns a default language manager

type LanguageRequirements

type LanguageRequirements struct {
	Go     string `json:"go"`
	Php    string `json:"php"`
	Node   string `json:"node"`
	Ruby   string `json:"ruby"`
	Python string `json:"python"`
}

LanguageRequirements contains version requirements for all supported programming languages

type Mock

type Mock struct {
	mock.Mock
}

Mock LangManager interface

func (*Mock) FileExists added in v1.4.1

func (m *Mock) FileExists(path string) (bool, error)

FileExists mocks behavior of (*langManager) FileExists()

func (*Mock) FindExec

func (m *Mock) FindExec(_ context.Context, requirements LanguageRequirements, cmdExec string) ([]string, error)

FindExec mock

func (*Mock) FinishExecution added in v1.4.1

func (m *Mock) FinishExecution(_ context.Context, languageRequirements LanguageRequirements, dirName string)

FinishExecution mocks behavior of (*langManager) FinishExecution()

func (*Mock) GetOS added in v1.4.1

func (m *Mock) GetOS() string

GetOS mocks behavior of (*langManager) GetOS()

func (*Mock) GetShell added in v1.4.1

func (m *Mock) GetShell(goos string) (string, error)

GetShell mocks behavior of (*langManager) GetShell()

func (*Mock) Install

func (m *Mock) Install(_ context.Context, dir string, requirements LanguageRequirements, commands, ldFlags []string) error

Install mock

func (*Mock) PrepareExecution added in v1.4.1

func (m *Mock) PrepareExecution(_ context.Context, languageRequirements LanguageRequirements, dirName string) error

PrepareExecution mocks behavior of (*langManager) PrepareExecution()

Jump to

Keyboard shortcuts

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