1+ // Copyright (c) 2012-2016 The Revel Framework Authors, All rights reserved.
2+ // Revel Framework source code and usage is governed by a MIT style
3+ // license that can be found in the LICENSE file.
4+
15package main
26
37import (
@@ -40,7 +44,7 @@ func buildApp(args []string) {
4044 return
4145 }
4246
43- appImportPath , destPath , mode := args [0 ], args [1 ], "dev"
47+ appImportPath , destPath , mode := args [0 ], args [1 ], DefaultRunMode
4448 if len (args ) >= 3 {
4549 mode = args [2 ]
4650 }
@@ -55,8 +59,13 @@ func buildApp(args []string) {
5559 errorf ("Abort: %s exists and does not look like a build directory." , destPath )
5660 }
5761
58- os .RemoveAll (destPath )
59- os .MkdirAll (destPath , 0777 )
62+ if err := os .RemoveAll (destPath ); err != nil && ! os .IsNotExist (err ) {
63+ revel .ERROR .Fatalln (err )
64+ }
65+
66+ if err := os .MkdirAll (destPath , 0777 ); err != nil {
67+ revel .ERROR .Fatalln (err )
68+ }
6069
6170 app , reverr := harness .Build ()
6271 panicOnError (reverr , "Failed to build" )
@@ -73,9 +82,9 @@ func buildApp(args []string) {
7382 tmpRevelPath := filepath .Join (srcPath , filepath .FromSlash (revel .RevelImportPath ))
7483 mustCopyFile (destBinaryPath , app .BinaryPath )
7584 mustChmod (destBinaryPath , 0755 )
76- mustCopyDir (filepath .Join (tmpRevelPath , "conf" ), filepath .Join (revel .RevelPath , "conf" ), nil )
77- mustCopyDir (filepath .Join (tmpRevelPath , "templates" ), filepath .Join (revel .RevelPath , "templates" ), nil )
78- mustCopyDir (filepath .Join (srcPath , filepath .FromSlash (appImportPath )), revel .BasePath , nil )
85+ _ = mustCopyDir (filepath .Join (tmpRevelPath , "conf" ), filepath .Join (revel .RevelPath , "conf" ), nil )
86+ _ = mustCopyDir (filepath .Join (tmpRevelPath , "templates" ), filepath .Join (revel .RevelPath , "templates" ), nil )
87+ _ = mustCopyDir (filepath .Join (srcPath , filepath .FromSlash (appImportPath )), revel .BasePath , nil )
7988
8089 // Find all the modules used and copy them over.
8190 config := revel .Config .Raw ()
@@ -98,7 +107,7 @@ func buildApp(args []string) {
98107 }
99108 }
100109 for importPath , fsPath := range modulePaths {
101- mustCopyDir (filepath .Join (srcPath , importPath ), fsPath , nil )
110+ _ = mustCopyDir (filepath .Join (srcPath , importPath ), fsPath , nil )
102111 }
103112
104113 tmplData , runShPath := map [string ]interface {}{
0 commit comments