model

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppContext

type AppContext struct {
	AppName            string
	LockFileName       string
	HomeDir            string
	UserDir            string
	UserConfigFileName string
	UserCacheDirName   string
	ConfigFileNames    []string
	UserConfig         UserConfig
}

func NewDefaultAppContext

func NewDefaultAppContext() *AppContext

type Coord

type Coord interface {
	CanonicalNameNoVersion() string
	// contains filtered or unexported methods
}

type ExecContext

type ExecContext struct {
	Sub   []ExecContext
	Alias map[string]string
	// contains filtered or unexported fields
}

func (*ExecContext) Env

func (o *ExecContext) Env() map[string]string

func (*ExecContext) ResolveAlias

func (o *ExecContext) ResolveAlias(args []string) []string

func (*ExecContext) Set

func (o *ExecContext) Set(k, v string) *ExecContext

func (*ExecContext) SetPath

func (o *ExecContext) SetPath(path []string)

type FuzzyConfigContent

type FuzzyConfigContent struct {
	BinDir   string            `ion:"binDir" json:"binDir" hcl:"binDir,optional"`
	Deps     []string          `ion:"deps" json:"deps" hcl:"deps,optional"`
	Export   map[string]string `ion:"env" json:"env" hcl:"env,optional"`
	Alias    map[string]string `ion:"alias" json:"alias" hcl:"alias,optional"`
	Triggers *Triggers         `ion:"triggers" json:"triggers,omitempty" hcl:"triggers,block"`
	Remain   hcl.Body          `ion:"-" json:"-" hcl:",remain"`
}

func FuzzyConfigContentFromFile

func FuzzyConfigContentFromFile(f string) (*FuzzyConfigContent, error)

func (*FuzzyConfigContent) String

func (c *FuzzyConfigContent) String() string

type FuzzyCoord

type FuzzyCoord struct {
	OriginalString string // original string
	Server         string // github.com | local.local
	Owner          string // rhamerica
	Repo           string // myrepo
	Version        string // no v
}

func NewCoordFromStr

func NewCoordFromStr(depStr string) (*FuzzyCoord, error)

func (*FuzzyCoord) CanonicalNameNoVersion

func (d *FuzzyCoord) CanonicalNameNoVersion() string

func (*FuzzyCoord) String

func (d *FuzzyCoord) String() string

type LockedConfigContent

type LockedConfigContent struct {
	BinDir   string            `ion:"binDir" json:"binDir,omitempty"`
	Deps     []*LockedCoord    `ion:"deps" json:"deps,omitempty"`
	Export   map[string]string `ion:"env" json:"env,omitempty"`
	Alias    map[string]string `ion:"alias" json:"alias,omitempty"`
	Triggers Triggers          `ion:"triggers" json:"triggers,omitempty"`
}

func LockedConfigContentFromFile

func LockedConfigContentFromFile(f string) (*LockedConfigContent, error)

type LockedCoord

type LockedCoord struct {
	Server  string  `ion:"server" json:"server"`
	Owner   string  `ion:"owner" json:"owner"`
	Repo    string  `ion:"repo" json:"repo"`
	Version Version `ion:"version" json:"version"` // no v
}

func (*LockedCoord) CanonicalNameNoVersion

func (d *LockedCoord) CanonicalNameNoVersion() string

func (*LockedCoord) String

func (o *LockedCoord) String() string

type PreRunCtx

type PreRunCtx struct {
	Path []string          `json:"path"`
	Env  map[string]string `json:"env"`
}

type ResolvedDependency

type ResolvedDependency struct {
	Coord    LockedCoord
	Dir      string                // directory where it is extracted
	BinDir   string                // directory where binaries are extracted
	Exports  map[string]string     // environment vars
	Alias    map[string]string     // aliases
	Triggers Triggers              // triggers
	Sub      []*ResolvedDependency // Sub Dependencies
}

func (*ResolvedDependency) BinDirOrDefault

func (ed *ResolvedDependency) BinDirOrDefault() string

func (*ResolvedDependency) Resolve

func (ed *ResolvedDependency) Resolve() *ExecContext

Resolve returns a slice with bin dirs to be prepended to PATH os var and a map with all environment variables to be added. It resolves all of these values recursevily

type Triggers

type Triggers struct {
	InstallScript string   `ion:"installScript" json:"installScript,omitempty" hcl:"installScript,optional"`
	PreRunScript  string   `ion:"preRunScript" json:"preRunScript,omitempty" hcl:"preRunScript,optional"`
	Remain        hcl.Body `ion:"-" json:"-" hcl:",remain"`
}

func (*Triggers) RunInstallScript

func (o *Triggers) RunInstallScript(lcc *LockedConfigContent) error

type UserConfig

type UserConfig struct {
	Servers []UserConfigServer `ion:"server" hcl:"server,block"`
}
server "github.com" {
		token: "abcde..."
}

------------

{
	server: {
		"github.com": {
			token: "abcde..."
		}
	}
}

func NewUserConfigFromFile

func NewUserConfigFromFile(f string) (*UserConfig, error)

func (*UserConfig) GetServerToken

func (o *UserConfig) GetServerToken(serverName string) string

type UserConfigIon

type UserConfigIon struct {
	Servers map[string]UserConfigServer `ion:"server"`
}

type UserConfigServer

type UserConfigServer struct {
	Name  string `ion:"name" hcl:",label"`
	Token string `ion:"token" hcl:"token,optional"`
}

type Version

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

func NewVersion

func NewVersion(s string) Version

func (*Version) Canonical

func (o *Version) Canonical() string

func (*Version) Compare

func (o *Version) Compare(v Version) int

func (*Version) MarshalIon

func (o *Version) MarshalIon(w ion.Writer) error

func (*Version) MarshalJSON

func (o *Version) MarshalJSON() ([]byte, error)

func (*Version) Original

func (o *Version) Original() string

func (*Version) String

func (o *Version) String() string

func (*Version) UnmarshalIon

func (o *Version) UnmarshalIon(r ion.Reader) error

func (*Version) UnmarshalJSON

func (o *Version) UnmarshalJSON(data []byte) error

type VersionPattern

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

func NewVersionPattern

func NewVersionPattern(s string) VersionPattern

func (*VersionPattern) Matches

func (o *VersionPattern) Matches(v Version) bool

Jump to

Keyboard shortcuts

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