當前位置: 首頁>>代碼示例>>Golang>>正文


Golang tasking.T類代碼示例

本文整理匯總了Golang中github.com/jingweno/gotask/tasking.T的典型用法代碼示例。如果您正苦於以下問題:Golang T類的具體用法?Golang T怎麽用?Golang T使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了T類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: TaskSpecgen

// NAME
//   specgen - generates Go code from the UPnP specification files.
//
// DESCRIPTION
//   The specification is available for download from:
//
// OPTIONS
//   -s, --specs_dir=<spec directory>
//     Path to the specification storage directory. This is used to find (and download if not present) the specification ZIP files. Defaults to 'specs'
//   -o, --out_dir=<output directory>
//     Path to the output directory. This is is where the DCP source files will be placed. Should normally correspond to the directory for github.com/huin/goupnp/dcps. Defaults to '../dcps'
//   --nogofmt
//     Disable passing the output through gofmt. Do this if debugging code output problems and needing to see the generated code prior to being passed through gofmt.
func TaskSpecgen(t *tasking.T) {
	specsDir := fallbackStrValue("specs", t.Flags.String("specs_dir"), t.Flags.String("s"))
	if err := os.MkdirAll(specsDir, os.ModePerm); err != nil {
		t.Fatalf("Could not create specs-dir %q: %v\n", specsDir, err)
	}
	outDir := fallbackStrValue("../dcps", t.Flags.String("out_dir"), t.Flags.String("o"))
	useGofmt := !t.Flags.Bool("nogofmt")

NEXT_DCP:
	for _, d := range dcpMetadata {
		specFilename := filepath.Join(specsDir, d.Name+".zip")
		err := acquireFile(specFilename, d.XMLSpecURL)
		if err != nil {
			t.Logf("Could not acquire spec for %s, skipping: %v\n", d.Name, err)
			continue NEXT_DCP
		}
		dcp := newDCP(d)
		if err := dcp.processZipFile(specFilename); err != nil {
			log.Printf("Error processing spec for %s in file %q: %v", d.Name, specFilename, err)
			continue NEXT_DCP
		}
		for i, hack := range d.Hacks {
			if err := hack(dcp); err != nil {
				log.Printf("Error with Hack[%d] for %s: %v", i, d.Name, err)
				continue NEXT_DCP
			}
		}
		dcp.writePackage(outDir, useGofmt)
		if err := dcp.writePackage(outDir, useGofmt); err != nil {
			log.Printf("Error writing package %q: %v", dcp.Metadata.Name, err)
			continue NEXT_DCP
		}
	}
}
開發者ID:huin,項目名稱:goupnp,代碼行數:47,代碼來源:specgen_task.go

示例2: TaskDeploy

// NAME
//    deploy - Deploy the application
//
// DESCRIPTION
//    Build and deploy the application on the device via ant.
//
// OPTIONS
//    --verbose, -v
//        run in verbose mode
func TaskDeploy(t *tasking.T) {
	deployAndroid(t)
	if t.Failed() {
		t.Fatalf("%-20s %s\n", status(t.Failed()), "Build and deploy the application on the device via ant.")
	}
	t.Logf("%-20s %s\n", status(t.Failed()), "Build and deploy the application on the device via ant.")
}
開發者ID:remogatto,項目名稱:gltext,代碼行數:16,代碼來源:test_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: TaskSayHello

// NAME
//    say-hello - Say hello to current user
//
// DESCRIPTION
//    Print out hello to current user
//
// OPTIONS
//    --verbose, -v
//        run in verbose mode
func TaskSayHello(t *tasking.T) {
	user, _ := user.Current()
	if t.Flags.Bool("v") || t.Flags.Bool("verbose") {
		t.Logf("Hello %s, the time now is %s\n", user.Name, time.Now())
	} else {
		t.Logf("Hello %s\n", user.Name)
	}
}
開發者ID:hanxue,項目名稱:gotask,代碼行數:17,代碼來源:say_hello_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: init

func init() {
	var t *tasking.T

	u, err := user.Current()
	if err != nil {
		t.Fatal(err)
	}
	username = u.Username
}
開發者ID:robfig,項目名稱:modsql,代碼行數:9,代碼來源:init_task.go

示例7: TaskBuild

// NAME
//    build - Build the application
//
// DESCRIPTION
//    Build the application for the given platforms.
//
// OPTIONS
//    --flags=<FLAGS>
//        pass FLAGS to the compiler
//    --verbose, -v
//        run in verbose mode
func TaskBuild(t *tasking.T) {
	for _, platform := range t.Args {
		buildFun[platform](t)
	}
	if t.Failed() {
		t.Fatalf("%-20s %s\n", status(t.Failed()), "Build the application for the given platforms.")
	}
	t.Logf("%-20s %s\n", status(t.Failed()), "Build the application for the given platforms.")
}
開發者ID:remogatto,項目名稱:mandala-examples,代碼行數:20,代碼來源:chipmunk_task.go

示例8: 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

示例9: TaskTest

// NAME
//    test - Run the tests
//
// DESCRIPTION
//    Build and run the tests on the given platform returning output using logcat.
//
// OPTIONS
//    --flags=<FLAGS>
//        pass the given flags to the executable
//    --verbose, -v
//        run in verbose mode
func TaskTest(t *tasking.T) {
	TaskBuild(t)
	if f, ok := runFun[t.Args[0]]; ok {
		f(t)
	}
	if t.Failed() {
		t.Fatalf("%-20s %s\n", status(t.Failed()), "Run the example on the given platforms.")
	}
	t.Logf("%-20s %s\n", status(t.Failed()), "Run the example on the given platforms.")
}
開發者ID:leonardyp,項目名稱:mandala,代碼行數:21,代碼來源:test_task.go

示例10: 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

示例11: TaskTest

// NAME
//    test - Run black-box tests
//
// DESCRIPTION
//    Build and run the application on the given platforms.
//
// OPTIONS
//    --flags=<FLAGS>
//        pass the flags to the executable
//    --logcat=Mandala:* stdout:* stderr:* *:S
//        show logcat output (android only)
//    --verbose, -v
//        run in verbose mode
func TaskTest(t *tasking.T) {
	TaskBuild(t)
	for _, platform := range t.Args {
		runFun[platform](t)
	}
	if t.Failed() {
		t.Fatalf("%-20s %s\n", status(t.Failed()), "Run the application on the given platforms.")
	}
	t.Logf("%-20s %s\n", status(t.Failed()), "Run the application on the given platforms.")
}
開發者ID:remogatto,項目名稱:gltext,代碼行數:23,代碼來源:test_task.go

示例12: 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

示例13: 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

示例14: TaskRelease

// NAME
//    release - Build the application in 'release mode'
//
// DESCRIPTION
//    Build the application for Android in 'release mode'.
//
// OPTIONS
//    --flags=<FLAGS>
//        pass FLAGS to the compiler
//    --verbose, -v
//        run in verbose mode
func TaskRelease(t *tasking.T) {
	// Build app in 'release mode'
	buildAndroid(t, true)
	// Sign and 'zipalign' app
	signAndroid(t)
	// Check task
	if t.Failed() {
		t.Fatalf("%-20s %s\n", status(t.Failed()), "Release the application for Android.")
	}
	t.Logf("%-20s %s\n", status(t.Failed()), "Release the application for Android.")
}
開發者ID:remogatto,項目名稱:mandala-examples,代碼行數:22,代碼來源:chipmunk_task.go

示例15: TaskSayHello

// NAME
//    say-hello - Say hello to current user
//
// DESCRIPTION
//    Print out hello to current user
//
// OPTIONS
//    -n, --name="NAME"
//        say hello to an user with the given NAME
//    -v, --verbose
//        run in verbose mode
func TaskSayHello(t *tasking.T) {
	username := t.Flags.String("name")
	if username == "" {
		user, _ := user.Current()
		username = user.Name
	}

	if t.Flags.Bool("verbose") {
		t.Logf("Hello %s, the time now is %s\n", username, time.Now())
	} else {
		t.Logf("Hello %s\n", username)
	}
}
開發者ID:remogatto,項目名稱:gotask,代碼行數:24,代碼來源:say_hello_task.go


注:本文中的github.com/jingweno/gotask/tasking.T類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。