Explorar el Código

fix internal ref. via consts

tags/v0.9.0
jimzhan hace 9 años
padre
commit
e8bb6beb49
Se han modificado 3 ficheros con 28 adiciones y 2 borrados
  1. +1
    -1
      cmd/rex/run.go
  2. +25
    -0
      internal/consts.go
  3. +2
    -1
      rex.go

+ 1
- 1
cmd/rex/run.go Ver fichero

@@ -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 Ver fichero

@@ -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 Ver fichero

@@ -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

Cargando…
Cancelar
Guardar