Exemplo n.º 1
0
func main() {
	flag.Parse()

	var manifest Manifest

	if stat, _ := os.Stdin.Stat(); stat.Mode()&os.ModeCharDevice == 0 {
		man, err := ioutil.ReadAll(os.Stdin)

		if err != nil {
			die(err)
		}

		err = yaml.Unmarshal(man, &manifest)

		if err != nil {
			die(err)
		}
	}

	data, err := buildTemplate(flagMode, "formation", randomPort, manifest)

	if err != nil {
		displaySyntaxError(data, err)
		die(err)
	}

	fmt.Println(data)
}
Exemplo n.º 2
0
func TestManifestEntryNames(t *testing.T) {
	var manifest Manifest
	man := readFile(t, "fixtures", "web_postgis.yml")
	yaml.Unmarshal(man, &manifest)

	cases := Cases{
		{manifest.EntryNames(), []string{"postgres", "web"}},
	}

	_assert(t, cases)
}
Exemplo n.º 3
0
func readManifest(t *testing.T, dir string, name string) Manifest {
	man := readFile(t, dir, name)

	var manifest Manifest
	err := yaml.Unmarshal(man, &manifest)

	if err != nil {
		t.Errorf("ERROR readManifest %v %v", filepath.Join(dir, name), err)
	}

	return manifest
}