files

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2021 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SCRIPT   Lang = "script"
	TEMPLATE      = "template"
	SHADER        = "shader"
)
View Source
const (
	UIFILE_EXT = ".wtt"
	JSFILE_EXT = ".wts"

	UIPACKAGE_SUFFIX = "__init__" + UIFILE_EXT
	JSPACKAGE_SUFFIX = "__init__" + JSFILE_EXT
)
View Source
const BASE_DIR = ".local/share/wtsuite/"
View Source
const PACKAGE_JSON = "package.json"
View Source
const USER_ENV_KEY = "WTPATH"

Variables

View Source
var (
	JS_MODE   = false
	VERBOSITY = 0
)
View Source
var AddCacheDependency func(fname string, dep string) = nil
View Source
var HasUpstreamCacheDependency func(thisPath string, upstreamPath string) bool = nil
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 PkgInstallDst

func PkgInstallDst(url string) string

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 SyncPackage

func SyncPackage(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) error

type Lang

type Lang string

type Package

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

func (*Package) GetModule

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

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"`
}

func NewEmptyPackageConfig

func NewEmptyPackageConfig() *PackageConfig

type PathLang

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

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

type SemVerRange

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

func (*SemVerRange) FindBestVersion

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

Jump to

Keyboard shortcuts

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