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
+
1
5
package main
2
6
3
7
import (
@@ -40,7 +44,7 @@ func buildApp(args []string) {
40
44
return
41
45
}
42
46
43
- appImportPath , destPath , mode := args [0 ], args [1 ], "dev"
47
+ appImportPath , destPath , mode := args [0 ], args [1 ], DefaultRunMode
44
48
if len (args ) >= 3 {
45
49
mode = args [2 ]
46
50
}
@@ -55,8 +59,13 @@ func buildApp(args []string) {
55
59
errorf ("Abort: %s exists and does not look like a build directory." , destPath )
56
60
}
57
61
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
+ }
60
69
61
70
app , reverr := harness .Build ()
62
71
panicOnError (reverr , "Failed to build" )
@@ -73,9 +82,9 @@ func buildApp(args []string) {
73
82
tmpRevelPath := filepath .Join (srcPath , filepath .FromSlash (revel .RevelImportPath ))
74
83
mustCopyFile (destBinaryPath , app .BinaryPath )
75
84
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 )
79
88
80
89
// Find all the modules used and copy them over.
81
90
config := revel .Config .Raw ()
@@ -98,7 +107,7 @@ func buildApp(args []string) {
98
107
}
99
108
}
100
109
for importPath , fsPath := range modulePaths {
101
- mustCopyDir (filepath .Join (srcPath , importPath ), fsPath , nil )
110
+ _ = mustCopyDir (filepath .Join (srcPath , importPath ), fsPath , nil )
102
111
}
103
112
104
113
tmplData , runShPath := map [string ]interface {}{
0 commit comments