Help us shape the future of Go! Take the 2026 Go Developer Survey

workshop

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RootEnvName the environment variable name of the workshop root path in the local disk
	RootEnvName = "YAO_PATH"
)

Variables

This section is empty.

Functions

func ConfigRoot

func ConfigRoot() (string, error)

ConfigRoot get the workshop root in the local disk

func Format

func Format(root string) error

Format scan the source and format DSL code

func LocalRoot

func LocalRoot() (string, error)

LocalRoot get the root path in the local disk the default is: ~/yao/

func Root

func Root() (string, error)

Root get the workshop root in the local disk

func Tidy

func Tidy(root string) error

Tidy scan the source and update workshop.yao then auto-generation the workshop.sum.yao file

Types

type Config

type Config map[string]map[string]interface{}

Config the workshop config file

func GetConfig

func GetConfig() (Config, error)

GetConfig get the workshop config

type Package

type Package struct {
	URL        string         // github.com/yaoapp/demo-wms/cloud@v0.0.0-20220223010332-e86eab4c8490
	Name       string         // github.com/yaoapp/demo-wms/cloud
	Alias      string         // github.com/yaoapp/demo-wms/cloud
	Addr       string         // github.com/yaoapp/demo-wms
	Domain     string         // github.com
	Owner      string         // trheyi
	Repo       string         // demo-wms
	Path       string         // /cloud
	Version    semver.Version // 0.0.0-e86eab4c8490
	Rel        string         // e86eab4c8490 ( 0.9.2 / v0.9.1 / master )
	LocalPath  string         //
	Downloaded bool           // true
	Replaced   bool           // false
	Unique     string         // github.com/yaoapp/demo-wms@e86eab4c8490
	Indirect   bool           // true
	Parents    []string       // parent
}

Package the YAO package info

func (*Package) Cache

func (pkg *Package) Cache(root string) string

Cache get the package cache name

func (*Package) Dependencies

func (pkg *Package) Dependencies() ([]*Package, error)

Dependencies get the Dependencies of the package

func (*Package) Download

func (pkg *Package) Download(root string, option map[string]interface{}, process func(total uint64, pkg *Package, message string)) (string, error)

Download download the package

func (*Package) IsDownload

func (pkg *Package) IsDownload() (bool, error)

IsDownload check if the package has been downloaded.

func (*Package) LocalRepo

func (pkg *Package) LocalRepo(root string) string

LocalRepo get the package repo local path

func (Package) Map

func (pkg Package) Map() map[string]interface{}

Map package to map[string]interface{}

func (Package) MarshalJSON

func (pkg Package) MarshalJSON() ([]byte, error)

MarshalJSON for json

func (*Package) Option

func (pkg *Package) Option(cfg Config) map[string]interface{}

Option get the package option

func (*Package) Set

func (pkg *Package) Set(url string, alias string) error

Set set repo and alias

func (*Package) SetAddr

func (pkg *Package) SetAddr(url string) error

SetAddr parse and set repo, domain, owner, repo, path and name

func (*Package) SetIndirect

func (pkg *Package) SetIndirect(indirect bool)

SetIndirect set the indirect value

func (*Package) SetLocalPath

func (pkg *Package) SetLocalPath() error

SetLocalPath get the local root path

func (*Package) SetVersion

func (pkg *Package) SetVersion(ver string) error

SetVersion parse and set version, commit

func (*Package) UnmarshalJSON

func (pkg *Package) UnmarshalJSON(data []byte) error

UnmarshalJSON for json

type Workshop

type Workshop struct {
	Require []*Package        `json:"require,omitempty"`
	Replace map[string]string `json:"replace,omitempty"` // for multi projects development
	Mapping map[string]*Package
	// contains filtered or unexported fields
}

Workshop the required packages

func Open

func Open(root string) (*Workshop, error)

Open and parse the workshop dsl

func (*Workshop) Add

func (workshop *Workshop) Add(pkg *Package, process func(total uint64, pkg *Package, message string), parent string) error

Add add a package to workshop.ayo

func (*Workshop) Bytes

func (workshop *Workshop) Bytes() ([]byte, error)

Bytes format and the workshop content

func (*Workshop) Del

func (workshop *Workshop) Del(pkg *Package) error

Del delete a package from workshop.yao

func (*Workshop) Download

func (workshop *Workshop) Download(pkg *Package, process func(total uint64, pkg *Package, message string)) (string, error)

Download and unzip a package

func (*Workshop) Get

func (workshop *Workshop) Get(url, alias string, process func(total uint64, pkg *Package, message string)) error

Get the url from the given remote repo url:

github.com/yaoapp/demo-crm
github.com/yaoapp/demo-crm@v0.9.1
github.com/yaoapp/demo-crm@e86eab4c8490
github.com/yaoapp/demo-wms/cloud@e86eab4c8490
github.com/yaoapp/demo-wms/edge@e86eab4c8490

func (*Workshop) Has

func (workshop *Workshop) Has(name string) bool

Has the package

func (Workshop) Map

func (workshop Workshop) Map() map[string]interface{}

Map workshop to map[string]interface{}

func (*Workshop) Package

func (workshop *Workshop) Package(url, alias string) (*Package, error)

Package create a new package

func (*Workshop) Refresh

func (workshop *Workshop) Refresh(process func(total uint64, pkg *Package, message string)) error

Refresh the workshop

func (*Workshop) Remove

func (workshop *Workshop) Remove(url string) error

Remove the url from the given remote repo url:

github.com/yaoapp/demo-crm
github.com/yaoapp/demo-crm@v0.9.1
github.com/yaoapp/demo-crm@e86eab4c8490
github.com/yaoapp/demo-wms/cloud@e86eab4c8490
github.com/yaoapp/demo-wms/edge@e86eab4c8490

func (Workshop) Root

func (workshop Workshop) Root() string

Root get the workshop root

func (*Workshop) Save

func (workshop *Workshop) Save() error

Save save the workshop to the file

func (*Workshop) SetMapping

func (workshop *Workshop) SetMapping() error

SetMapping mapping alias and package

Jump to

Keyboard shortcuts

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