本文整理汇总了Golang中github.com/revel/revel.Init函数的典型用法代码示例。如果您正苦于以下问题:Golang Init函数的具体用法?Golang Init怎么用?Golang Init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Init函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: packageApp
func packageApp(args []string) {
if len(args) == 0 {
fmt.Fprint(os.Stderr, cmdPackage.Long)
return
}
// Determine the run mode.
mode := "dev"
if len(args) >= 2 {
mode = args[1]
}
appImportPath := args[0]
revel.Init(mode, appImportPath, "")
// Remove the archive if it already exists.
destFile := filepath.Base(revel.BasePath) + ".tar.gz"
os.Remove(destFile)
// Collect stuff in a temp directory.
tmpDir, err := ioutil.TempDir("", filepath.Base(revel.BasePath))
panicOnError(err, "Failed to get temp dir")
buildApp([]string{args[0], tmpDir, mode})
// Create the zip file.
archiveName := mustTarGzDir(destFile, tmpDir)
fmt.Println("Your archive is ready:", archiveName)
}
开发者ID:runner-mei,项目名称:revel_cmd,代码行数:30,代码来源:package.go
示例2: main
func main() {
// go run main.go
// 生成routes.go, main.go
revel.Init("", "github.com/leanote/leanote", "")
_, err := harness.Build() // ok, err
if err != nil {
panic(err)
}
fmt.Println("Ok")
// panicOnError(reverr, "Failed to build")
}
开发者ID:ClaudeXin,项目名称:leanote,代码行数:11,代码来源:main.go
示例3: BenchmarkProcessBookingSource
func BenchmarkProcessBookingSource(b *testing.B) {
revel.Init("", "github.com/revel/revel/samples/booking", "")
revel.TRACE = log.New(ioutil.Discard, "", 0)
b.ResetTimer()
for i := 0; i < b.N; i++ {
_, err := ProcessSource(revel.CodePaths)
if err != nil {
b.Error("Unexpected error:", err)
}
}
}
开发者ID:R510,项目名称:revel,代码行数:12,代码来源:reflect_test.go
示例4: generateFiles
func generateFiles(args []string) {
if len(args) != 2 {
fmt.Fprintf(os.Stderr, "%s\n%s", cmdBuild.UsageLine, cmdBuild.Long)
return
}
appImportPath, destPath := args[0], args[1]
if !revel.Initialized {
revel.Init("", appImportPath, "")
}
reverr := harness.Generate(destPath, true)
panicOnError(reverr, "Failed to build")
}
开发者ID:TheHippo,项目名称:cmd,代码行数:14,代码来源:generate.go
示例5: runApp
func runApp(args []string) {
if len(args) == 0 {
errorf("No import path given.\nRun 'revel help run' for usage.\n")
}
// Determine the run mode.
mode := "dev"
if len(args) >= 2 {
mode = args[1]
}
// Find and parse app.conf
revel.Init(mode, args[0], "")
revel.LoadMimeConfig()
// Determine the override port, if any.
port := revel.HttpPort
if len(args) == 3 {
var err error
if port, err = strconv.Atoi(args[2]); err != nil {
errorf("Failed to parse port as integer: %s", args[2])
}
}
revel.INFO.Printf("Running %s (%s) in %s mode\n", revel.AppName, revel.ImportPath, mode)
revel.TRACE.Println("Base path:", revel.BasePath)
// If the app is run in "watched" mode, use the harness to run it.
if revel.Config.BoolDefault("watch", true) && revel.Config.BoolDefault("watch.code", true) {
revel.TRACE.Println("Running in watched mode.")
revel.HttpPort = port
harness.NewHarness().Run() // Never returns.
}
// Else, just build and run the app.
revel.TRACE.Println("Running in live build mode.")
app, err := harness.Build()
if err != nil {
errorf("Failed to build app: %s", err)
}
app.Port = port
app.Cmd().Run()
}
开发者ID:runner-mei,项目名称:revel_cmd,代码行数:43,代码来源:run.go
示例6: main
func main() {
flag.Parse()
revel.Init(*runMode, *importPath, *srcPath)
revel.INFO.Println("Running revel server")
revel.RegisterController((*controllers.App)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Index",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
10: []string{},
},
},
})
revel.RegisterController((*controllers0.Static)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Serve",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "prefix", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "filepath", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "ServeModule",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "moduleName", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "prefix", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "filepath", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{},
},
})
revel.DefaultValidationKeys = map[string]map[int]string{}
testing.TestSuites = []interface{}{}
revel.Run(*port)
}
开发者ID:ahyswang,项目名称:starway,代码行数:42,代码来源:main.go
示例7: TestProcessBookingSource
func TestProcessBookingSource(t *testing.T) {
revel.Init("prod", "github.com/revel/revel/samples/booking", "")
sourceInfo, err := ProcessSource([]string{revel.AppPath})
if err != nil {
t.Fatal("Failed to process booking source with error:", err)
}
CONTROLLER_PKG := "github.com/revel/revel/samples/booking/app/controllers"
expectedControllerSpecs := []*TypeInfo{
{"GorpController", CONTROLLER_PKG, "controllers", nil, nil},
{"Application", CONTROLLER_PKG, "controllers", nil, nil},
{"Hotels", CONTROLLER_PKG, "controllers", nil, nil},
}
if len(sourceInfo.ControllerSpecs()) != len(expectedControllerSpecs) {
t.Errorf("Unexpected number of controllers found. Expected %d, Found %d",
len(expectedControllerSpecs), len(sourceInfo.ControllerSpecs()))
}
NEXT_TEST:
for _, expected := range expectedControllerSpecs {
for _, actual := range sourceInfo.ControllerSpecs() {
if actual.StructName == expected.StructName {
if actual.ImportPath != expected.ImportPath {
t.Errorf("%s expected to have import path %s, actual %s",
actual.StructName, expected.ImportPath, actual.ImportPath)
}
if actual.PackageName != expected.PackageName {
t.Errorf("%s expected to have package name %s, actual %s",
actual.StructName, expected.PackageName, actual.PackageName)
}
continue NEXT_TEST
}
}
t.Errorf("Expected to find controller %s, but did not. Actuals: %s",
expected.StructName, sourceInfo.ControllerSpecs())
}
}
开发者ID:R510,项目名称:revel,代码行数:37,代码来源:reflect_test.go
示例8: main
func main() {
flag.Parse()
revel.Init(*runMode, *importPath, *srcPath)
revel.INFO.Println("Running revel server")
revel.RegisterController((*controllers.App)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Index",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "admin", Type: reflect.TypeOf((**models.Admin)(nil))},
},
RenderArgNames: map[int][]string{
55: []string{
"title",
},
},
},
&revel.MethodType{
Name: "Main",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "admin", Type: reflect.TypeOf((**models.Admin)(nil))},
},
RenderArgNames: map[int][]string{
106: []string{
"title",
"admin_info",
"system_info",
"panel_list",
},
108: []string{
"title",
},
},
},
})
revel.RegisterController((*controllers0.Category)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Index",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "category", Type: reflect.TypeOf((**models.Category)(nil))},
},
RenderArgNames: map[int][]string{
27: []string{
"title",
"categorys",
},
29: []string{
"title",
},
},
},
&revel.MethodType{
Name: "Add",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "category", Type: reflect.TypeOf((**models.Category)(nil))},
},
RenderArgNames: map[int][]string{
51: []string{
"title",
"categorys",
"Id",
},
55: []string{
"title",
"categorys",
},
},
},
&revel.MethodType{
Name: "Edit",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "category", Type: reflect.TypeOf((**models.Category)(nil))},
},
RenderArgNames: map[int][]string{
217: []string{
"title",
"categorys",
"category_info",
},
223: []string{
"title",
"categorys",
},
},
},
&revel.MethodType{
Name: "Delete",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "category", Type: reflect.TypeOf((**models.Category)(nil))},
},
RenderArgNames: map[int][]string{},
},
})
revel.RegisterController((*controllers0.Content)(nil),
[]*revel.MethodType{
&revel.MethodType{
//.........这里部分代码省略.........
开发者ID:JREAMLU,项目名称:GoCMS,代码行数:101,代码来源:main.go
示例9: main
func main() {
flag.Parse()
revel.Init(*runMode, *importPath, *srcPath)
revel.INFO.Println("Running revel server")
revel.RegisterController((*controllers.App)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Index",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
33: []string{},
},
},
&revel.MethodType{
Name: "UserIndex",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
38: []string{},
},
},
&revel.MethodType{
Name: "UserAdd",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "region", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "summonerName", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "UserDelete",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "region", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "summonerId", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "GameIndex",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
53: []string{},
},
},
&revel.MethodType{
Name: "GameDelete",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "platformId", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "gameId", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "SummonerIndex",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
62: []string{},
},
},
&revel.MethodType{
Name: "Summoner",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "region", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "summonerName", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{
67: []string{},
},
},
&revel.MethodType{
Name: "Record",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "region", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "gameId", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "encryptionKey", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "summonerId", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "Version",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "Metadata",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "region", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "id", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "LastChunkInfo",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "region", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "id", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "end", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{},
//.........这里部分代码省略.........
开发者ID:HyperVendy,项目名称:HyperReplay-Replay-Experimental,代码行数:101,代码来源:main.go
示例10: main
func main() {
flag.Parse()
revel.Init(*runMode, *importPath, *srcPath)
revel.INFO.Println("Running revel server")
revel.RegisterController((*controllers.Application)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Index",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
10: []string{},
},
},
})
revel.RegisterController((*controllers.Sample2)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Index",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
12: []string{},
},
},
&revel.MethodType{
Name: "HandleSubmit",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "username", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "firstname", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "lastname", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "age", Type: reflect.TypeOf((*int)(nil))},
&revel.MethodArg{Name: "password", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "passwordConfirm", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "email", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "emailConfirm", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "termsOfUse", Type: reflect.TypeOf((*bool)(nil))},
},
RenderArgNames: map[int][]string{
46: []string{
"username",
"firstname",
"lastname",
"age",
"password",
"email",
},
},
},
})
revel.RegisterController((*controllers.Sample3)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Index",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
13: []string{},
},
},
&revel.MethodType{
Name: "HandleSubmit",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "user", Type: reflect.TypeOf((**models.User)(nil))},
},
RenderArgNames: map[int][]string{
27: []string{
"user",
},
},
},
})
revel.RegisterController((*controllers.Sample4)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Index",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
13: []string{},
},
},
&revel.MethodType{
Name: "HandleSubmit",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "user", Type: reflect.TypeOf((**models.User)(nil))},
},
RenderArgNames: map[int][]string{
27: []string{
"user",
},
},
},
})
revel.RegisterController((*controllers.Sample1)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Index",
Args: []*revel.MethodArg{},
//.........这里部分代码省略.........
开发者ID:praveen-vakilsearch,项目名称:go-praveen,代码行数:101,代码来源:main.go
示例11: main
func main() {
flag.Parse()
revel.Init(*runMode, *importPath, *srcPath)
revel.INFO.Println("Running revel server")
revel.RegisterController((*controllers.App)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Index",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
17: []string{},
},
},
&revel.MethodType{
Name: "AddUser",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "Logout",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{},
},
})
revel.RegisterController((*controllers0.Static)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Serve",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "prefix", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "filepath", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "ServeModule",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "moduleName", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "prefix", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "filepath", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{},
},
})
revel.RegisterController((*controllers1.TestRunner)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Index",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
70: []string{
"testSuites",
},
},
},
&revel.MethodType{
Name: "Run",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "suite", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "test", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{
107: []string{},
},
},
&revel.MethodType{
Name: "List",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{},
},
})
revel.RegisterController((*controllers.Users)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Login",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "login", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "password", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "Signup",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
43: []string{},
},
},
&revel.MethodType{
Name: "SaveUser",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "login", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "password", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{},
},
//.........这里部分代码省略.........
开发者ID:karesti,项目名称:cm-voting,代码行数:101,代码来源:main.go
示例12: main
func main() {
flag.Parse()
revel.Init(*runMode, *importPath, *srcPath)
revel.INFO.Println("Running revel server")
revel.RegisterController((*controllers.AbstractController)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Begin",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "Commit",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "Rollback",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "RenderLogin",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "RenderNoAdmin",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{},
},
})
revel.RegisterController((*controllers0.Static)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Serve",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "prefix", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "filepath", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "ServeModule",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "moduleName", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "prefix", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "filepath", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{},
},
})
revel.RegisterController((*controllers.User)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "GetUsers",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "userId", Type: reflect.TypeOf((*int)(nil))},
},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "GetUserByName",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "name", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{
27: []string{
"user",
"nil",
},
},
},
&revel.MethodType{
Name: "Setting",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "sid", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "gender", Type: reflect.TypeOf((*int)(nil))},
&revel.MethodArg{Name: "age", Type: reflect.TypeOf((*int)(nil))},
&revel.MethodArg{Name: "lllness", Type: reflect.TypeOf((*int)(nil))},
},
RenderArgNames: map[int][]string{
39: []string{
"res",
"err",
},
},
},
&revel.MethodType{
Name: "GetTopicList",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "uid", Type: reflect.TypeOf((*int64)(nil))},
&revel.MethodArg{Name: "page", Type: reflect.TypeOf((*int)(nil))},
&revel.MethodArg{Name: "limit", Type: reflect.TypeOf((*int)(nil))},
},
RenderArgNames: map[int][]string{
51: []string{
//.........这里部分代码省略.........
开发者ID:nangong92t,项目名称:go_src,代码行数:101,代码来源:main.go
示例13: main
func main() {
flag.Parse()
revel.Init(*runMode, *importPath, *srcPath)
revel.INFO.Println("Running revel server")
revel.RegisterController((*controllers.App)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Index",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
10: []string{},
},
},
})
revel.RegisterController((*controllers.Auth)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Index",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "Callback",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "Logout",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{},
},
})
revel.RegisterController((*controllers.Home)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Index",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
24: []string{},
},
},
})
revel.RegisterController((*controllers.Tasks)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Index",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "tag", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{
24: []string{
"tasks",
"username",
"userimg",
"tags",
"tag",
},
},
},
&revel.MethodType{
Name: "New",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "task", Type: reflect.TypeOf((*models.Task)(nil))},
},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "Complete",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "id", Type: reflect.TypeOf((*int)(nil))},
&revel.MethodArg{Name: "complete", Type: reflect.TypeOf((*bool)(nil))},
},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "Completed",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
59: []string{
"tasks",
"username",
"userimg",
"tags",
},
},
},
})
revel.RegisterController((*controllers0.TestRunner)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Index",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
46: []string{
"testSuites",
//.........这里部分代码省略.........
开发者ID:xeb,项目名称:flowdle,代码行数:101,代码来源:main.go
示例14: main
func main() {
flag.Parse()
revel.Init(*runMode, *importPath, *srcPath)
revel.INFO.Println("Running revel server")
revel.RegisterController((*controllers.DatabaseController)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Begin",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "Commit",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "Rollback",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{},
},
})
revel.RegisterController((*controllers0.TestRunner)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Index",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
46: []string{
"testSuites",
},
},
},
&revel.MethodType{
Name: "Run",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "suite", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "test", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{
69: []string{
"error",
},
},
},
&revel.MethodType{
Name: "List",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{},
},
})
revel.RegisterController((*controllers1.Static)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Serve",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "prefix", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "filepath", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "ServeModule",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "moduleName", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "prefix", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "filepath", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{},
},
})
revel.RegisterController((*controllers.Application)(nil),
[]*revel.MethodType{})
revel.RegisterController((*controllers.Home)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Index",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
31: []string{},
},
},
&revel.MethodType{
Name: "About",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
35: []string{},
},
},
&revel.MethodType{
Name: "Overview",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{},
},
})
//.........这里部分代码省略.........
开发者ID:revolvingcow,项目名称:grassfed,代码行数:101,代码来源:main.go
示例15: main
func main() {
flag.Parse()
revel.Init(*runMode, *importPath, *srcPath)
revel.INFO.Println("Running revel server")
revel.RegisterController((*controllers.BaseController)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Before",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{},
},
})
revel.RegisterController((*controllers0.TestRunner)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Index",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
70: []string{
"testSuites",
},
},
},
&revel.MethodType{
Name: "Run",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "suite", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "test", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{
107: []string{},
},
},
&revel.MethodType{
Name: "List",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{},
},
})
revel.RegisterController((*controllers1.Static)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Serve",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "prefix", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "filepath", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "ServeModule",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "moduleName", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "prefix", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "filepath", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{},
},
})
revel.RegisterController((*controllers.Admin)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "ListUser",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "limit", Type: reflect.TypeOf((*int)(nil))},
&revel.MethodArg{Name: "offset", Type: reflect.TypeOf((*int)(nil))},
},
RenderArgNames: map[int][]string{
73: []string{
"users",
"profiles",
"depts",
"pages",
"userLevel",
},
},
},
&revel.MethodType{
Name: "AddUser",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
85: []string{
"depts",
"userLevel",
"employmentType",
},
},
},
&revel.MethodType{
Name: "DoAddUser",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "username", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "password", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "name", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "phone", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "phone1", Type: reflect.TypeOf((*string)(nil))},
//.........这里部分代码省略.........
开发者ID:baiyuxiong,项目名称:lms,代码行数:101,代码来源:main.go
示例16: main
func main() {
flag.Parse()
revel.Init(*runMode, *importPath, *srcPath)
revel.INFO.Println("Running revel server")
revel.RegisterController((*controllers.App)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Index",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
24: []string{
"blogs",
"recentCnt",
},
},
},
&revel.MethodType{
Name: "WBlog",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
27: []string{},
},
},
})
revel.RegisterController((*controllers0.Static)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Serve",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "prefix", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "filepath", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "ServeModule",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "moduleName", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "prefix", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "filepath", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{},
},
})
revel.RegisterController((*controllers1.TestRunner)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Index",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
70: []string{
"testSuites",
},
},
},
&revel.MethodType{
Name: "Run",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "suite", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "test", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{
107: []string{},
},
},
&revel.MethodType{
Name: "List",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{},
},
})
revel.RegisterController((*controllers.WBlog)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Putup",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "blog", Type: reflect.TypeOf((**models.Blog)(nil))},
},
RenderArgNames: map[int][]string{},
},
})
revel.DefaultValidationKeys = map[string]map[int]string{
"MyRevel/app/models.(*Blog).Validate": {
27: "blog.Title",
31: "blog.Email",
32: "blog.Email",
36: "blog.Subject",
},
}
testing.TestSuites = []interface{}{
(*tests.AppTest)(nil),
}
revel.Run(*port)
}
开发者ID:call-fold,项目名称:Revel_Blog,代码行数:100,代码来源:main.go
示例17: main
func main() {
flag.Parse()
revel.Init(*runMode, *importPath, *srcPath)
revel.INFO.Println("Running revel server")
revel.RegisterController((*controllers.App)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Index",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
29: []string{
"home",
"blogs",
},
},
},
&revel.MethodType{
Name: "WBlog",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
35: []string{
"write",
},
},
},
&revel.MethodType{
Name: "BlogInfor",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "id", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "rcnt", Type: reflect.TypeOf((*int)(nil))},
},
RenderArgNames: map[int][]string{
63: []string{
"blog",
"rcnt",
"comments",
},
},
},
&revel.MethodType{
Name: "Message",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
78: []string{
"messagefun",
"messages",
},
},
},
&revel.MethodType{
Name: "History",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
97: []string{
"historyfun",
"historys",
},
},
},
})
revel.RegisterController((*controllers0.Static)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Serve",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "prefix", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "filepath", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{},
},
&revel.MethodType{
Name: "ServeModule",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "moduleName", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "prefix", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "filepath", Type: reflect.TypeOf((*string)(nil))},
},
RenderArgNames: map[int][]string{},
},
})
revel.RegisterController((*controllers1.TestRunner)(nil),
[]*revel.MethodType{
&revel.MethodType{
Name: "Index",
Args: []*revel.MethodArg{},
RenderArgNames: map[int][]string{
70: []string{
"testSuites",
},
},
},
&revel.MethodType{
Name: "Run",
Args: []*revel.MethodArg{
&revel.MethodArg{Name: "suite", Type: reflect.TypeOf((*string)(nil))},
&revel.MethodArg{Name: "test", Type: reflect.TypeOf((*string)(nil))},
},
//.........这里部分代码省略.........
开发者ID:phillihq,项目名称:myrevels,代码行数:101,代码来源:main.go
示例18: buildApp
func buildApp(args []string) {
if len(args) != 2 {
fmt.Fprintf(os.Stderr, "%s\n%s", cmdBuild.UsageLine, cmdBuild.Long)
return
}
appImportPath, destPath := args[0], args[1]
if !revel.Initialized {
revel.Init("", appImportPath, "")
}
// First, verify that it is either already empty or looks like a previous
// build (to avoid clobbering anything)
if exists(destPath) && !empty(destPath) && !exists(path.Join(destPath, "run.sh")) {
errorf("Abort: %s exists and does not look like a build directory.", destPath)
}
os.RemoveAll(destPath)
os.MkdirAll(destPath, 0777)
app, reverr := harness.Build()
panicOnError(reverr, "Failed to build")
// Included are:
// - run scripts
// - binary
// - revel
// - app
// Revel and the app are in a directory structure mirroring import path
srcPath := path.Join(destPath, "src")
destBinaryPath := path.Join(destPath, filepath.Base(app.BinaryPath))
tmpRevelPath := path.Join(srcPath, filepath.FromSlash(revel.REVEL_IMPORT_PATH))
mustCopyFile(destBinaryPath, app.BinaryPath)
mustChmod(destBinaryPath, 0755)
mustCopyDir(path.Join(tmpRevelPath, "conf"), path.Join(revel.RevelPath, "conf"), nil)
mustCopyDir(path.Join(tmpRevelPath, "templates"), path.Join(revel.RevelPath, "templates"), nil)
mustCopyDir(path.Join(srcPath, filepath.FromSlash(appImportPath)), revel.BasePath, nil)
// Find all the modules used and copy them over.
config := revel.Config.Raw()
modulePaths := make(map[string]string) // import path => filesystem path
for _, section := range config.Sections() {
options, _ := config.SectionOptions(section)
for _, key := range options {
if !strings.HasPrefix(key, "module.") {
continue
}
moduleImportPath, _ := config.String(section, key)
if moduleImportPath == "" {
continue
}
modulePath, err := revel.ResolveImportPath(moduleImportPath)
if err != nil {
revel.ERROR.Fatalln("Failed to load module %s: %s", key[len("module."):], err)
}
modulePaths[moduleImportPath] = modulePath
}
}
for importPath, fsPath := range modulePaths {
mustCopyDir(path.Join(srcPath, importPath), fsPath, nil)
}
tmplData, runShPath := map[string]interface{}{
"BinName": filepath.Base(app.BinaryPath),
"ImportPath": appImportPath,
}, path.Join(destPath, "run.sh")
mustRenderTemplate(
runShPath,
filepath.Join(revel.RevelPath, "../cmd/revel", "package_run.sh.template"),
tmplData)
mustChmod(runShPath, 0755)
mustRenderTemplate(
filepath.Join(destPath, "run.
|
请发表评论