New Enhancement

Added ability to create a new revel applicaiton without any sources.
Automatically download all sources required
This commit is contained in:
NotZippy
2018-09-21 10:08:37 -07:00
parent 5973b438c1
commit 69e59efb14
3 changed files with 21 additions and 6 deletions

View File

@@ -73,7 +73,7 @@ func (cmd AppCmd) Start(c *model.CommandConfig) error {
return errors.New("revel/harness: app died reason: " + exitState)
case <-time.After(60 * time.Second):
log.Println("Killing revel server process did not respond after wait timeout.", "processid", cmd.Process.Pid)
utils.Logger.Error("Killing revel server process did not respond after wait timeout.", "processid", cmd.Process.Pid)
cmd.Kill()
return errors.New("revel/harness: app timed out")

View File

@@ -108,8 +108,6 @@ func newApp(c *model.CommandConfig) {
if err != nil {
utils.Logger.Fatal(string(getOutput))
}
// TODO build.Default.GOPATH = build.Default.GOPATH + string(os.PathListSeparator) + c.ImportPath
}
@@ -164,8 +162,12 @@ func setApplicationPath(c *model.CommandConfig) {
_, err = build.Import(model.RevelImportPath, "", build.FindOnly)
if err != nil {
// Go get the revel project
utils.Logger.Fatal("Abort: Could not find Revel source code:", "error", err)
getCmd := exec.Command(c.GoCmd, "get", model.RevelImportPath)
utils.Logger.Info("Exec:" + c.GoCmd, "args", getCmd.Args)
getOutput, err := getCmd.CombinedOutput()
if err != nil {
utils.Logger.Fatal("Failed to fetch revel " + model.RevelImportPath, "getOutput", string(getOutput))
}
}
}
@@ -208,7 +210,19 @@ func setSkeletonPath(c *model.CommandConfig) {
// use the revel default
revelCmdPkg, err := build.Import(RevelCmdImportPath, "", build.FindOnly)
if err != nil {
utils.Logger.Fatalf("Abort: Could not find Revel Cmd source code: %s\n", err)
if err != nil {
// Go get the revel project
getCmd := exec.Command(c.GoCmd, "get", RevelCmdImportPath + "/revel")
utils.Logger.Info("Exec:" + c.GoCmd, "args", getCmd.Args)
getOutput, err := getCmd.CombinedOutput()
if err != nil {
utils.Logger.Fatal("Failed to fetch revel cmd " + RevelCmdImportPath, "getOutput", string(getOutput))
}
revelCmdPkg, err = build.Import(RevelCmdImportPath, "", build.FindOnly)
if err!= nil {
utils.Logger.Fatal("Failed to find source of revel cmd " + RevelCmdImportPath, "getOutput", string(getOutput), "error",err, "dir", revelCmdPkg.Dir)
}
}
}
c.SkeletonPath = filepath.Join(revelCmdPkg.Dir, "revel", "skeleton")

View File

@@ -4,4 +4,5 @@
# See also:
# - http://www.rfc-editor.org/rfc/bcp/bcp47.txt
# - http://www.w3.org/International/questions/qa-accept-lang-locales
[DEFAULT]