예제 #1
0
// Develop
func Develop(params string, mist mistClient.Client) error {

	// connect to the server; this will wait until a single read is returned from
	// the server (blocking)
	conn, data, err := connect(fmt.Sprintf("POST /develop?pid=%d&%v HTTP/1.1\r\n\r\n", os.Getpid(), params))
	if err != nil {
		return err
	}
	defer conn.Close()

	// disconnect mist
	mist.Close()

	// begin watching for changes to the project
	go func() {
		if err := notifyutil.Watch(config.CWDir, NotifyServer); err != nil {
			fmt.Printf(err.Error())
		}
	}()

	//
	os.Stderr.WriteString(fmt.Sprintf(`+> Opening a nanobox console:


                                   **
                                ********
                             ***************
                          *********************
                            *****************
                          ::    *********    ::
                             ::    ***    ::
                           ++   :::   :::   ++
                              ++   :::   ++
                                 ++   ++
                                    +

                    _  _ ____ _  _ ____ ___  ____ _  _
                    |\ | |__| |\ | |  | |__) |  |  \/
                    | \| |  | | \| |__| |__) |__| _/\_

--------------------------------------------------------------------------------
+ You are in a virtual machine (vm)
+ Your local source code has been mounted into the vm, and changes in either
the vm or local will be mirrored.
+ If you run a server, access it at >> %s
--------------------------------------------------------------------------------
`, config.Nanofile.Domain))

	// get current term info
	stdIn, stdOut, _ := term.StdStreams()

	//
	terminal.Connect(stdIn, stdOut)

	// print the first read data from above
	os.Stderr.WriteString(string(data))

	//
	return pipeToConnection(conn, stdIn, stdOut)
}
예제 #2
0
파일: mist.go 프로젝트: datachand/nanobox
// subscribe
func subscribe(client mistClient.Client, tags []string) {
	if err := client.Subscribe(tags); err != nil {
		config.Fatal("[util/server/mist/mist] client.Subscribe() failed - ", err.Error())
	}
}