本文整理汇总了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
}
}
}
示例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.")
}
示例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)
}
示例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)
}
}
示例5: runXorg
func runXorg(t *tasking.T, flags string) {
err := t.Exec(
filepath.Join("bin", LibName),
flags,
)
if err != nil {
t.Error(err)
}
}
示例6: init
func init() {
var t *tasking.T
u, err := user.Current()
if err != nil {
t.Fatal(err)
}
username = u.Username
}
示例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.")
}
示例8: runXorg
func runXorg(t *tasking.T) {
err := t.Exec(
filepath.Join("bin", LibName),
t.Flags.String("flags"),
)
if err != nil {
t.Error(err)
}
}
示例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.")
}
示例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)
}
}
示例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.")
}
示例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)
}
}
示例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)
}
}
示例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.")
}
示例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)
}
}