Beispiel #1
0
// Run is the top-level runner for modd
func Run(log termlog.TermLog, cnf *conf.Config, watchconf string, notifiers []notify.Notifier) (*conf.Config, error) {
	shellMethod := cnf.GetVariables()[shellVarName]
	if !shell.Has(shellMethod) {
		return nil, fmt.Errorf("No shell interface %q", shellMethod)
	}
	modchan := make(chan *watch.Mod, 1024)
	return runOnChan(modchan, func() {}, log, cnf, watchconf, notifiers)
}
Beispiel #2
0
// ReadConfig parses the configuration file in ConfPath
func (mr *ModRunner) ReadConfig() error {
	ret, err := ioutil.ReadFile(mr.ConfPath)
	if err != nil {
		return fmt.Errorf("Error reading config file %s: %s", mr.ConfPath, err)
	}
	newcnf, err := conf.Parse(mr.ConfPath, string(ret))
	if err != nil {
		return fmt.Errorf("Error reading config file %s: %s", mr.ConfPath, err)
	}

	shellMethod := newcnf.GetVariables()[shellVarName]
	if !shell.Has(shellMethod) {
		return fmt.Errorf("No shell interface %q", shellMethod)
	}

	newcnf.CommonExcludes(CommonExcludes)
	mr.Config = newcnf
	return nil
}