瀏覽代碼

fix internal ref. via consts

tags/v0.9.0
jimzhan 9 年之前
父節點
當前提交
e8bb6beb49
共有 3 個檔案被更改,包括 28 行新增2 行删除
  1. +1
    -1
      cmd/rex/run.go
  2. +25
    -0
      internal/consts.go
  3. +2
    -1
      rex.go

+ 1
- 1
cmd/rex/run.go 查看文件

@@ -144,7 +144,7 @@ func Run(ctx *cli.Context) {
cwd = ctx.Args()[0]
}
if abspath, err := filepath.Abs(cwd); err == nil {
env.Set(internal.Root, abspath)
env.Set(internal.ROOT, abspath)
} else {
log.Fatalf("Failed to retrieve the directory: %v", err)
}

+ 25
- 0
internal/consts.go 查看文件

@@ -0,0 +1,25 @@
/* ----------------------------------------------------------------------
* ______ ___ __
* / ____/___ / | ____ __ ___ __/ /_ ___ ________
* / / __/ __ \/ /| | / __ \/ / / / | /| / / __ \/ _ \/ ___/ _ \
* / /_/ / /_/ / ___ |/ / / / /_/ /| |/ |/ / / / / __/ / / __/
* \____/\____/_/ |_/_/ /_/\__. / |__/|__/_/ /_/\___/_/ \___/
* /____/
*
* (C) Copyright 2015 GoAnywhere (http://goanywhere.io).
* ----------------------------------------------------------------------
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ----------------------------------------------------------------------*/
package internal

const ROOT = "rex.root"

+ 2
- 1
rex.go 查看文件

@@ -28,6 +28,7 @@ import (
"path/filepath"
"runtime"

"github.com/goanywhere/rex/internal"
"github.com/goanywhere/rex/modules"
"github.com/goanywhere/x/env"
"github.com/goanywhere/x/fs"
@@ -106,7 +107,7 @@ func Run() {
func init() {
// setup project root
var root = fs.Getcd(2)
env.Set("rex.root", fs.Getcd(2))
env.Set(internal.ROOT, root)
env.Load(filepath.Join(root, ".env"))

// cmd arguments

Loading…
取消
儲存