예제 #1
0
func main() {
	// Create a pipeline (Develop using Verbose, Change to Silent after testing)
	p := goauto.NewPipeline("Go Pipeline", goauto.Verbose)
	defer p.Stop()

	// Watch directories recursively, ignoring hidden directories
	wd := filepath.Join("src", "github.com", "breml", "gosampler")
	if err := p.WatchRecursive(wd, goauto.IgnoreHidden); err != nil {
		panic(err)
	}

	// Create a workflow
	wf := goauto.NewWorkflow(
		gotask.NewGoVetTask(),
		gotask.NewGoLintTask(),
		gotask.NewGoTestTask(),
		gotask.NewGoInstallTask())

	// Add a file pattern to match
	if err := wf.WatchPattern(".*\\.go$"); err != nil {
		panic(err)
	}

	// Add workflow to pipeline
	p.Add(wf)

	// start the pipeline, it will block
	p.Start()
}
예제 #2
0
func developmentLess(sourcePath, targetPath string) {

	p := goauto.NewPipeline("Less Pipeline", goauto.Verbose)
	defer p.Stop()

	if err := p.WatchRecursive(sourcePath, goauto.IgnoreHidden); err != nil {
		panic(err)
	}

	workflow := goauto.NewWorkflow(NewFuncCmd(func() error {
		return compileLess(filepath.Join(sourcePath, "index.less"), targetPath)
	}))

	if err := workflow.WatchPattern(".*\\.less$"); err != nil {
		panic(err)
	}
	p.Add(workflow)
	p.Start()
}
예제 #3
0
func TestRestartWorkflow(t *testing.T) {
	tsk := NewRestartTask("echo", "GoAuto!!!") // non blocking command
	ti := goauto.TaskInfo{Tout: ioutil.Discard, Terr: ioutil.Discard, Verbose: goauto.Verbose}
	wf := goauto.NewWorkflow(tsk)
	wf.Run(&ti)
}