Beispiel #1
0
func main() {
	if len(os.Args) <= 1 {
		io.Error("<Usage>:", os.Args[0], "<app-name>")
	}

	go signals.Handle()

	config.InitHerokuAuth()
	io.Infof("Heroku authentication... ")
	var err error
	HerokuApp, err = config.HerokuClient.AppInfo(os.Args[1])
	if err != nil {
		fmt.Println("ERR")
		io.Error(err)
	}
	fmt.Println("OK")

	io.Infof("Scalingo authentication... ")
	u, err := config.LoadAuthOrLogin()
	if err != nil {
		fmt.Println("ERR")
		io.Error(err)
	}
	fmt.Println("OK")

	io.Printf("You are now logged as %s/%s\n\n", u.Username, u.Email)
	err = CreateScalingoApp()
	if err != nil {
		io.Error(err)
	}

	err = CloneRepository()
	if err != nil {
		io.Error(err)
	}

	err = PushRepository()
	if err != nil {
		io.Error(err)
	}
}
Beispiel #2
0
func CreateScalingoApp() error {
	var err error

	io.Infof("Creating scalingo app %s...\n", HerokuApp.Name)

	ScalingoApp, err = app.Create(HerokuApp.Name)
	if err != nil {
		return errgo.Mask(err)
	}
	io.Print("Scalingo App '" + ScalingoApp.Name + "' created.\n")

	io.Info("Importing Heroku environment to Scalingo...")
	err = app.SetScalingoEnv(HerokuApp.Name, ScalingoApp.Name)
	if err != nil {
		return errgo.Mask(err)
	}
	fmt.Println()
	io.Print("Importation successful\n")

	return nil
}