rizla

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2016 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package rizla contains the source code of the rizla project

Index

Constants

This section is empty.

Variables

View Source
var DefaultDisableProgramRerunOutput = false

DefaultDisableProgramRerunOutput a long name but, it disables the output of the program's 'messages' after the first successfully run for each of the projects the project iteral can be override this value. set to true to disable the program's output when reloads

View Source
var (
	// Out The Printer output for watcher errors
	// set this by rizla.NewPrinter(*os.File)
	Out = NewPrinter(os.Stdout)
)

Functions

func Add

func Add(proj ...*Project)

Add project(s) to the container

func DefaultGoMatcher

func DefaultGoMatcher(fullname string) bool

DefaultGoMatcher is the default Matcher for the Project iteral

func DefaultOnReload

func DefaultOnReload(p *Project) func(string)

DefaultOnReload fired when file has changed and reload going to happens

func DefaultOnReloaded

func DefaultOnReloaded(p *Project) func(string)

DefaultOnReloaded fired when reload has been finished

func DefaultWatcher

func DefaultWatcher(abs string) bool

DefaultWatcher is the default Watcher for the Project iteral allows all subdirs except .git, node_modules and vendor

func Len

func Len() int

Len how much projects have been added so far

func RemoveAll

func RemoveAll()

RemoveAll clears the current projects, doesn't stop them if running

func Run

func Run(sources ...string)

Run starts the repeat of the build-run-watch-reload task of all projects receives optional parameters which can be the main source file of the project(s) you want to add, they can work nice with .Add(project) also, so dont worry use it.

func Stop

func Stop()

Stop any projects are watched by the Run method, this function should be call when you call the Run inside a goroutine.

Types

type MatcherFunc

type MatcherFunc func(string) bool

MatcherFunc returns whether the file should be watched for the reload

type Printer

type Printer struct {
	*color.Color
	// contains filtered or unexported fields
}

Printer the printer for a rizla instance

func NewPrinter

func NewPrinter(out *os.File) *Printer

NewPrinter returns a new colorable printer

func (*Printer) Close

func (printer *Printer) Close() error

Close closes the underline output stream

func (*Printer) Dangerf

func (printer *Printer) Dangerf(format string, a ...interface{})

Dangerf prints a message with red colored letters

func (*Printer) Infof

func (printer *Printer) Infof(format string, a ...interface{})

Infof prints a message with cyan colored letters

func (*Printer) Name

func (printer *Printer) Name() string

Name returns the underline output stream Name

func (*Printer) Successf

func (printer *Printer) Successf(format string, a ...interface{})

Successf prints a message with green colored letters

type Project

type Project struct {
	// optional Name for the project
	Name string
	// MainFile is the absolute path of the go project's main file source.
	MainFile string
	Args     []string
	// The Output destination (sent by rizla and your program)
	Out *Printer
	// The Err Output destination (sent on rizla errors and your program's errors)
	Err *Printer
	// Watcher accepts subdirectories by the watcher
	// executes before the watcher starts,
	// if return true, then this (absolute) subdirectory is watched by watcher
	// the default accepts all subdirectories but ignores the ".git", "node_modules" and "vendor"
	Watcher MatcherFunc
	Matcher MatcherFunc
	// AllowReloadAfter skip reload on file changes that made too fast from the last reload
	// minimum allowed duration is 3 seconds.
	AllowReloadAfter time.Duration
	// OnReload fires when when file has been changed and rizla is going to reload the project
	// the parameter is the changed file name
	OnReload func(string)
	// OnReloaded fires when rizla finish with the reload
	// the parameter is the changed file name
	OnReloaded func(string)
	// DisableRuntimeDir set to true to disable adding subdirectories into the watcher, when a folder created at runtime
	// set to true to disable the program's output when reloads
	// defaults to false
	DisableRuntimeDir bool
	// DisableProgramRerunOutput a long name but, it disables the output of the program's 'messages' after the first successfully run
	// defaults to false
	DisableProgramRerunOutput bool
	// contains filtered or unexported fields
}

Project the struct which contains the necessary fields to watch and reload(rerun) a go project

func NewProject

func NewProject(mainfile string) *Project

NewProject returns a simple project iteral which doesn't needs argument parameters and has the default file matcher ( which is valid if you want to reload only on .Go files).

You can change all of its fields before the .Run function.

Jump to

Keyboard shortcuts

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