Permalink
Browse files

Revert the string of attempted windows fixes to get back into a known…

… good state for Linux/OSX.

Instead, use the smallest fix that has been reported to work.
  • Loading branch information...
1 parent 27cd203 commit 5fb04bac0a3d8d79cfafb10f0a9f72963a4e3776 @robfig committed Feb 10, 2013
Showing with 63 additions and 71 deletions.
  1. +11 −10 cmd/build.go
  2. +2 −2 cmd/clean.go
  3. +6 −5 cmd/new.go
  4. +7 −7 cmd/test.go
  5. +3 −2 cmd/util.go
  6. +2 −2 config.go
  7. +4 −4 harness/build.go
  8. +2 −1 i18n.go
  9. +11 −11 revel.go
  10. +5 −5 router.go
  11. +6 −19 router_test.go
  12. +2 −2 server.go
  13. +2 −1 util_test.go
View
@@ -5,6 +5,7 @@ import (
"github.com/robfig/revel"
"github.com/robfig/revel/harness"
"os"
+ "path"
"path/filepath"
)
@@ -51,25 +52,25 @@ func buildApp(args []string) {
// - app
// Revel and the app are in a directory structure mirroring import path
- srcPath := filepath.Join(destPath, "src")
- tmpRevelPath := filepath.Join(srcPath, filepath.FromSlash(revel.REVEL_IMPORT_PATH))
- mustCopyFile(filepath.Join(destPath, filepath.Base(app.BinaryPath)), app.BinaryPath)
- 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)
+ srcPath := path.Join(destPath, "src")
+ tmpRevelPath := path.Join(srcPath, filepath.FromSlash(revel.REVEL_IMPORT_PATH))
+ mustCopyFile(path.Join(destPath, filepath.Base(app.BinaryPath)), app.BinaryPath)
+ mustCopyDir(path.Join(tmpRevelPath, "conf"), path.Join(revel.RevelPath, "conf"), nil)
+ mustCopyDir(path.Join(tmpRevelPath, "templates"), path.Join(revel.RevelPath, "templates"), nil)
+ mustCopyDir(path.Join(srcPath, filepath.FromSlash(appImportPath)), revel.BasePath, nil)
tmplData := map[string]interface{}{
"BinName": filepath.Base(app.BinaryPath),
"ImportPath": appImportPath,
}
mustRenderTemplate(
- filepath.Join(destPath, "run.sh"),
- filepath.Join(revel.RevelPath, "cmd", "package_run.sh.template"),
+ path.Join(destPath, "run.sh"),
+ path.Join(revel.RevelPath, "cmd", "package_run.sh.template"),
tmplData)
mustRenderTemplate(
- filepath.Join(destPath, "run.bat"),
- filepath.Join(revel.RevelPath, "cmd", "package_run.bat.template"),
+ path.Join(destPath, "run.bat"),
+ path.Join(revel.RevelPath, "cmd", "package_run.bat.template"),
tmplData)
}
View
@@ -4,7 +4,7 @@ import (
"fmt"
"go/build"
"os"
- "path/filepath"
+ "path"
)
var cmdClean = &Command{
@@ -38,7 +38,7 @@ func cleanApp(args []string) {
}
// Remove the app/tmp directory.
- tmpDir := filepath.Join(appPkg.Dir, "app", "tmp")
+ tmpDir := path.Join(appPkg.Dir, "app", "tmp")
fmt.Println("Removing:", tmpDir)
err = os.RemoveAll(tmpDir)
if err != nil {
View
@@ -6,6 +6,7 @@ import (
"go/build"
"math/rand"
"os"
+ "path"
"path/filepath"
)
@@ -45,7 +46,7 @@ func newApp(args []string) {
}
importPath := args[0]
- if filepath.IsAbs(importPath) {
+ if path.IsAbs(importPath) {
errorf("Abort: '%s' looks like a directory. Please provide a Go import path instead.",
importPath)
}
@@ -62,12 +63,12 @@ func newApp(args []string) {
return
}
- srcRoot := filepath.Join(filepath.SplitList(gopath)[0], "src")
- appDir := filepath.Join(srcRoot, filepath.FromSlash(importPath))
+ srcRoot := path.Join(filepath.SplitList(gopath)[0], "src")
+ appDir := path.Join(srcRoot, filepath.FromSlash(importPath))
err = os.MkdirAll(appDir, 0777)
panicOnError(err, "Failed to create directory "+appDir)
- skeletonBase = filepath.Join(revelPkg.Dir, "skeleton")
+ skeletonBase = path.Join(revelPkg.Dir, "skeleton")
mustCopyDir(appDir, skeletonBase, map[string]interface{}{
// app.conf
"AppName": filepath.Base(appDir),
@@ -76,7 +77,7 @@ func newApp(args []string) {
// Dotfiles are skipped by mustCopyDir, so we have to explicitly copy the .gitignore.
gitignore := ".gitignore"
- mustCopyFile(filepath.Join(appDir, gitignore), filepath.Join(skeletonBase, gitignore))
+ mustCopyFile(path.Join(appDir, gitignore), path.Join(skeletonBase, gitignore))
fmt.Fprintln(os.Stdout, "Your application is ready:\n ", appDir)
fmt.Fprintln(os.Stdout, "\nYou can run it with:\n revel run", importPath)
View
@@ -9,7 +9,7 @@ import (
"io/ioutil"
"net/http"
"os"
- "path/filepath"
+ "path"
"strings"
"time"
)
@@ -59,15 +59,15 @@ func testApp(args []string) {
if !testRunnerFound {
errorf(`Error: The testrunner module is not running.
-You can add it to a run mode configuration with the following line:
+You can add it to a run mode configuration with the following line:
module.testrunner = github.com/robfig/revel/modules/testrunner
`)
}
// Create a directory to hold the test result files.
- resultPath := filepath.Join(revel.BasePath, "test-results")
+ resultPath := path.Join(revel.BasePath, "test-results")
if err = os.RemoveAll(resultPath); err != nil {
errorf("Failed to remove test result directory %s: %s", resultPath, err)
}
@@ -76,7 +76,7 @@ You can add it to a run mode configuration with the following line:
}
// Direct all the output into a file in the test-results directory.
- file, err := os.OpenFile(filepath.Join(resultPath, "app.log"), os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
+ file, err := os.OpenFile(path.Join(resultPath, "app.log"), os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
if err != nil {
errorf("Failed to create log file: %s", err)
}
@@ -155,7 +155,7 @@ You can add it to a run mode configuration with the following line:
fmt.Printf("%8s%3s%6ds\n", suiteResultStr, suiteAlert, int(time.Since(startTime).Seconds()))
// Create the result HTML file.
- suiteResultFilename := filepath.Join(resultPath,
+ suiteResultFilename := path.Join(resultPath,
fmt.Sprintf("%s.%s.html", suite.Name, strings.ToLower(suiteResultStr)))
suiteResultFile, err := os.Create(suiteResultFilename)
if err != nil {
@@ -177,8 +177,8 @@ You can add it to a run mode configuration with the following line:
}
func writeResultFile(resultPath, name, content string) {
- if err := ioutil.WriteFile(filepath.Join(resultPath, name), []byte(content), 0666); err != nil {
- errorf("Failed to write result file %s: %s", filepath.Join(resultPath, name), err)
+ if err := ioutil.WriteFile(path.Join(resultPath, name), []byte(content), 0666); err != nil {
+ errorf("Failed to write result file %s: %s", path.Join(resultPath, name), err)
}
}
View
@@ -7,6 +7,7 @@ import (
"github.com/robfig/revel"
"io"
"os"
+ "path"
"path/filepath"
"strings"
"text/template"
@@ -63,7 +64,7 @@ func mustCopyDir(destDir, srcDir string, data map[string]interface{}) error {
// Get the relative path from the source base, and the corresponding path in
// the dest directory.
relSrcPath := strings.TrimLeft(srcPath[len(srcDir):], string(os.PathSeparator))
- destPath := filepath.Join(destDir, relSrcPath)
+ destPath := path.Join(destDir, relSrcPath)
// Skip dot files and dot directories.
if strings.HasPrefix(relSrcPath, ".") {
@@ -75,7 +76,7 @@ func mustCopyDir(destDir, srcDir string, data map[string]interface{}) error {
// Create a subdirectory if necessary.
if info.IsDir() {
- err := os.MkdirAll(filepath.Join(destDir, relSrcPath), 0777)
+ err := os.MkdirAll(path.Join(destDir, relSrcPath), 0777)
if !os.IsExist(err) {
panicOnError(err, "Failed to create directory")
}
View
@@ -3,7 +3,7 @@ package revel
import (
"errors"
"github.com/robfig/config"
- "path/filepath"
+ "path"
"strings"
)
@@ -19,7 +19,7 @@ type MergedConfig struct {
func LoadConfig(confName string) (*MergedConfig, error) {
var err error
for _, confPath := range ConfPaths {
- conf, err := config.ReadDefault(filepath.Join(confPath, confName))
+ conf, err := config.ReadDefault(path.Join(confPath, confName))
if err == nil {
return &MergedConfig{conf, ""}, nil
}
View
@@ -41,7 +41,7 @@ func Build() (app *App, compileError *revel.Error) {
})
// Create a fresh temp dir.
- tmpPath := filepath.Join(revel.AppPath, "tmp")
+ tmpPath := path.Join(revel.AppPath, "tmp")
err := os.RemoveAll(tmpPath)
if err != nil {
revel.ERROR.Println("Failed to remove tmp dir:", err)
@@ -52,7 +52,7 @@ func Build() (app *App, compileError *revel.Error) {
}
// Create the main.go file
- controllersFile, err := os.Create(filepath.Join(tmpPath, "main.go"))
+ controllersFile, err := os.Create(path.Join(tmpPath, "main.go"))
defer controllersFile.Close()
if err != nil {
revel.ERROR.Fatalf("Failed to create main.go: %v", err)
@@ -77,7 +77,7 @@ func Build() (app *App, compileError *revel.Error) {
if err != nil {
revel.ERROR.Fatalln("Failure importing", revel.ImportPath)
}
- binName := filepath.Join(pkg.BinDir, path.Base(revel.BasePath))
+ binName := path.Join(pkg.BinDir, path.Base(revel.BasePath))
if runtime.GOOS == "windows" {
binName += ".exe"
}
@@ -86,7 +86,7 @@ func Build() (app *App, compileError *revel.Error) {
for {
buildCmd := exec.Command(goPath, "build",
"-tags", buildTags,
- "-o", binName, filepath.Join(revel.ImportPath, "app", "tmp"))
+ "-o", binName, path.Join(revel.ImportPath, "app", "tmp"))
revel.TRACE.Println("Exec:", buildCmd.Args)
output, err := buildCmd.CombinedOutput()
View
@@ -4,6 +4,7 @@ import (
"fmt"
"github.com/robfig/config"
"os"
+ "path"
"path/filepath"
"regexp"
"strings"
@@ -87,7 +88,7 @@ func parseLocale(locale string) (language, region string) {
// Load the messages when Revel boots.
func init() {
- InitHooks = append(InitHooks, func() { loadMessages(filepath.Join(BasePath, messageFilesDirectory)) })
+ InitHooks = append(InitHooks, func() { loadMessages(path.Join(BasePath, messageFilesDirectory)) })
}
// Recursively read and cache all available messages from all message files on the given path.
View
@@ -92,21 +92,21 @@ func Init(mode, importPath, srcPath string) {
revelSourcePath = SourcePath
}
- RevelPath = filepath.Join(revelSourcePath, filepath.FromSlash(REVEL_IMPORT_PATH))
- BasePath = filepath.Join(SourcePath, filepath.FromSlash(importPath))
- AppPath = filepath.Join(BasePath, "app")
- ViewsPath = filepath.Join(AppPath, "views")
+ RevelPath = path.Join(revelSourcePath, filepath.FromSlash(REVEL_IMPORT_PATH))
+ BasePath = path.Join(SourcePath, filepath.FromSlash(importPath))
+ AppPath = path.Join(BasePath, "app")
+ ViewsPath = path.Join(AppPath, "views")
CodePaths = []string{AppPath}
ConfPaths = []string{
- filepath.Join(BasePath, "conf"),
- filepath.Join(RevelPath, "conf"),
+ path.Join(BasePath, "conf"),
+ path.Join(RevelPath, "conf"),
}
TemplatePaths = []string{
ViewsPath,
- filepath.Join(RevelPath, "templates"),
+ path.Join(RevelPath, "templates"),
}
// Load app.conf
@@ -237,18 +237,18 @@ func loadModules() {
func addModule(name, importPath, modulePath string) {
Modules = append(Modules, Module{Name: name, ImportPath: importPath, Path: modulePath})
- if codePath := filepath.Join(modulePath, "app"); DirExists(codePath) {
+ if codePath := path.Join(modulePath, "app"); DirExists(codePath) {
CodePaths = append(CodePaths, codePath)
}
- if viewsPath := filepath.Join(modulePath, "app", "views"); DirExists(viewsPath) {
+ if viewsPath := path.Join(modulePath, "app", "views"); DirExists(viewsPath) {
TemplatePaths = append(TemplatePaths, viewsPath)
}
- INFO.Print("Loaded module ", filepath.Base(modulePath))
+ INFO.Print("Loaded module ", path.Base(modulePath))
// Hack: There is presently no way for the testrunner module to add the
// "test" subdirectory to the CodePaths. So this does it instead.
if importPath == "github.com/robfig/revel/modules/testrunner" {
- CodePaths = append(CodePaths, filepath.Join(BasePath, "tests"))
+ CodePaths = append(CodePaths, path.Join(BasePath, "tests"))
}
}
View
@@ -5,7 +5,7 @@ import (
"io/ioutil"
"net/http"
"net/url"
- "path/filepath"
+ "path"
"regexp"
"strings"
)
@@ -131,11 +131,11 @@ func (r *Route) Match(method string, reqPath string) *RouteMatch {
// Check if it is specifying a module.. if so, look there instead.
// This is a tenative syntax: "staticDir:moduleName:(directory)"
var basePath, dirName string
- if i := strings.Index(r.staticDir, ":"); i != -1 && !filepath.IsAbs(r.staticDir) {
+ if i := strings.Index(r.staticDir, ":"); i != -1 {
moduleName, dirName := r.staticDir[:i], r.staticDir[i+1:]
for _, module := range Modules {
if module.Name == moduleName {
- basePath = filepath.Join(module.Path, dirName)
+ basePath = path.Join(module.Path, dirName)
}
}
if basePath == "" {
@@ -144,12 +144,12 @@ func (r *Route) Match(method string, reqPath string) *RouteMatch {
}
} else {
dirName = r.staticDir
- if !filepath.IsAbs(dirName) {
+ if !path.IsAbs(dirName) {
basePath = BasePath
}
}
return &RouteMatch{
- StaticFilename: filepath.Join(basePath, dirName, matches[1]),
+ StaticFilename: path.Join(basePath, dirName, matches[1]),
}
}
Oops, something went wrong.

0 comments on commit 5fb04ba

Please sign in to comment.