本文整理汇总了Golang中github.com/jingweno/gotask/tasking.T类的典型用法代码示例。如果您正苦于以下问题:Golang T类的具体用法?Golang T怎么用?Golang T使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了T类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: TaskSpecgen
// NAME
// specgen - generates Go code from the UPnP specification files.
//
// DESCRIPTION
// The specification is available for download from:
//
// OPTIONS
// -s, --spec_filename=<upnpresources.zip>
// Path to the specification file, available from http://upnp.org/resources/upnpresources.zip
// -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
// --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) {
specFilename := t.Flags.String("spec-filename")
if specFilename == "" {
specFilename = t.Flags.String("s")
}
if specFilename == "" {
t.Fatal("--spec_filename is required")
}
outDir := t.Flags.String("out-dir")
if outDir == "" {
outDir = t.Flags.String("o")
}
if outDir == "" {
log.Fatal("--out_dir is required")
}
useGofmt := !t.Flags.Bool("nogofmt")
specArchive, err := openZipfile(specFilename)
if err != nil {
t.Fatalf("Error opening spec file: %v", err)
}
defer specArchive.Close()
dcpCol := newDcpsCollection()
for _, f := range globFiles("standardizeddcps/*/*.zip", specArchive.Reader) {
dirName := strings.TrimPrefix(f.Name, "standardizeddcps/")
slashIndex := strings.Index(dirName, "/")
if slashIndex == -1 {
// Should not happen.
t.Logf("Could not find / in %q", dirName)
return
}
dirName = dirName[:slashIndex]
dcp := dcpCol.dcpForDir(dirName)
if dcp == nil {
t.Logf("No alias defined for directory %q: skipping %s\n", dirName, f.Name)
continue
} else {
t.Logf("Alias found for directory %q: processing %s\n", dirName, f.Name)
}
dcp.processZipFile(f)
}
for _, dcp := range dcpCol.dcpByAlias {
if err := dcp.writePackage(outDir, useGofmt); err != nil {
log.Printf("Error writing package %q: %v", dcp.Metadata.Name, err)
}
}
}
开发者ID:djbarber,项目名称:ipfs-hack,代码行数:64,代码来源:specgen_task.go
示例17: 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
示例18: 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
示例19: TaskInit
// NAME
// generate files for 'model_task.go'
func TaskInit(t *tasking.T) {
newTestdata := false
src := "model_task.go"
srcInfo, err := os.Stat(src)
if err != nil {
t.Fatal(err)
}
dstInfo, err := os.Stat(filepath.Join("model", "sqlmodel.go"))
if err != nil {
newTestdata = true
}
if err := os.Chdir("test"); err != nil {
t.Fatal(err)
}
if newTestdata || srcInfo.ModTime().After(dstInfo.ModTime()) {
taskBuildModel(t)
}
}
开发者ID:robfig,项目名称:modsql,代码行数:22,代码来源:init_task.go
示例20: 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
注:本文中的github.com/jingweno/gotask/tasking.T类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论