Skip to content

Commit

Permalink
go-aah/aah#6 controller namespace, go-aah/aah#11 context
Browse files Browse the repository at this point in the history
  • Loading branch information
jeevatkm committed Mar 21, 2017
1 parent 2da3c5b commit 7400d75
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 21 deletions.
9 changes: 5 additions & 4 deletions aah/aah.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ const (
aah framework - https://aahframework.org
–––––––––––––––––––––––––––––––––––––––––––––––
`
isWindows = (runtime.GOOS == "windows")
aahImportPath = "aahframework.org/aah.v0-unstable"
permRWXRXRX = 0755
permRWRWRW = 0666
isWindows = (runtime.GOOS == "windows")
aahImportPath = "aahframework.org/aah.v0-unstable"
aahCLIImportPath = "aahframework.org/tools.v0/aah"
permRWXRXRX = 0755
permRWRWRW = 0666
)

var (
Expand Down
3 changes: 1 addition & 2 deletions aah/ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -484,10 +484,9 @@ func findMethods(pkg *packageInfo, routeMethods map[string]map[string]uint8, fn

// processed so set to level 2, used to display unimplemented action details
for k, v := range routeMethods {
if strings.HasSuffix(k, "."+controllerName) {
if strings.HasSuffix(k, controllerName) {
if _, found := v[actionName]; found {
v[actionName] = 2
break
}
}
}
Expand Down
25 changes: 11 additions & 14 deletions aah/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ func buildApp(buildCfg *config.Config) (string, error) {
strings.Join(missingActions, "\n\t"))
}

// get all the types info referred aah framework controller
appControllers := prg.FindTypeByEmbeddedType(fmt.Sprintf("%s.Controller", aahImportPath))
// get all the types info referred aah framework context embedded
appControllers := prg.FindTypeByEmbeddedType(fmt.Sprintf("%s.Context", aahImportPath))
appImportPaths := prg.CreateImportPaths(appControllers)

// prepare aah application version and build date
Expand Down Expand Up @@ -216,9 +216,6 @@ import (
)
var (
AppBinaryName = "{{.AppBinaryName}}"
AppVersion = "{{.AppVersion}}"
AppBuildDate = "{{.AppBuildDate}}"
_ = reflect.Invalid
)
Expand All @@ -228,11 +225,17 @@ func main() {
configPath := flag.String("config", "", "Absolute path of external config file.")
flag.Parse()
aah.SetAppBuildInfo(&aah.BuildInfo{
BinaryName: "{{.AppBinaryName}}",
Version: "{{.AppVersion}}",
Date: "{{.AppBuildDate}}",
})
// display application information
if *version {
fmt.Printf("%-12s: %s\n", "Binary Name", AppBinaryName)
fmt.Printf("%-12s: %s\n", "Version", AppVersion)
fmt.Printf("%-12s: %s\n", "Build Date", AppBuildDate)
fmt.Printf("%-12s: %s\n", "Binary Name", aah.AppBuildInfo().BinaryName)
fmt.Printf("%-12s: %s\n", "Version", aah.AppBuildInfo().Version)
fmt.Printf("%-12s: %s\n", "Build Date", aah.AppBuildInfo().Date)
return
}
Expand All @@ -248,12 +251,6 @@ func main() {
aah.MergeAppConfig(externalConfig)
}
aah.SetAppBuildInfo(&aah.BuildInfo{
BinaryName: AppBinaryName,
Version: AppVersion,
Date: AppBuildDate,
})
// Adding all the controllers which refers 'aah.Controller' directly
// or indirectly from app/controllers/** {{ range $i, $c := .AppControllers }}
aah.AddController((*{{index $.AppImportPaths .ImportPath}}.{{.Name}})(nil),
Expand Down
2 changes: 1 addition & 1 deletion aah/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func newRun(args []string) {
}

func createAahApp(appDir, importPath, mode, appName string) error {
aahToolsPath, err := build.Import("aahframework.org/tools/aah", "", build.FindOnly)
aahToolsPath, err := build.Import(aahCLIImportPath, "", build.FindOnly)
if err != nil {
log.Fatal(err)
}
Expand Down

0 comments on commit 7400d75

Please sign in to comment.