Documentation
¶
Index ¶
- Constants
- Variables
- func Asset(name string) ([]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetInfo(name string) (os.FileInfo, error)
- func AssetNames() []string
- func MustAsset(name string) []byte
- func RestoreAsset(dir, name string) error
- func RestoreAssets(dir, name string) error
- func Wdir() string
- type Buffer
- type BufferOut
- type Command
- type Context
- type FileWatcher
- type Files
- type Func
- type Ignore
- type Legacy
- type LogWriter
- type Project
- type Realize
- type Recovery
- type Resource
- type Response
- type Schema
- type Server
- type Settings
- func (s Settings) Create(path string, name string) *os.File
- func (s Settings) Fatal(err error, msg ...interface{})
- func (s *Settings) Flimit() error
- func (s *Settings) Read(out interface{}) error
- func (s *Settings) Remove(d string) error
- func (s Settings) Stream(file string) ([]byte, error)
- func (s *Settings) Write(out interface{}) error
- type Tool
- type Tools
- type Watch
Constants ¶
const ( Host = "localhost" Port = 5002 )
Dafault host and port
const ( Permission = 0775 File = ".realize.yaml" FileOut = ".r.outputs.log" FileErr = ".r.errors.log" FileLog = ".r.logs.log" )
settings const
Variables ¶
var ( // RPrefix tool name RPrefix = "realize" // RVersion current version RVersion = "2.1" // RExt file extension RExt = ".yaml" // RFile config file name RFile = "." + RPrefix + RExt //RExtWin windows extension RExtWin = ".exe" )
var ( //Output writer Output = color.Output // Red color Red = colorBase(color.FgHiRed) // Blue color Blue = colorBase(color.FgHiBlue) // Green color Green = colorBase(color.FgHiGreen) // Yellow color Yellow = colorBase(color.FgHiYellow) // Magenta color Magenta = colorBase(color.FgHiMagenta) )
Functions ¶
func Asset ¶
Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetDir ¶
AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:
data/
foo.txt
img/
a.png
b.png
then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.
func AssetInfo ¶
AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.
func MustAsset ¶
MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.
func RestoreAsset ¶
RestoreAsset restores an asset under the given directory
func RestoreAssets ¶
RestoreAssets restores an asset under the given directory recursively
Types ¶
type Buffer ¶
type Buffer struct {
StdOut []BufferOut `json:"stdOut"`
StdLog []BufferOut `json:"stdLog"`
StdErr []BufferOut `json:"stdErr"`
}
Buffer define an array buffer for each log files
type BufferOut ¶
type BufferOut struct {
Time time.Time `json:"time"`
Text string `json:"text"`
Path string `json:"path"`
Type string `json:"type"`
Stream string `json:"stream"`
Errors []string `json:"errors"`
}
BufferOut is used for exchange information between "realize cli" and "web realize"
type Command ¶
type Command struct {
Cmd string `yaml:"command" json:"command"`
Type string `yaml:"type" json:"type"`
Path string `yaml:"path,omitempty" json:"path,omitempty"`
Global bool `yaml:"global,omitempty" json:"global,omitempty"`
Output bool `yaml:"output,omitempty" json:"output,omitempty"`
}
Command fields
type Context ¶
type Context struct {
Path string
Project *Project
Stop <-chan bool
Watcher FileWatcher
Event fsnotify.Event
}
Context is used as argument for func
type FileWatcher ¶
type FileWatcher interface {
Close() error
Add(string) error
Walk(string, bool) string
Remove(string) error
Errors() <-chan error
Events() <-chan fsnotify.Event
}
FileWatcher is an interface for implementing file notification watchers
func EventWatcher ¶
func EventWatcher() (FileWatcher, error)
EventWatcher returns an fs-event based file watcher
func NewFileWatcher ¶
func NewFileWatcher(l Legacy) (FileWatcher, error)
NewFileWatcher tries to use an fs-event watcher, and falls back to the poller if there is an error
func PollingWatcher ¶
func PollingWatcher(interval time.Duration) FileWatcher
PollingWatcher returns a poll-based file watcher
type Files ¶
type Files struct {
Clean bool `yaml:"clean,omitempty" json:"clean,omitempty"`
Outputs Resource `yaml:"outputs,omitempty" json:"outputs,omitempty"`
Logs Resource `yaml:"logs,omitempty" json:"log,omitempty"`
Errors Resource `yaml:"errors,omitempty" json:"error,omitempty"`
}
Files defines the files generated by realize
type Legacy ¶
type Legacy struct {
Force bool `yaml:"force" json:"force"`
Interval time.Duration `yaml:"interval" json:"interval"`
}
Legacy is used to force polling and set a custom interval
type Project ¶
type Project struct {
Name string `yaml:"name" json:"name"`
Path string `yaml:"path" json:"path"`
Env map[string]string `yaml:"env,omitempty" json:"env,omitempty"`
Args []string `yaml:"args,omitempty" json:"args,omitempty"`
Tools Tools `yaml:"commands" json:"commands"`
Watcher Watch `yaml:"watcher" json:"watcher"`
Buffer Buffer `yaml:"-" json:"buffer"`
ErrPattern string `yaml:"pattern,omitempty" json:"pattern,omitempty"`
// contains filtered or unexported fields
}
Project info
type Realize ¶
type Realize struct {
Settings Settings `yaml:"settings" json:"settings"`
Server Server `yaml:"server,omitempty" json:"server,omitempty"`
Schema `yaml:",inline" json:",inline"`
Sync chan string `yaml:"-" json:"-"`
Err Func `yaml:"-" json:"-"`
After Func `yaml:"-" json:"-"`
Before Func `yaml:"-" json:"-"`
Change Func `yaml:"-" json:"-"`
Reload Func `yaml:"-" json:"-"`
}
Realize main struct
type Schema ¶
type Schema struct {
Projects []Project `yaml:"schema" json:"schema"`
}
Schema projects list
type Server ¶
type Server struct {
Parent *Realize `yaml:"-" json:"-"`
Status bool `yaml:"status" json:"status"`
Open bool `yaml:"open" json:"open"`
Port int `yaml:"port" json:"port"`
Host string `yaml:"host" json:"host"`
}
Server settings
type Settings ¶
type Settings struct {
Files `yaml:"files,omitempty" json:"files,omitempty"`
FileLimit int32 `yaml:"flimit,omitempty" json:"flimit,omitempty"`
Legacy Legacy `yaml:"legacy" json:"legacy"`
Recovery Recovery `yaml:"recovery,omitempty" json:"recovery,omitempty"`
}
Settings defines a group of general settings and options
type Tool ¶
type Tool struct {
Args []string `yaml:"args,omitempty" json:"args,omitempty"`
Method string `yaml:"method,omitempty" json:"method,omitempty"`
Dir string `yaml:"dir,omitempty" json:"dir,omitempty"` //wdir of the command
Status bool `yaml:"status,omitempty" json:"status,omitempty"`
Output bool `yaml:"output,omitempty" json:"output,omitempty"`
// contains filtered or unexported fields
}
Tool info
type Tools ¶
type Tools struct {
Clean Tool `yaml:"clean,omitempty" json:"clean,omitempty"`
Vet Tool `yaml:"vet,omitempty" json:"vet,omitempty"`
Fmt Tool `yaml:"fmt,omitempty" json:"fmt,omitempty"`
Test Tool `yaml:"test,omitempty" json:"test,omitempty"`
Generate Tool `yaml:"generate,omitempty" json:"generate,omitempty"`
Install Tool `yaml:"install,omitempty" json:"install,omitempty"`
Build Tool `yaml:"build,omitempty" json:"build,omitempty"`
Run Tool `yaml:"run,omitempty" json:"run,omitempty"`
}
Tools go
type Watch ¶
type Watch struct {
Exts []string `yaml:"extensions" json:"extensions"`
Paths []string `yaml:"paths" json:"paths"`
Scripts []Command `yaml:"scripts,omitempty" json:"scripts,omitempty"`
Hidden bool `yaml:"hidden,omitempty" json:"hidden,omitempty"`
Ignore Ignore `yaml:"ignore,omitempty" json:"ignore,omitempty"`
}
Watch info