checker

package
v0.0.0-...-17ed7cf Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UnsafeDecorator = iota
	DescriptionDecorator
	OptionsDecorator
	EnvironmentDecorator
	SudoDecorator
	UnknownDecorator
)

Variables

View Source
var EnvironmentDataPath = filepath.Join(shared.LocalStateSpitoPath, "environment-data.json")
View Source
var NotEnvironmentErr = errors.New("called rule is not an environment")

Functions

func ApplyEnvironmentByIdentifier

func ApplyEnvironmentByIdentifier(importLoopData *shared.ImportLoopData, identifierOrPath string, envName string) error

func ApplyEnvironmentScript

func ApplyEnvironmentScript(importLoopData *shared.ImportLoopData, script string, scriptPath string) error

func CheckRuleByIdentifier

func CheckRuleByIdentifier(importLoopData *shared.ImportLoopData, identifier string, ruleName string) (bool, error)

func CheckRuleByPath

func CheckRuleByPath(importLoopData *shared.ImportLoopData, rulesetPath string, ruleName string) (bool, error)

func CheckRuleScript

func CheckRuleScript(importLoopData *shared.ImportLoopData, script string, scriptDirectory string) (bool, error)

func ExecuteLuaMain

func ExecuteLuaMain(L *lua.LState) (bool, error)

func ExecuteLuaRevert

func ExecuteLuaRevert(L *lua.LState) (bool, error)

func FetchRuleset

func FetchRuleset(rulesetLocation *RulesetLocation) error

func GetAllDownloadedRuleSets

func GetAllDownloadedRuleSets() ([]string, error)

func GetDecoratorArguments

func GetDecoratorArguments(decoratorCode string) ([]string, map[string]string, error)

func GetDefaultRepoPrefix

func GetDefaultRepoPrefix() string

func GetLuaState

func GetLuaState(script string, importLoopData *shared.ImportLoopData, ruleConf *shared.RuleConfigLayout, rulesetPath string) (*lua.LState, error)

func GetRevertRuleFn

func GetRevertRuleFn(infoApi shared.InfoInterface) func(rule vrctFs.Rule) error

func GetRevertRuleFnFromScript

func GetRevertRuleFnFromScript(infoApi shared.InfoInterface) func(rule vrctFs.Rule) error

func GetRuleConfFromScriptPath

func GetRuleConfFromScriptPath(scriptPath string) (shared.RuleConfigLayout, error)

func GetRulesetConf

func GetRulesetConf(rulesetLocation *RulesetLocation) (shared.ConfigFileLayout, error)

func InstallDependency

func InstallDependency(ruleIdentifier string, waitGroup *sync.WaitGroup, errChan chan error)

func ReadSpitoYaml

func ReadSpitoYaml(rulesetLocation *RulesetLocation) ([]byte, error)

Types

type AppliedEnvironment

type AppliedEnvironment struct {
	RevertNum        int    `json:"revertNumber"`
	IdentifierOrPath string `json:"identifierOrPath,omitempty"`
	IsApplied        bool
}

type AppliedEnvironments

type AppliedEnvironments []*AppliedEnvironment

func ReadAppliedEnvironments

func ReadAppliedEnvironments() (AppliedEnvironments, error)

func (*AppliedEnvironments) RevertOther

func (e *AppliedEnvironments) RevertOther(importLoopData *shared.ImportLoopData, envIdentifierOrPath string) error

func (*AppliedEnvironments) Save

func (e *AppliedEnvironments) Save() error

func (*AppliedEnvironments) SetAsApplied

func (e *AppliedEnvironments) SetAsApplied(envIdentifierOrPath string, revertNum int)

type DecoratorType

type DecoratorType uint

func GetDecoratorType

func GetDecoratorType(name string) (DecoratorType, error)

type DependencyTreeLayout

type DependencyTreeLayout struct {
	Dependencies map[string][]string `yaml:"dependencies"`
}

type LuaNamespace

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

func (LuaNamespace) AddField

func (ln LuaNamespace) AddField(name string, field lua.LValue)

func (LuaNamespace) AddFn

func (ln LuaNamespace) AddFn(name string, fn interface{})

type RawDecorator

type RawDecorator struct {
	Type    DecoratorType
	Content string
}

func GetDecorators

func GetDecorators(script string) (string, []RawDecorator, error)

GetDecorators Returns script without decorators and array of decorator values

type Rule

type Rule struct {
	Url          string `json:"Url" bson:"Url"`
	Name         string `json:"Name" bson:"Name"`
	IsInProgress bool   `json:"IsInProgress" bson:"IsInProgress"`
}

type RulesHistory

type RulesHistory map[string]Rule

func (RulesHistory) Contains

func (r RulesHistory) Contains(url string, name string) bool

func (RulesHistory) IsRuleInProgress

func (r RulesHistory) IsRuleInProgress(url string, name string) bool

func (RulesHistory) Push

func (r RulesHistory) Push(url string, name string, isInProgress bool)

func (RulesHistory) SetProgress

func (r RulesHistory) SetProgress(url string, name string, isInProgress bool)

type RulesetLocation

type RulesetLocation struct {
	IsPath bool
	// contains filtered or unexported fields
}

RulesetLocation represent enum with value, only one of fields must be set

func NewRulesetLocation

func NewRulesetLocation(identifierOrPath string, isPath bool) (RulesetLocation, error)

NewRulesetLocation e.g., from: https://github.com/avorty/spito-ruleset.git to avorty/spito-ruleset

func (*RulesetLocation) CreateDir

func (r *RulesetLocation) CreateDir() error

func (*RulesetLocation) GetFullUrl

func (r *RulesetLocation) GetFullUrl() *string

func (*RulesetLocation) GetIdentifier

func (r *RulesetLocation) GetIdentifier() string

func (*RulesetLocation) GetRulesetPath

func (r *RulesetLocation) GetRulesetPath() string

func (*RulesetLocation) IsRuleSetDownloaded

func (r *RulesetLocation) IsRuleSetDownloaded() bool

Jump to

Keyboard shortcuts

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