Exemplo n.º 1
0
func RollUp() error {
	operationDir := core.Get("core.path.operations")
	if util.Exists("./operations") {
		err := runOps("./operations")
		if err != nil {
			return err
		}
	} else if util.Exists(operationDir) {
		err := runOps(operationDir)
		if err != nil {
			return err
		}
	} else {
		return errors.New("Missing operation folder")
	}
	return nil
}
Exemplo n.º 2
0
Arquivo: file.go Projeto: calj/kaigara
func Parse() (Metamap, error) {
	metapath := core.Get("core.path.metadata")
	metafiles, err := util.ReadGlob(metapath + "/*.y*ml")
	metadata := Metamap{}

	if err != nil {
		return nil, err
	}

	for _, metafile := range metafiles {
		log.Debug("Found Metadata: " + metafile)
		data, err := LoadYaml(metafile)
		if err != nil {
			log.Error(err.Error())
		}
		for k, v := range data {
			metadata[k] = v
		}
	}
	return metadata, nil
}
Exemplo n.º 3
0
// renderCmd represents the render command
var renderCmd = &cobra.Command{
	Use:   "render TEMPLATE",
	Short: "Generate a file on STDOUT from a TEMPLATE",
	Long: `Read metadata files for rendering resource pipeline

In local development it is recommended to mount default.yml
using -v default.yml:/etc/kaigara/default.yml

Example: kaigara render server.conf > /etc/server.conf`,

	Run: func(cmd *cobra.Command, args []string) {

		if len(args) > 0 {
			data, err := metadata.Parse()
			template := fmt.Sprintf("%s/%s.tmpl", core.Get("core.path.resources"), args[0])

			if err != nil {
				log.Fatal(err.Error())
			}

			output, err := resource.Render(template, data)
			if err != nil {
				log.Fatal(err.Error())
			}
			fmt.Print(output)
		} else {
			log.Error("No template given")
		}
	},
}