revel/revel#1057 code improvements docs, errcheck, cyclo, etc

This commit is contained in:
Jeevanandam M
2016-06-09 10:33:02 -07:00
parent 5a57eaa743
commit a5c8a8da09
14 changed files with 233 additions and 132 deletions

View File

@@ -1,3 +1,7 @@
// Copyright (c) 2012-2016 The Revel Framework Authors, All rights reserved.
// Revel Framework source code and usage is governed by a MIT style
// license that can be found in the LICENSE file.
package main
import (
@@ -40,7 +44,7 @@ func buildApp(args []string) {
return
}
appImportPath, destPath, mode := args[0], args[1], "dev"
appImportPath, destPath, mode := args[0], args[1], DefaultRunMode
if len(args) >= 3 {
mode = args[2]
}
@@ -55,8 +59,13 @@ func buildApp(args []string) {
errorf("Abort: %s exists and does not look like a build directory.", destPath)
}
os.RemoveAll(destPath)
os.MkdirAll(destPath, 0777)
if err := os.RemoveAll(destPath); err != nil && !os.IsNotExist(err) {
revel.ERROR.Fatalln(err)
}
if err := os.MkdirAll(destPath, 0777); err != nil {
revel.ERROR.Fatalln(err)
}
app, reverr := harness.Build()
panicOnError(reverr, "Failed to build")
@@ -73,9 +82,9 @@ func buildApp(args []string) {
tmpRevelPath := filepath.Join(srcPath, filepath.FromSlash(revel.RevelImportPath))
mustCopyFile(destBinaryPath, app.BinaryPath)
mustChmod(destBinaryPath, 0755)
mustCopyDir(filepath.Join(tmpRevelPath, "conf"), filepath.Join(revel.RevelPath, "conf"), nil)
mustCopyDir(filepath.Join(tmpRevelPath, "templates"), filepath.Join(revel.RevelPath, "templates"), nil)
mustCopyDir(filepath.Join(srcPath, filepath.FromSlash(appImportPath)), revel.BasePath, nil)
_ = mustCopyDir(filepath.Join(tmpRevelPath, "conf"), filepath.Join(revel.RevelPath, "conf"), nil)
_ = mustCopyDir(filepath.Join(tmpRevelPath, "templates"), filepath.Join(revel.RevelPath, "templates"), nil)
_ = mustCopyDir(filepath.Join(srcPath, filepath.FromSlash(appImportPath)), revel.BasePath, nil)
// Find all the modules used and copy them over.
config := revel.Config.Raw()
@@ -98,7 +107,7 @@ func buildApp(args []string) {
}
}
for importPath, fsPath := range modulePaths {
mustCopyDir(filepath.Join(srcPath, importPath), fsPath, nil)
_ = mustCopyDir(filepath.Join(srcPath, importPath), fsPath, nil)
}
tmplData, runShPath := map[string]interface{}{