Define a plugin compiler.

This commit is contained in:
jregan
2019-04-07 11:16:50 -07:00
committed by Jeffrey Regan
parent 1623f1e4c0
commit 175c754f61
9 changed files with 259 additions and 107 deletions

View File

@@ -34,12 +34,12 @@ func ConfigRoot() string {
dir := os.Getenv(XDG_CONFIG_HOME)
if len(dir) == 0 {
dir = filepath.Join(
homeDir(), defaultConfigSubdir)
HomeDir(), defaultConfigSubdir)
}
return filepath.Join(dir, PgmName)
return filepath.Join(dir, ProgramName)
}
func homeDir() string {
func HomeDir() string {
home := os.Getenv(homeEnv())
if len(home) > 0 {
return home

View File

@@ -34,7 +34,7 @@ func TestConfigDirNoXdg(t *testing.T) {
}
if !strings.HasSuffix(
s,
rootedPath(defaultConfigSubdir, PgmName)) {
rootedPath(defaultConfigSubdir, ProgramName)) {
t.Fatalf("unexpected config dir: %s", s)
}
}
@@ -50,7 +50,7 @@ func TestConfigDirWithXdg(t *testing.T) {
if isSet {
os.Setenv(XDG_CONFIG_HOME, xdg)
}
if s != rootedPath("blah", PgmName) {
if s != rootedPath("blah", ProgramName) {
t.Fatalf("unexpected config dir: %s", s)
}
}

View File

@@ -28,6 +28,9 @@ var KustomizationFileNames = []string{
}
const (
PgmName = "kustomize"
Repo = "sigs.k8s.io"
// Program name, for help, finding the XDG_CONFIG_DIR, etc.
ProgramName = "kustomize"
// Domain from which kustomize code is imported, for locating
// plugin source code under $GOPATH.
DomainName = "sigs.k8s.io"
)