Пример #1
0
func deleteApp(c *cli.Context) {
	name := c.Args()[0]
	if name == "" {
		fatal("Must specify name")
	}

	repo := host.GetAppRepo()
	if err := repo.Delete(name); err != nil {
		fatal(err)
	}

	fmt.Printf("Deleted app %v\n", name)
}
Пример #2
0
func createApp(c *cli.Context) {
	name := c.Args()[0]
	if name == "" {
		fatal("Must specify name")
	}

	app := &api.App{
		Name: name,
	}

	repo := host.GetAppRepo()
	if err := repo.Create(app); err != nil {
		fatal(err)
	}

	tbl := table.New(2)
	tbl.Add("ID:", app.ID)

	fmt.Println("=== App " + app.Name)
	fmt.Print(tbl.String())
}
Пример #3
0
func receive(c *cli.Context) {
	log.SetFlags(0)

	app := c.Args()[0]
	rev := c.Args()[1]
	cache := c.Args()[2]

	client, err := docker.NewClientFromEnv()
	if err != nil {
		log.Fatal(err)
	}

	stat, _ := os.Stdin.Stat()
	if (stat.Mode() & os.ModeCharDevice) == 0 {
		cnt, err := buildApp(app, client, cache)
		if err != nil {
			log.Fatal(err)
		}
		log.Printf("Built app %v rev %v into container %v\n", app, rev, cnt.ID)
	} else {
		log.Fatal("no app input received")
	}
}