mirror of
https://github.com/denoland/deno.git
synced 2025-02-07 23:06:50 -05:00
Rename --root flag to --cachedir
This commit is contained in:
parent
016684a586
commit
5353e9e90f
3 changed files with 7 additions and 5 deletions
|
@ -3,6 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"crypto/md5"
|
"crypto/md5"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
|
"flag"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -12,6 +13,9 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var flagCacheDir = flag.String("cachedir", "",
|
||||||
|
"Where to cache compilation artifacts. Default: ~/.deno")
|
||||||
|
|
||||||
var DenoDir string
|
var DenoDir string
|
||||||
var CacheDir string
|
var CacheDir string
|
||||||
var SrcDir string
|
var SrcDir string
|
||||||
|
@ -90,10 +94,10 @@ func UserHomeDir() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func createDirs() {
|
func createDirs() {
|
||||||
if *flagRoot == "" {
|
if *flagCacheDir == "" {
|
||||||
DenoDir = path.Join(UserHomeDir(), ".deno")
|
DenoDir = path.Join(UserHomeDir(), ".deno")
|
||||||
} else {
|
} else {
|
||||||
DenoDir = *flagRoot
|
DenoDir = *flagCacheDir
|
||||||
}
|
}
|
||||||
CacheDir = path.Join(DenoDir, "cache")
|
CacheDir = path.Join(DenoDir, "cache")
|
||||||
err := os.MkdirAll(CacheDir, 0700)
|
err := os.MkdirAll(CacheDir, 0700)
|
||||||
|
|
|
@ -59,7 +59,7 @@ func checkOutput(t *testing.T, outFile string, denoFn string) {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd := exec.Command(denoFn, "--root="+dir, jsFile)
|
cmd := exec.Command(denoFn, "--cachedir="+dir, jsFile)
|
||||||
var out bytes.Buffer
|
var out bytes.Buffer
|
||||||
cmd.Stdout = &out
|
cmd.Stdout = &out
|
||||||
err = cmd.Run()
|
err = cmd.Run()
|
||||||
|
|
2
main.go
2
main.go
|
@ -13,8 +13,6 @@ var flagReload = flag.Bool("reload", false, "Reload cached remote source code.")
|
||||||
var flagV8Options = flag.Bool("v8-options", false, "Print V8 command line options.")
|
var flagV8Options = flag.Bool("v8-options", false, "Print V8 command line options.")
|
||||||
var flagDebug = flag.Bool("debug", false, "Enable debug output.")
|
var flagDebug = flag.Bool("debug", false, "Enable debug output.")
|
||||||
var flagGoProf = flag.String("goprof", "", "Write golang cpu profile to file.")
|
var flagGoProf = flag.String("goprof", "", "Write golang cpu profile to file.")
|
||||||
var flagRoot = flag.String("root", "",
|
|
||||||
"Where to cache compilation artifacts. Default: ~/.deno")
|
|
||||||
|
|
||||||
func stringAsset(path string) string {
|
func stringAsset(path string) string {
|
||||||
data, err := Asset("dist/" + path)
|
data, err := Asset("dist/" + path)
|
||||||
|
|
Loading…
Add table
Reference in a new issue