Пример #1
0
func ChangeDirectory(to string) {
	if to == "bin" {
		erisLoc, err := exec.LookPath("eris")
		if err != nil {
			log.Fatalf("Error finding eris binary: %v", err)
		}
		err = os.Chdir(filepath.Dir(erisLoc))
		if err != nil {
			log.Fatalf("Error changing directory: %v", err)
		}
		log.WithField("dir", erisLoc).Debug("Directory changed to")
	} else if to == "src" {
		goPath := os.Getenv("GOPATH")
		if goPath == "" {
			log.Fatal("You do not have $GOPATH set. Please make sure this is set and rerun the command.")
		}

		dir := filepath.Join(goPath, "src", "github.com", "eris-ltd", "eris-cli")
		err := os.Chdir(dir)

		if err != nil {
			log.Fatalf("Error changing directory: %v")
		}
		log.WithField("dir", dir).Debug("Directory changed to")
	}
}
Пример #2
0
func InstallEris() {
	goArgs := []string{"install", "./cmd/eris"}

	stdOut, err := exec.Command("go", goArgs...).CombinedOutput()
	if err != nil {
		log.Fatalf("Error with go install ./cmd/eris: %v", string(stdOut))
	}

	log.Debug("Go install worked correctly")
}
Пример #3
0
func PullBranch(branch string) {
	pullArgs := []string{"pull", "origin", branch}

	stdOut, err := exec.Command("git", pullArgs...).CombinedOutput()
	if err != nil {
		log.Fatalf("Error pulling from GitHub: %v", string(stdOut))
	}

	log.WithField("branch", branch).Debug("Branch pulled successfully")
}