Exemple #1
0
func main() {
	buildpack, err := bp.NewBuildpack(*bpDir)

	if err != nil {
		fmt.Println(err)
		os.Exit(1)
	}

	if err := buildpack.Run(*srcDir); err != nil {
		fmt.Println(err)
		os.Exit(1)
	}

	fmt.Print("Creating slug...")
	herokuSlug := slug.NewSlug(*apiKey, *appName, buildpack.BuildDir())
	fmt.Println("done")

	fmt.Print("Creating slug archive...")
	slugFile := herokuSlug.Archive()
	fmt.Printf("done (%s)\n", slugFile.Name())

	if *createRelease {
		fmt.Print("Uploading slug...")
		herokuSlug.Push()
		fmt.Println("done")

		fmt.Print("Releasing slug...")
		release := herokuSlug.Release()
		fmt.Printf("done (v%d)\n", release.Version)
	}
}
Exemple #2
0
func main() {
	fmt.Printf("Initializing slug for %s...", workingDir)
	s := slug.NewSlug(*fApiKey, *fAppName, workingDir)
	fmt.Printf("done\nArchiving %s...", workingDir)
	var tarFile *os.File
	if *fTar != "" {
		var err error
		tarFile, err = os.Open(*fTar)
		if err != nil {
			log.Println(err)
			return
		}
		s.SetArchive(tarFile)
	} else {
		tarFile = s.Archive()
	}

	fmt.Printf("done\nPushing %s...", tarFile.Name())
	err := s.Push()
	if err != nil {
		log.Println(err)
		return
	}
	fmt.Printf("done\n")
	if *fRelease {
		fmt.Printf("Releasing...")
		release := s.Release()
		fmt.Printf("done (v%d)", release.Version)
	}
}