当前位置: 首页>>代码示例>>Golang>>正文


Golang T.Exec方法代码示例

本文整理汇总了Golang中github.com/jingweno/gotask/tasking.T.Exec方法的典型用法代码示例。如果您正苦于以下问题:Golang T.Exec方法的具体用法?Golang T.Exec怎么用?Golang T.Exec使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/jingweno/gotask/tasking.T的用法示例。


在下文中一共展示了T.Exec方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: TaskClean

// NAME
//    clean - Clean all generated files
//
// DESCRIPTION
//    Clean all generated files and paths.
//
// OPTIONS
//    --backup, -b
//        clean all backup files (*~, #*)
//    --verbose, -v
//        run in verbose mode
func TaskClean(t *tasking.T) {
	var paths []string

	paths = append(
		paths,
		ARMBinaryPath,
		"pkg",
		filepath.Join("bin", ProjectName),
		filepath.Join(AndroidPath, "bin"),
		filepath.Join(AndroidPath, "gen"),
		filepath.Join(AndroidPath, "libs"),
		filepath.Join(AndroidPath, "obj"),
	)

	// Actually remove files using rm
	for _, path := range paths {
		err := rm_rf(t, path)
		if err != nil {
			t.Error(err)
		}
	}

	if t.Flags.Bool("backup") {
		err := t.Exec(`sh -c`, `"find ./ -name '*~' -print0 | xargs -0 rm -f"`)
		if err != nil {
			t.Error(err)
		}
	}

	if t.Failed() {
		t.Fatalf("%-20s %s\n", status(t.Failed()), "Clean all generated files and paths.")
	}
	t.Logf("%-20s %s\n", status(t.Failed()), "Clean all generated files and paths.")
}
开发者ID:leonardyp,项目名称:mandala,代码行数:45,代码来源:test_task.go

示例2: TaskCrossCompile

// NAME
//    cross-compile - cross-compiles gh for current platform.
//
// DESCRIPTION
//    Cross-compiles gh for current platform. Build artifacts will be in target/VERSION
func TaskCrossCompile(t *tasking.T) {
	t.Logf("Cross-compiling gh for %s...\n", runtime.GOOS)
	t.Logf("GOPATH=%s\n", os.Getenv("GOPATH"))
	err := t.Exec("goxc", "-wd=.", "-os="+runtime.GOOS, "-c="+runtime.GOOS)
	if err != nil {
		t.Fatalf("Can't cross-compile gh: %s\n", err)
	}
}
开发者ID:jingweno,项目名称:gh,代码行数:13,代码来源:gh_task.go

示例3: deployAndroid

func deployAndroid(t *tasking.T) {
	buildAndroid(t)
	err := t.Exec("ant -f android/build.xml clean debug")
	if err != nil {
		t.Error(err)
	}
	uploadAndroid(t)
}
开发者ID:leonardyp,项目名称:mandala,代码行数:8,代码来源:test_task.go

示例4: runXorg

func runXorg(t *tasking.T) {
	err := t.Exec(
		filepath.Join("bin", LibName),
		t.Flags.String("flags"),
	)
	if err != nil {
		t.Error(err)
	}
}
开发者ID:remogatto,项目名称:gltext,代码行数:9,代码来源:test_task.go

示例5: runXorg

func runXorg(t *tasking.T, flags string) {
	err := t.Exec(
		filepath.Join("bin", LibName),
		flags,
	)
	if err != nil {
		t.Error(err)
	}
}
开发者ID:remogatto,项目名称:mandala-examples,代码行数:9,代码来源:_task.go

示例6: runXorg

func runXorg(t *tasking.T) {
	buildXorg(t)
	err := t.Exec(
		filepath.Join("bin", ProjectName),
		t.Flags.String("flags"),
	)
	if err != nil {
		t.Error(err)
	}
}
开发者ID:leonardyp,项目名称:mandala,代码行数:10,代码来源:test_task.go

示例7: buildXorg

func buildXorg(t *tasking.T) {
	err := t.Exec(
		`sh -c "`,
		"GOPATH=`pwd`:$GOPATH",
		`go get`, t.Flags.String("flags"),
		LibName, `"`,
	)
	if err != nil {
		t.Error(err)
	}
}
开发者ID:remogatto,项目名称:gltext,代码行数:11,代码来源:test_task.go

示例8: buildXorg

func buildXorg(t *tasking.T) {
	err := t.Exec(
		`sh -c "`,
		"GOPATH=`pwd`:$GOPATH",
		`go install`, t.Flags.String("buildflags"),
		ProjectName, `"`,
	)
	if err != nil {
		t.Error(err)
	}
}
开发者ID:kebo,项目名称:gorgasm,代码行数:11,代码来源:test_task.go

示例9: TaskInstallDeps

// NAME
//    install-deps - install dependencies with go get
//
// DESCRIPTION
//    Install dependencies with go get.
func TaskInstallDeps(t *tasking.T) {
	deps := []string{
		"github.com/laher/goxc",
	}

	for _, dep := range deps {
		t.Logf("Installing %s\n", dep)
		err := t.Exec("go get", dep)
		if err != nil {
			t.Fatalf("Can't download dependency %s", err)
		}
	}
}
开发者ID:jingweno,项目名称:gh,代码行数:18,代码来源:gh_task.go

示例10: TaskBottle

// NAME
//    bottle - build homebrew bottle for gh
//
// DESCRIPTION
//    Build homebrew bottle for gh into PWD/target.
func TaskBottle(t *tasking.T) {
	pwd, err := os.Getwd()
	if err != nil {
		t.Fatal(err)
	}

	target := filepath.Join(pwd, "target")
	err = mkdirAll(target)
	if err != nil {
		t.Fatal(err)
	}

	err = t.Exec("brew", "list", "gh")
	if err == nil {
		err := t.Exec("brew", "uninstall", "gh")
		if err != nil {
			t.Fatal(err)
		}
	}

	err = t.Exec("brew", "install", "--build-from-source", "--build-bottle", "gh")
	if err != nil {
		t.Fatal(err)
	}

	err = os.Chdir(target)
	if err != nil {
		t.Fatal(err)
	}

	err = t.Exec("brew", "bottle", "gh")
	if err != nil {
		t.Fatal(err)
	}
}
开发者ID:jingweno,项目名称:gh,代码行数:40,代码来源:gh_task.go

示例11: TaskCrossCompile

// Cross-compiles gh for current operating system.
//
// Cross-compiles gh for current operating system. The build artifacts will be in target/VERSION
func TaskCrossCompile(t *tasking.T) {
	t.Log("Updating goxc...")
	err := t.Exec("go get -u github.com/laher/goxc")
	if err != nil {
		t.Errorf("Can't update goxc: %s\n", err)
		return
	}

	t.Logf("Cross-compiling gh for %s...\n", runtime.GOOS)
	err = t.Exec("goxc", "-wd=.", "-os="+runtime.GOOS, "-c="+runtime.GOOS)
	if err != nil {
		t.Errorf("Can't cross-compile gh: %s\n", err)
		return
	}
}
开发者ID:johnbellone,项目名称:gh,代码行数:18,代码来源:gh_task.go

示例12: buildXorg

func buildXorg(t *tasking.T, buildAll bool) {
	allFlagString := ""
	if buildAll {
		allFlagString = "-a"
	}
	err := t.Exec(
		`sh -c "`,
		"GOPATH=`pwd`:$GOPATH",
		`go install`, allFlagString,
		LibName, `"`,
	)
	if err != nil {
		t.Error(err)
	}
}
开发者ID:remogatto,项目名称:mandala-examples,代码行数:15,代码来源:_task.go

示例13: runAndroid

func runAndroid(t *tasking.T) {
	buildAndroid(t)
	deployAndroid(t)
	err := t.Exec(
		fmt.Sprintf(
			"adb shell am start -a android.intent.action.MAIN -n net.mandala.%s/android.app.NativeActivity",
			ProjectName,
		))
	if err != nil {
		t.Error(err)
	}
	err = t.Exec("adb shell logcat", "Mandala:* stdout:* stderr:* *:S")
	if err != nil {
		t.Error(err)
	}
}
开发者ID:leonardyp,项目名称:mandala,代码行数:16,代码来源:test_task.go

示例14: runAndroid

func runAndroid(t *tasking.T) {
	deployAndroid(t)
	err := t.Exec(
		fmt.Sprintf(
			"adb shell am start -a android.intent.action.MAIN -n %s.%s/android.app.NativeActivity",
			Domain,
			LibName,
		))
	if err != nil {
		t.Error(err)
	}
	if tags := t.Flags.String("logcat"); tags != "" {
		err = t.Exec("adb", "shell", "logcat", tags)
		if err != nil {
			t.Error(err)
		}
	}
}
开发者ID:remogatto,项目名称:gltext,代码行数:18,代码来源:test_task.go

示例15: runAndroid

func runAndroid(t *tasking.T, flags string) {
	deployAndroid(t)
	err := t.Exec(
		fmt.Sprintf(
			"adb shell am start -a android.intent.action.MAIN -n %s.%s/android.app.NativeActivity",
			Domain,
			LibName,
		))
	if err != nil {
		t.Error(err)
	}
	if t.Flags.Bool("logcat") {
		err = t.Exec("adb shell logcat")
		if err != nil {
			t.Error(err)
		}
	}
}
开发者ID:remogatto,项目名称:mandala-examples,代码行数:18,代码来源:_task.go


注:本文中的github.com/jingweno/gotask/tasking.T.Exec方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。