mirror of
https://github.com/kevin-DL/revel-cmd.git
synced 2026-01-22 15:05:26 +00:00
Validated PR #14 and fixed issues for the PR
This commit is contained in:
@@ -12,12 +12,17 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var cmdBuild = &Command{
|
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)",
|
Short: "build a Revel application (e.g. for deployment)",
|
||||||
Long: `
|
Long: `
|
||||||
Build the Revel web application named by the given import path.
|
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.
|
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!
|
WARNING: The target path will be completely deleted, if it already exists!
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
@@ -31,14 +36,20 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func buildApp(args []string) {
|
func buildApp(args []string) {
|
||||||
if len(args) != 3 {
|
if len(args) < 2 {
|
||||||
fmt.Fprintf(os.Stderr, "%s\n%s", cmdBuild.UsageLine, cmdBuild.Long)
|
fmt.Fprintf(os.Stderr, "%s\n%s", cmdBuild.UsageLine, cmdBuild.Long)
|
||||||
return
|
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 {
|
if !revel.Initialized {
|
||||||
revel.Init("", appImportPath, "")
|
revel.Init(mode, appImportPath, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
// First, verify that it is either already empty or looks like a previous
|
// First, verify that it is either already empty or looks like a previous
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ func packageApp(args []string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
appImportPath := args[0]
|
appImportPath := args[0]
|
||||||
revel.Init("", appImportPath, "")
|
revel.Init(mode, appImportPath, "")
|
||||||
|
|
||||||
// Remove the archive if it already exists.
|
// Remove the archive if it already exists.
|
||||||
destFile := filepath.Base(revel.BasePath) + ".tar.gz"
|
destFile := filepath.Base(revel.BasePath) + ".tar.gz"
|
||||||
|
|||||||
Reference in New Issue
Block a user