files

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2021 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SCRIPT   Lang = "script"
	TEMPLATE      = "template"
	SHADER        = "shader"
)
View Source
const (
	PACKAGE_JSON     = "package.json"
	USER_DIR_ENV_KEY = "WTPATH"
	USER_REL_DIR     = ".local/share/wtsuite/private"

	SHARE_DIR_ENV_KEY = "WTSHARE"
	SHARE_REL_DIR     = ".local/share/wtsuite/public"

	PRIVSSH_ENV_KEY  = "WTSSHKEY"
	PRIVSSH_REL_PATH = ".ssh/id_rsa"
)
View Source
const (
	JSFILE_EXT = ".wts" // used by refactor and grapher
)

Variables

View Source
var (
	JS_MODE   = false
	VERBOSITY = 0
)
View Source
var AddCacheDependency func(fname string, dep string) = nil
View Source
var (
	CACHE_PACKAGES = true // the wtaas server should set this to false though
)
View Source
var FetchPublicOrPrivate func(url string, smv *SemVerRange) (string, error) = nil
View Source
var HasUpstreamCacheDependency func(thisPath string, upstreamPath string) bool = nil
View Source
var LATEST bool = false
View Source
var StartCacheUpdate func(fname string) = nil

Functions

func Abbreviate

func Abbreviate(path string) string

func AssertDir

func AssertDir(dname string) error

func AssertFile

func AssertFile(fname string) error

func IsDir

func IsDir(dname string) bool

func IsFile

func IsFile(fname string) bool

func IsURL added in v0.5.0

func IsURL(s string) bool

func PkgInstallDir added in v0.5.1

func PkgInstallDir(url string) string

func PrivatePkgInstallDir added in v0.5.1

func PrivatePkgInstallDir(url string) string

func PublicPkgInstallDir added in v0.5.1

func PublicPkgInstallDir(url string) string

func ReadPrivateSSHKey added in v0.5.1

func ReadPrivateSSHKey() (string, error)

func ResolvePackages

func ResolvePackages(startFile string) error
func Search(callerPath string, srcPath string) (string, error)

callerPath is the caller, srcPath is the file we are trying to find

func SearchPackage

func SearchPackage(caller string, pkgPath string, lang Lang) (string, error)

func SearchScript

func SearchScript(caller string, path string) (string, error)

func SearchShader

func SearchShader(caller string, path string) (string, error)

func SearchTemplate

func SearchTemplate(caller string, path string) (string, error)

func SyncPackages added in v0.2.0

func SyncPackages(startFile string, fetcher FetchFunc) error

func WalkFiles

func WalkFiles(dir string, ext string, fn func(string) error) error

guarantee that each file is only visited once ext includes the period (eg. '.wts' for script files)

func WriteFile

func WriteFile(path string, target string, content []byte) error

path is just used for info

Types

type DependencyConfig

type DependencyConfig struct {
	MinVersion string `json:"minVersion"` // should be semver, empty == -infty
	MaxVersion string `json:"maxVersion"` // should be semver, empty == +infty
	URL        string `json:"url"`        // github.com/...
}

type FetchFunc

type FetchFunc func(url string, svr *SemVerRange) (string, error)

returns the directory of the installed package

type Lang

type Lang string

type Package

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

func LoadPackage added in v0.5.1

func LoadPackage(dir string, canMoveUp bool, fetcher FetchFunc) (*Package, error)

func (*Package) GetModule

func (pkg *Package) GetModule(moduleName string, lang Lang) (string, bool)

func (*Package) SSGSemVerRange added in v0.5.1

func (pkg *Package) SSGSemVerRange() *SemVerRange

type PackageConfig

type PackageConfig struct {
	Dependencies    map[string]DependencyConfig `json:"dependencies"`
	TemplateModules map[string]string           `json:"templateModules"`
	ScriptModules   map[string]string           `json:"scriptModules"`
	ShaderModules   map[string]string           `json:"shaderModules"`
	SSG             SSGConfig                   `json:"ssg"`
}

func NewEmptyPackageConfig

func NewEmptyPackageConfig() *PackageConfig

type PathLang

type PathLang struct {
	Path    string
	Lang    Lang
	Context context.Context
}

type SSGConfig added in v0.5.1

type SSGConfig struct {
	MinVersion string `json:"minVersion"`
	MaxVersion string `json:"maxVersion"`
}

type SemVer

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

func ParseSemVer

func ParseSemVer(str string) (*SemVer, error)

func (*SemVer) After

func (s *SemVer) After(other *SemVer) bool

func (*SemVer) Write added in v0.2.0

func (s *SemVer) Write() string

type SemVerRange

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

func NewSemVerRange added in v0.2.0

func NewSemVerRange(min *SemVer, max *SemVer) *SemVerRange

func (*SemVerRange) Contains added in v0.2.0

func (sr *SemVerRange) Contains(semVer *SemVer) bool

func (*SemVerRange) FindBestVersion

func (sr *SemVerRange) FindBestVersion(dir string) (string, error)

returns empty string if no relevant version found not concatenated with dir!

func (*SemVerRange) Max added in v0.2.0

func (sr *SemVerRange) Max() *SemVer

func (*SemVerRange) Min added in v0.2.0

func (sr *SemVerRange) Min() *SemVer

Jump to

Keyboard shortcuts

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