github.com/greenboxal/deis@v1.12.1/builder/src/yaml2json-procfile.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  	"io/ioutil"
     6  	"os"
     7  
     8  	"github.com/deis/deis/builder"
     9  )
    10  
    11  func main() {
    12  	if fi, _ := os.Stdin.Stat(); fi.Mode()&os.ModeNamedPipe == 0 {
    13  		fmt.Println("this app requires the stdout of another process")
    14  		os.Exit(1)
    15  	}
    16  
    17  	bytes, err := ioutil.ReadAll(os.Stdin)
    18  
    19  	if err != nil {
    20  		fmt.Println("invalid input")
    21  		os.Exit(1)
    22  	}
    23  
    24  	procfile, err := builder.YamlToJSON(bytes)
    25  
    26  	if err != nil {
    27  		fmt.Println("the Procfile is not valid yaml")
    28  		os.Exit(1)
    29  	}
    30  
    31  	fmt.Println(procfile)
    32  }