Ejemplo n.º 1
0
// runnable ensures all dependencies are satisfied before running dev commands
func runnable(ccmd *cobra.Command, args []string) {

	// ensure vagrant exists
	if exists := vagrant.Exists(); !exists {
		fmt.Println("Missing dependency 'Vagrant'. Please download and install it to continue (https://www.vagrantup.com/).")
		os.Exit(1)
	}

	// ensure virtualbox exists
	if exists := util.VboxExists(); !exists {
		fmt.Println("Missing dependency 'Virtualbox'. Please download and install it to continue (https://www.virtualbox.org/wiki/Downloads).")
		os.Exit(1)
	}
}
Ejemplo n.º 2
0
// test if Exists works as intended
func TestExists(t *testing.T) {

	exists := false
	if err := exec.Command("vagrant", "-v").Run(); err == nil {
		exists = true
	}

	//
	testExists := vagrant.Exists()

	if testExists != exists {
		t.Error("Results don't match!")
	}
}