Ejemplo n.º 1
0
func includeFile(file string, tree *gabs.Container) error {
	loaded, err := loader.LoadFile(file)
	if err != nil {
		return err
	}

	log.Println("include:", file)

	merged, err := mergemap.Merge(loaded.Data().(map[string]interface{}), tree.Data().(map[string]interface{}))
	if err != nil {
		return err
	}

	_, err = tree.Set(merged)
	return err
}
Ejemplo n.º 2
0
func Load(path string, vars map[string]string) *Manifest {
	tree, err := loader.LoadFile(path)
	if err != nil {
		log.Fatalln("Error on load file:", err)
	}

	for k, v := range vars {
		tree.Set(v, "vars", k)
	}

	for _, proc := range processor.GetAll() {
		if err := proc.Process(tree); err != nil {
			log.Fatalf("Error in processor '%v': %v. \n\nManifest: %s", reflect.ValueOf(proc).Type().Name(), err, tree.StringIndent("", "  "))
		}
	}

	return &Manifest{tree}
}