diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 00000000..5008ddfc Binary files /dev/null and b/.DS_Store differ diff --git a/beego/beego.go b/beego/beego.go deleted file mode 100644 index 7bcda8a1..00000000 --- a/beego/beego.go +++ /dev/null @@ -1,58 +0,0 @@ -package beego - -import { - "net" - "net/http" - "net/http/fcgi" - "log" - "strconv" - "./core" -} -type C struct { - core.Content -} - -type M struct{ - core.Model -} - -type D struct{ - core.Config -} - -type U struct{ - core.URL -} - -type A struct{ - core.Controller -} - -type V struct{ - core.View -} - -type BeegoApp struct{ - Port int -} - -func (app *BeegoApp) BeeListen(port int) { - app.Port = port - err := http.ListenAndServe(":"+strconv.Itoa(app.Port), nil) - if err != nil { - log.Fatal("ListenAndServe: ", err) - } -} - -func (app *BeegoApp) BeeListenFcgi(port int) { - app.Port = port - l, err := net.Listen("tcp", "127.0.0.1:"+strconv.Itoa(port)) - if err != nil { - log.Fatal("ListenAndServe: ", err) - } - fcgi.Serve(l, app.Handler) -} - -func Run() { - rootPath, _ := os.Getwd() -} \ No newline at end of file diff --git a/beego/cache/memcache.go b/beego/cache/memcache.go deleted file mode 100644 index e69de29b..00000000 diff --git a/beego/core/acl.go b/beego/core/acl.go deleted file mode 100644 index e69de29b..00000000 diff --git a/beego/core/controller.go b/beego/core/controller.go deleted file mode 100644 index f64c2f14..00000000 --- a/beego/core/controller.go +++ /dev/null @@ -1,19 +0,0 @@ -package beego - -// Interface for controller types that handle requests -type Controller interface { - - // When implemented, handles the request - HandleRequest(c *Context) -} - -// The ControllerFunc type is an adapter to allow the use of -// ordinary functions as goweb handlers. If f is a function -// with the appropriate signature, ControllerFunc(f) is a -// Controller object that calls f. -type ControllerFunc func(*Context) - -// HandleRequest calls f(c). -func (f ControllerFunc) HandleRequest(c *Context) { - f(c) -} \ No newline at end of file diff --git a/beego/core/model.go b/beego/core/model.go deleted file mode 100644 index e69de29b..00000000 diff --git a/beego/core/router.go b/beego/core/router.go deleted file mode 100644 index ddaf30f4..00000000 --- a/beego/core/router.go +++ /dev/null @@ -1,144 +0,0 @@ -package beego - -import ( - "regexp" - "strings" -) - -/* - Route -*/ - -// Represents a single route mapping -type Route struct { - pattern string - parameterKeys ParameterKeyMap - extension string - Path string - Controller Controller - MatcherFuncs []RouteMatcherFunc -} - -func (r *Route) String() string { - return "{Route:'" + r.Path + "'}" -} - -// Makes a new route from the given path -func makeRouteFromPath(path string) *Route { - - // get the path segments - segments := getPathSegments(path) - regexSegments := make([]string, len(segments)) - - // prepare the parameter key map - var paramKeys ParameterKeyMap = make(ParameterKeyMap) - - var extension string - - // pull out any dynamic segments - for index, _ := range segments { - - if isDynamicSegment(segments[index]) { - - // e.g. {id} - - paramKeys[strings.Trim(segments[index], "{}")] = index - regexSegments[index] = ROUTE_REGEX_PLACEHOLDER - - } else if isExtensionSegment(segments[index]) { - - // e.g. .json - extension = segments[index] - - // trim off the last space (we don't need it) - regexSegments = regexSegments[0 : len(regexSegments)-1] - - } else { - - // e.g. "groups" - - regexSegments[index] = segments[index] - - } - - } - - patternString := "/" + strings.Join(regexSegments, "/") - - // return a new route - var route *Route = new(Route) - route.pattern = patternString - route.extension = extension - route.parameterKeys = paramKeys - route.Path = path - route.Controller = nil - return route - -} - -// Gets the parameter values for the route from the specified path -func (route *Route) getParameterValueMap(path string) ParameterValueMap { - return getParameterValueMap(route.parameterKeys, path) -} - -// Checks whether a path matches a route or not -func (route *Route) DoesMatchPath(path string) bool { - - match, error := regexp.MatchString(route.pattern, path) - - if error == nil { - if match { - - if len(route.extension) > 0 { - - // make sure the extensions match too - return strings.HasSuffix(strings.ToLower(path), strings.ToLower(route.extension)) - - } else { - return match - } - - } else { - - return false - - } - - } - - // error :-( - return false - -} - -// Checks whether the context for this request matches the route -func (route *Route) DoesMatchContext(c *Context) bool { - - // by default, we match - var match bool = true - - if len(route.MatcherFuncs) > 0 { - - // there are some matcher functions, so don't automatically - // match by default - let the matchers decide - match = false - - // loop through the matcher functions - for _, f := range route.MatcherFuncs { - - // modify 'match' based on the result of the matcher function - switch f(c) { - case NoMatch: - match = false - case Match: - match = true - } - - } - - } - - // return the result - return match - -} \ No newline at end of file diff --git a/beego/core/view.go b/beego/core/view.go deleted file mode 100644 index e69de29b..00000000 diff --git a/beego/helper/config.go b/beego/helper/config.go deleted file mode 100644 index 13f315b2..00000000 --- a/beego/helper/config.go +++ /dev/null @@ -1,28 +0,0 @@ -package helper - -import ( - "json" - "io/ioutil" - "log" -) - -var config map[string]string - -func ReadConfig(filename string) { - contents, err := ioutil.ReadFile(filename) - if err != nil { - log.Exitf("Impossible to read %s", filename, err) - } - data, err := json.Decode(string(contents)) - if err != nil { - log.Exitf("Can't parse %s as JSON", filename, err) - } - config = map[string]string{ } - for key, value := range data.(map[string]interface{ }) { - config[key] = value.(string) - } -} - -func GetConfig(key string) string { - return config[key]; -} \ No newline at end of file diff --git a/beego/helper/page.go b/beego/helper/page.go deleted file mode 100644 index e69de29b..00000000 diff --git a/beego/orm/activerecord.go b/beego/orm/activerecord.go deleted file mode 100644 index e69de29b..00000000 diff --git a/beego/server/fcgi.go b/beego/server/fcgi.go deleted file mode 100644 index e69de29b..00000000 diff --git a/beego/server/server.go b/beego/server/server.go deleted file mode 100644 index e5fd1a2d..00000000 --- a/beego/server/server.go +++ /dev/null @@ -1,14 +0,0 @@ -package server - -import ( - "bufio" - "bytes" - "errors" - "io" - "log" - "net" - "net/url" - "runtime/debug" - "strconv" - "strings" -) \ No newline at end of file diff --git a/examples/blog/blog.go b/examples/blog/blog.go deleted file mode 100644 index 6c030ce4..00000000 --- a/examples/blog/blog.go +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2011 Google Inc. All rights reserved. -// Use of this source code is governed by the Apache 2.0 -// license that can be found in the LICENSE file. - -package guestbook - -import ( - "../../beego" -) - -func init() { - beego.C.loadconfig() -} - -func main() { - app:=beego.App - app.Run() -} \ No newline at end of file diff --git a/examples/blog/configs/app.yaml b/examples/blog/configs/app.yaml deleted file mode 100644 index 0107267a..00000000 --- a/examples/blog/configs/app.yaml +++ /dev/null @@ -1,6 +0,0 @@ -application: blog -handlers: -- url: "/user" - handlefun:"user.Index" -- url: "/blog" - handlefun:"blog.Index" \ No newline at end of file diff --git a/examples/blog/controller/user.go b/examples/blog/controller/user.go deleted file mode 100644 index 61ad5756..00000000 --- a/examples/blog/controller/user.go +++ /dev/null @@ -1,11 +0,0 @@ -package controller - -import ( - "github.com/astaxie/beego/beego" - "../model" -) - -func UserIndex(w beego.A) { - userinfo :=model.User.getAll() - beego.V.Render(w,"users/index") -} \ No newline at end of file diff --git a/examples/blog/model/user.go b/examples/blog/model/user.go deleted file mode 100644 index ad37141c..00000000 --- a/examples/blog/model/user.go +++ /dev/null @@ -1,14 +0,0 @@ -package model -import ( - "./beego" -) - -type Users struct { - username string - password string - beego.M -} - -func NewUsers() (a *Users) { - return &Users{} -} \ No newline at end of file diff --git a/examples/hello/hello.go b/examples/hello/hello.go deleted file mode 100644 index e2f83b5e..00000000 --- a/examples/hello/hello.go +++ /dev/null @@ -1,14 +0,0 @@ -package helloworld - -import ( - "fmt" - "net/http" -) - -func init() { - http.HandleFunc("/", handle) -} - -func handle(w http.ResponseWriter, r *http.Request) { - fmt.Fprint(w, "Hello, World! 세상아 안녕!") -} diff --git a/tools/generator.go b/tools/generator.go deleted file mode 100644 index e69de29b..00000000 diff --git a/tools/scaffolding.go b/tools/scaffolding.go deleted file mode 100644 index e69de29b..00000000