Пример #1
0
	"net/url"
	"os"
	"os/exec"
	"strconv"
	"strings"
	"time"

	"github.com/hackedu/orbit"
	"gopkg.in/fsnotify.v1"
)

var (
	baseURLStr = flag.String("url", "http://mew.hackedu.us:4000", "base URL of orbit")
	baseURL    *url.URL

	apiClient = orbit.NewClient(nil)
)

func init() {
	flag.Usage = func() {
		fmt.Fprintln(os.Stderr, `orbit puts your development environment in the cloud.

Usage:

    orbit [options] command [arg...]

The commands are:
`)
		for _, c := range subcmds {
			fmt.Fprintf(os.Stderr, "    %-24s %s\n", c.name, c.description)
		}
Пример #2
0
package docker

import (
	"encoding/json"
	"fmt"
	"net/url"
	"os/exec"
	"strconv"
	"strings"

	"github.com/hackedu/orbit"
)

var (
	Store   = orbit.NewClient(nil)
	BaseURL *url.URL
)

func CommandInContainer(containerID string, command ...string) *exec.Cmd {
	return exec.Command("docker", "exec",
		containerID,
		"/bin/sh", "-c", "cd /usr/src/app && "+strings.Join(command, " "),
	)
}

func UpdateProjectFilesInServicesForProject(projectID int) error {
	services, err := Store.Services.List(projectID)
	if err != nil {
		return err
	}