Validated PR #14 and fixed issues for the PR

This commit is contained in:
Jeevanandam M
2016-05-22 20:40:13 -07:00
parent a6836f3a41
commit 6d12b806d3
2 changed files with 16 additions and 5 deletions

View File

@@ -12,12 +12,17 @@ import (
)
var cmdBuild = &Command{
UsageLine: "build [import path] [target path]",
UsageLine: "build [import path] [target path] [run mode]",
Short: "build a Revel application (e.g. for deployment)",
Long: `
Build the Revel web application named by the given import path.
This allows it to be deployed and run on a machine that lacks a Go installation.
The run mode is used to select which set of app.conf configuration should
apply and may be used to determine logic in the application itself.
Run mode defaults to "prod".
WARNING: The target path will be completely deleted, if it already exists!
For example:
@@ -31,14 +36,20 @@ func init() {
}
func buildApp(args []string) {
if len(args) != 3 {
if len(args) < 2 {
fmt.Fprintf(os.Stderr, "%s\n%s", cmdBuild.UsageLine, cmdBuild.Long)
return
}
appImportPath, destPath, mode := args[0], args[1], args[2]
appImportPath, destPath, mode := args[0], args[1], "prod"
if len(args) >= 3 {
mode = args[2]
}
fmt.Println("mode:", mode)
if !revel.Initialized {
revel.Init("", appImportPath, "")
revel.Init(mode, appImportPath, "")
}
// First, verify that it is either already empty or looks like a previous