Procházet zdrojové kódy

fix internal ref. via consts

tags/v0.9.0
jimzhan před 10 roky
rodič
revize
e8bb6beb49
3 změnil soubory, kde provedl 28 přidání a 2 odebrání
  1. +1
    -1
      cmd/rex/run.go
  2. +25
    -0
      internal/consts.go
  3. +2
    -1
      rex.go

+ 1
- 1
cmd/rex/run.go Zobrazit soubor

cwd = ctx.Args()[0] cwd = ctx.Args()[0]
} }
if abspath, err := filepath.Abs(cwd); err == nil { if abspath, err := filepath.Abs(cwd); err == nil {
env.Set(internal.Root, abspath)
env.Set(internal.ROOT, abspath)
} else { } else {
log.Fatalf("Failed to retrieve the directory: %v", err) log.Fatalf("Failed to retrieve the directory: %v", err)
} }

+ 25
- 0
internal/consts.go Zobrazit soubor

/* ----------------------------------------------------------------------
* ______ ___ __
* / ____/___ / | ____ __ ___ __/ /_ ___ ________
* / / __/ __ \/ /| | / __ \/ / / / | /| / / __ \/ _ \/ ___/ _ \
* / /_/ / /_/ / ___ |/ / / / /_/ /| |/ |/ / / / / __/ / / __/
* \____/\____/_/ |_/_/ /_/\__. / |__/|__/_/ /_/\___/_/ \___/
* /____/
*
* (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 Zobrazit soubor

"path/filepath" "path/filepath"
"runtime" "runtime"


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


// cmd arguments // cmd arguments

Načítá se…
Zrušit
Uložit