2013-09-03 17:23:58 +00:00
|
|
|
// Copyright 2013 bee authors
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License"): you may
|
|
|
|
// not use this file except in compliance with the License. You may obtain
|
|
|
|
// a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
// License for the specific language governing permissions and limitations
|
|
|
|
// under the License.
|
|
|
|
|
2013-07-24 11:20:30 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
path "path/filepath"
|
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
|
|
|
|
var cmdNew = &Command{
|
|
|
|
UsageLine: "new [appname]",
|
2014-12-18 16:19:34 +00:00
|
|
|
Short: "Create a Beego application",
|
2013-07-24 11:20:30 +00:00
|
|
|
Long: `
|
2014-12-18 16:19:34 +00:00
|
|
|
Creates a Beego application for the given app name in the current directory.
|
2013-07-24 11:20:30 +00:00
|
|
|
|
2014-12-18 16:19:34 +00:00
|
|
|
The command 'new' creates a folder named [appname] and inside the folder deploy
|
|
|
|
the following files/directories structure:
|
2013-07-24 11:20:30 +00:00
|
|
|
|
|
|
|
|- main.go
|
|
|
|
|- conf
|
|
|
|
|- app.conf
|
|
|
|
|- controllers
|
|
|
|
|- default.go
|
|
|
|
|- models
|
2013-12-23 15:45:15 +00:00
|
|
|
|- routers
|
2014-06-24 09:01:31 +00:00
|
|
|
|- router.go
|
2013-12-23 15:28:31 +00:00
|
|
|
|- tests
|
|
|
|
|- default_test.go
|
|
|
|
|- static
|
2013-07-24 11:20:30 +00:00
|
|
|
|- js
|
|
|
|
|- css
|
2014-06-24 09:01:31 +00:00
|
|
|
|- img
|
2013-07-24 11:20:30 +00:00
|
|
|
|- views
|
2014-06-24 09:01:31 +00:00
|
|
|
index.tpl
|
2013-07-24 11:20:30 +00:00
|
|
|
|
|
|
|
`,
|
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
cmdNew.Run = createApp
|
|
|
|
}
|
|
|
|
|
2014-08-15 09:38:51 +00:00
|
|
|
func createApp(cmd *Command, args []string) int {
|
2016-06-01 12:30:29 +00:00
|
|
|
ShowShortVersionBanner()
|
|
|
|
|
2013-07-24 11:20:30 +00:00
|
|
|
if len(args) != 1 {
|
2013-10-30 23:39:44 +00:00
|
|
|
ColorLog("[ERRO] Argument [appname] is missing\n")
|
2013-07-24 11:20:30 +00:00
|
|
|
os.Exit(2)
|
|
|
|
}
|
|
|
|
|
|
|
|
gopath := os.Getenv("GOPATH")
|
|
|
|
Debugf("gopath:%s", gopath)
|
|
|
|
if gopath == "" {
|
2013-10-30 23:39:44 +00:00
|
|
|
ColorLog("[ERRO] $GOPATH not found\n")
|
2016-05-26 16:17:24 +00:00
|
|
|
ColorLog("[HINT] Set $GOPATH in your environment variables\n")
|
2013-07-24 11:20:30 +00:00
|
|
|
os.Exit(2)
|
|
|
|
}
|
|
|
|
|
2016-05-26 16:17:24 +00:00
|
|
|
gosrcpath := path.Join(gopath, "src") // User's workspace
|
|
|
|
apppath := path.Join(gosrcpath, args[0])
|
2013-07-24 11:20:30 +00:00
|
|
|
|
2015-05-09 10:20:08 +00:00
|
|
|
if isExist(apppath) {
|
|
|
|
ColorLog("[ERRO] Path (%s) already exists\n", apppath)
|
|
|
|
ColorLog("[WARN] Do you want to overwrite it? [yes|no]]")
|
|
|
|
if !askForConfirmation() {
|
|
|
|
os.Exit(2)
|
|
|
|
}
|
2013-07-24 11:20:30 +00:00
|
|
|
}
|
|
|
|
|
2016-06-01 12:30:29 +00:00
|
|
|
ColorLog("[INFO] Creating application...\n")
|
2013-07-24 11:20:30 +00:00
|
|
|
|
|
|
|
os.MkdirAll(apppath, 0755)
|
2016-06-01 12:30:29 +00:00
|
|
|
fmt.Println("\tcreate\t", apppath + string(path.Separator))
|
2013-07-24 11:20:30 +00:00
|
|
|
os.Mkdir(path.Join(apppath, "conf"), 0755)
|
2016-06-01 12:30:29 +00:00
|
|
|
fmt.Println("\tcreate\t", path.Join(apppath, "conf") + string(path.Separator))
|
2013-07-24 11:20:30 +00:00
|
|
|
os.Mkdir(path.Join(apppath, "controllers"), 0755)
|
2016-06-01 12:30:29 +00:00
|
|
|
fmt.Println("\tcreate\t", path.Join(apppath, "controllers") + string(path.Separator))
|
2013-07-24 11:20:30 +00:00
|
|
|
os.Mkdir(path.Join(apppath, "models"), 0755)
|
2016-06-01 12:30:29 +00:00
|
|
|
fmt.Println("\tcreate\t", path.Join(apppath, "models") + string(path.Separator))
|
2013-12-23 15:45:15 +00:00
|
|
|
os.Mkdir(path.Join(apppath, "routers"), 0755)
|
2016-06-01 12:30:29 +00:00
|
|
|
fmt.Println("\tcreate\t", path.Join(apppath, "routers") + string(path.Separator))
|
2013-12-23 15:28:31 +00:00
|
|
|
os.Mkdir(path.Join(apppath, "tests"), 0755)
|
2016-06-01 12:30:29 +00:00
|
|
|
fmt.Println("\tcreate\t", path.Join(apppath, "tests") + string(path.Separator))
|
2013-07-24 11:20:30 +00:00
|
|
|
os.Mkdir(path.Join(apppath, "static"), 0755)
|
2016-06-01 12:30:29 +00:00
|
|
|
fmt.Println("\tcreate\t", path.Join(apppath, "static") + string(path.Separator))
|
2013-07-24 11:20:30 +00:00
|
|
|
os.Mkdir(path.Join(apppath, "static", "js"), 0755)
|
2016-06-01 12:30:29 +00:00
|
|
|
fmt.Println("\tcreate\t", path.Join(apppath, "static", "js") + string(path.Separator))
|
2013-07-24 11:20:30 +00:00
|
|
|
os.Mkdir(path.Join(apppath, "static", "css"), 0755)
|
2016-06-01 12:30:29 +00:00
|
|
|
fmt.Println("\tcreate\t", path.Join(apppath, "static", "css") + string(path.Separator))
|
2013-07-24 11:20:30 +00:00
|
|
|
os.Mkdir(path.Join(apppath, "static", "img"), 0755)
|
2016-06-01 12:30:29 +00:00
|
|
|
fmt.Println("\tcreate\t", path.Join(apppath, "static", "img") + string(path.Separator))
|
|
|
|
fmt.Println("\tcreate\t", path.Join(apppath, "views") + string(path.Separator))
|
2013-07-24 11:20:30 +00:00
|
|
|
os.Mkdir(path.Join(apppath, "views"), 0755)
|
2016-06-01 12:30:29 +00:00
|
|
|
fmt.Println("\tcreate\t", path.Join(apppath, "conf", "app.conf"))
|
2016-05-26 16:17:24 +00:00
|
|
|
WriteToFile(path.Join(apppath, "conf", "app.conf"), strings.Replace(appconf, "{{.Appname}}", path.Base(args[0]), -1))
|
2013-07-24 11:20:30 +00:00
|
|
|
|
2016-06-01 12:30:29 +00:00
|
|
|
fmt.Println("\tcreate\t", path.Join(apppath, "controllers", "default.go"))
|
2016-05-26 16:17:24 +00:00
|
|
|
WriteToFile(path.Join(apppath, "controllers", "default.go"), controllers)
|
2013-07-24 11:20:30 +00:00
|
|
|
|
2016-06-01 12:30:29 +00:00
|
|
|
fmt.Println("\tcreate\t", path.Join(apppath, "views", "index.tpl"))
|
2016-05-26 16:17:24 +00:00
|
|
|
WriteToFile(path.Join(apppath, "views", "index.tpl"), indextpl)
|
2013-07-24 11:20:30 +00:00
|
|
|
|
2016-06-01 12:30:29 +00:00
|
|
|
fmt.Println("\tcreate\t", path.Join(apppath, "routers", "router.go"))
|
2016-05-26 16:17:24 +00:00
|
|
|
WriteToFile(path.Join(apppath, "routers", "router.go"), strings.Replace(router, "{{.Appname}}", strings.Join(strings.Split(apppath[len(gosrcpath)+1:], string(path.Separator)), "/"), -1))
|
2013-12-23 15:28:31 +00:00
|
|
|
|
2016-06-01 12:30:29 +00:00
|
|
|
fmt.Println("\tcreate\t", path.Join(apppath, "tests", "default_test.go"))
|
2016-05-26 16:17:24 +00:00
|
|
|
WriteToFile(path.Join(apppath, "tests", "default_test.go"), strings.Replace(test, "{{.Appname}}", strings.Join(strings.Split(apppath[len(gosrcpath)+1:], string(path.Separator)), "/"), -1))
|
2013-12-23 15:28:31 +00:00
|
|
|
|
2016-06-01 12:30:29 +00:00
|
|
|
fmt.Println("\tcreate\t", path.Join(apppath, "main.go"))
|
2016-05-26 16:17:24 +00:00
|
|
|
WriteToFile(path.Join(apppath, "main.go"), strings.Replace(maingo, "{{.Appname}}", strings.Join(strings.Split(apppath[len(gosrcpath)+1:], string(path.Separator)), "/"), -1))
|
2013-07-24 11:20:30 +00:00
|
|
|
|
2013-10-30 23:39:44 +00:00
|
|
|
ColorLog("[SUCC] New application successfully created!\n")
|
2014-08-15 09:38:51 +00:00
|
|
|
return 0
|
2013-07-24 11:20:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
var appconf = `appname = {{.Appname}}
|
|
|
|
httpport = 8080
|
|
|
|
runmode = dev
|
|
|
|
`
|
|
|
|
|
|
|
|
var maingo = `package main
|
|
|
|
|
|
|
|
import (
|
2013-12-23 16:00:52 +00:00
|
|
|
_ "{{.Appname}}/routers"
|
2013-07-24 11:20:30 +00:00
|
|
|
"github.com/astaxie/beego"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
beego.Run()
|
|
|
|
}
|
|
|
|
|
|
|
|
`
|
2013-12-23 16:00:52 +00:00
|
|
|
var router = `package routers
|
2013-12-23 15:28:31 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"{{.Appname}}/controllers"
|
|
|
|
"github.com/astaxie/beego"
|
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
beego.Router("/", &controllers.MainController{})
|
|
|
|
}
|
|
|
|
`
|
|
|
|
|
|
|
|
var test = `package test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
"net/http/httptest"
|
|
|
|
"testing"
|
2014-04-03 08:46:47 +00:00
|
|
|
"runtime"
|
|
|
|
"path/filepath"
|
2013-12-23 16:00:52 +00:00
|
|
|
_ "{{.Appname}}/routers"
|
2014-06-24 09:01:31 +00:00
|
|
|
|
2013-12-23 15:28:31 +00:00
|
|
|
"github.com/astaxie/beego"
|
|
|
|
. "github.com/smartystreets/goconvey/convey"
|
|
|
|
)
|
|
|
|
|
2014-04-03 08:41:44 +00:00
|
|
|
func init() {
|
|
|
|
_, file, _, _ := runtime.Caller(1)
|
2014-06-24 09:01:31 +00:00
|
|
|
apppath, _ := filepath.Abs(filepath.Dir(filepath.Join(file, ".." + string(filepath.Separator))))
|
2014-04-03 08:41:44 +00:00
|
|
|
beego.TestBeegoInit(apppath)
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-12-23 15:28:31 +00:00
|
|
|
// TestMain is a sample to run an endpoint test
|
|
|
|
func TestMain(t *testing.T) {
|
2013-12-23 16:11:13 +00:00
|
|
|
r, _ := http.NewRequest("GET", "/", nil)
|
2013-12-23 15:28:31 +00:00
|
|
|
w := httptest.NewRecorder()
|
|
|
|
beego.BeeApp.Handlers.ServeHTTP(w, r)
|
2014-06-24 09:01:31 +00:00
|
|
|
|
2013-12-23 15:28:31 +00:00
|
|
|
beego.Trace("testing", "TestMain", "Code[%d]\n%s", w.Code, w.Body.String())
|
2014-06-24 09:01:31 +00:00
|
|
|
|
2013-12-23 15:28:31 +00:00
|
|
|
Convey("Subject: Test Station Endpoint\n", t, func() {
|
|
|
|
Convey("Status Code Should Be 200", func() {
|
|
|
|
So(w.Code, ShouldEqual, 200)
|
|
|
|
})
|
|
|
|
Convey("The Result Should Not Be Empty", func() {
|
|
|
|
So(w.Body.Len(), ShouldBeGreaterThan, 0)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
`
|
|
|
|
|
2013-07-24 11:20:30 +00:00
|
|
|
var controllers = `package controllers
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/astaxie/beego"
|
|
|
|
)
|
|
|
|
|
|
|
|
type MainController struct {
|
|
|
|
beego.Controller
|
|
|
|
}
|
|
|
|
|
2014-11-05 14:48:09 +00:00
|
|
|
func (c *MainController) Get() {
|
|
|
|
c.Data["Website"] = "beego.me"
|
|
|
|
c.Data["Email"] = "astaxie@gmail.com"
|
2016-01-07 10:38:43 +00:00
|
|
|
c.TplName = "index.tpl"
|
2013-07-24 11:20:30 +00:00
|
|
|
}
|
|
|
|
`
|
|
|
|
|
|
|
|
var indextpl = `<!DOCTYPE html>
|
|
|
|
|
|
|
|
<html>
|
2014-12-04 07:14:00 +00:00
|
|
|
<head>
|
|
|
|
<title>Beego</title>
|
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
|
|
<link rel="shortcut icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoTWFjaW50b3NoKSIgeG1wTU06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vIgIDXIm5nztfSaiz9K
|
|
|
|
|
|
|
|
<style type="text/css">
|
|
|
|
*,body {
|
|
|
|
margin: 0px;
|
|
|
|
padding: 0px;
|
|
|
|
}
|
|
|
|
|
|
|
|
body {
|
|
|
|
margin: 0px;
|
|
|
|
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
|
|
font-size: 14px;
|
|
|
|
line-height: 20px;
|
|
|
|
background-color: #fff;
|
|
|
|
}
|
|
|
|
|
|
|
|
header,
|
|
|
|
footer {
|
|
|
|
width: 960px;
|
|
|
|
margin-left: auto;
|
|
|
|
margin-right: auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
.logo {
|
|
|
|
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAgAElEQVR42uy9d5Rd13Xm+TvnxhfrVS5UIRSIQEIAQUpMIKlEylGWZblbTi27veyWJXcvjZqW7TVrrPG0Q0vyTKtHtnuWou0ZS1Y7yDOyksdjK9CkJSYxEwCRc6hcr+qFG8+ZP859r14lEAAhEKBqr0VW4b1X995379ln7/3tb+8Na7Ima7Ima7Ima7Ima7Ima7Ima7Ima7Ima7Im17qItVvwyss3vvGNHq31/QCPfPMfAajPVEmTmN71G6kMDjE4OMju3bsBgi1btnx17a5dHbHXbsE1IduFEF9YbcsSYtGLp4E1BVlTkFe/NJvNIlB55plnBqanpgCIwwiANIlJ44QkioiaTcJGg/m5OdBafupTn1qfHeL8e9/73mTtTq4pyKtStNbvFkJ8rK+nh69+4a/RCE499d1FHvDc2Fls3wHL5cGvFXA9b/g1d911KvvAhsyirMn3SOTaLbhGlKXj/wvqoVnh5TVZsyDfV1aEKGhy+sghANZVisviDyGAJEIEMQrNd7/8RQDKg0OP/ca7f1n99C/8W3buvgUhxGfylcrvrd3VNQV51YgQAq01aZyAANu3MpMhltkXoRVaKaKg2Xp9uBW/Z8fpXrujawryPZGpqak9Qohf11pP9vb2/vurdNq/B05Pz8xs33H7nR8COPXov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Znp5mqNxk/P8nUcZt//WNvBaDbVoYKobNIQ0iEJbFSG3/MuI6/
|
|
|
|
background-repeat: no-repeat;
|
|
|
|
-webkit-background-size: 100px 100px;
|
|
|
|
background-size: 100px 100px;
|
|
|
|
background-position: center center;
|
|
|
|
text-align: center;
|
|
|
|
font-size: 42px;
|
|
|
|
padding: 250px 0 70px;
|
|
|
|
font-weight: normal;
|
|
|
|
text-shadow: 0px 1px 2px #ddd;
|
|
|
|
}
|
|
|
|
|
|
|
|
header {
|
|
|
|
padding: 100px 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
footer {
|
|
|
|
line-height: 1.8;
|
|
|
|
text-align: center;
|
|
|
|
padding: 50px 0;
|
|
|
|
color: #999;
|
|
|
|
}
|
|
|
|
|
|
|
|
.description {
|
|
|
|
text-align: center;
|
|
|
|
font-size: 16px;
|
|
|
|
}
|
|
|
|
|
|
|
|
a {
|
|
|
|
color: #444;
|
|
|
|
text-decoration: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.backdrop {
|
|
|
|
position: absolute;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
box-shadow: inset 0px 0px 100px #ddd;
|
|
|
|
z-index: -1;
|
|
|
|
top: 0px;
|
|
|
|
left: 0px;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
<header>
|
|
|
|
<h1 class="logo">Welcome to Beego</h1>
|
|
|
|
<div class="description">
|
|
|
|
Beego is a simple & powerful Go web framework which is inspired by tornado and sinatra.
|
|
|
|
</div>
|
|
|
|
</header>
|
|
|
|
<footer>
|
|
|
|
<div class="author">
|
2014-12-18 16:19:34 +00:00
|
|
|
Official website:
|
|
|
|
<a href="http://{{.Website}}">{{.Website}}</a> /
|
|
|
|
Contact me:
|
2014-12-04 07:14:00 +00:00
|
|
|
<a class="email" href="mailto:{{.Email}}">{{.Email}}</a>
|
|
|
|
</div>
|
|
|
|
</footer>
|
|
|
|
<div class="backdrop"></div>
|
|
|
|
</body>
|
2013-07-24 11:20:30 +00:00
|
|
|
</html>
|
|
|
|
`
|
|
|
|
|
2016-05-26 16:17:24 +00:00
|
|
|
func WriteToFile(filename, content string) {
|
2013-07-24 11:20:30 +00:00
|
|
|
f, err := os.Create(filename)
|
2016-05-26 16:17:24 +00:00
|
|
|
defer f.Close()
|
2013-07-24 11:20:30 +00:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
f.WriteString(content)
|
|
|
|
}
|