mirror of
https://github.com/kevin-DL/revel-cmd.git
synced 2026-01-11 18:54:31 +00:00
Validated PR #14 and fixed issues for the PR
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -44,7 +44,7 @@ func packageApp(args []string) {
|
||||
}
|
||||
|
||||
appImportPath := args[0]
|
||||
revel.Init("", appImportPath, "")
|
||||
revel.Init(mode, appImportPath, "")
|
||||
|
||||
// Remove the archive if it already exists.
|
||||
destFile := filepath.Base(revel.BasePath) + ".tar.gz"
|
||||
|
||||
Reference in New Issue
Block a user