mirror of
https://github.com/kevin-DL/revel-cmd.git
synced 2026-01-22 15:05:26 +00:00
Merge branch 'master' of https://github.com/birkirb/cmd into birkirb-master
This commit is contained in:
@@ -2,19 +2,25 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/revel/revel"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/revel/revel"
|
||||
)
|
||||
|
||||
var cmdPackage = &Command{
|
||||
UsageLine: "package [import path]",
|
||||
UsageLine: "package [import path] [run mode]",
|
||||
Short: "package a Revel application (e.g. for deployment)",
|
||||
Long: `
|
||||
Package 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".
|
||||
|
||||
For example:
|
||||
|
||||
revel package github.com/revel/samples/chat
|
||||
@@ -31,6 +37,12 @@ func packageApp(args []string) {
|
||||
return
|
||||
}
|
||||
|
||||
// Determine the run mode.
|
||||
mode := "prod"
|
||||
if len(args) >= 2 {
|
||||
mode = args[1]
|
||||
}
|
||||
|
||||
appImportPath := args[0]
|
||||
revel.Init("", appImportPath, "")
|
||||
|
||||
@@ -42,7 +54,7 @@ func packageApp(args []string) {
|
||||
tmpDir, err := ioutil.TempDir("", filepath.Base(revel.BasePath))
|
||||
panicOnError(err, "Failed to get temp dir")
|
||||
|
||||
buildApp([]string{args[0], tmpDir})
|
||||
buildApp([]string{args[0], tmpDir, mode})
|
||||
|
||||
// Create the zip file.
|
||||
archiveName := mustTarGzDir(destFile, tmpDir)
|
||||
|
||||
Reference in New Issue
Block a user