diff --git a/Gopkg.lock b/Gopkg.lock index 37cf1dc08..3b9a9908a 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -123,6 +123,14 @@ revision = "ccb8e960c48f04d6935e72476ae4a51028f9e22f" version = "v9" +[[projects]] + branch = "master" + digest = "1:ef3589c5082eac12d04efdeca6dab7f8bac2d10bac4cfdbe51b252e4022b535a" + name = "github.com/casimir/xdg-go" + packages = ["."] + pruneopts = "UT" + revision = "372ccc2180dab73316615641d5617c5ed3e35529" + [[projects]] branch = "master" digest = "1:d6afaeed1502aa28e80a4ed0981d570ad91b2579193404256ce672ed0a609e0d" @@ -1624,6 +1632,7 @@ "github.com/docker/distribution/registry", "github.com/docker/distribution/registry/storage/driver/inmemory", "github.com/docker/go-units", + "github.com/casimir/xdg-go", "github.com/evanphx/json-patch", "github.com/ghodss/yaml", "github.com/gobwas/glob", diff --git a/Gopkg.toml b/Gopkg.toml index 4c334aa7f..482e6138b 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -54,6 +54,10 @@ name = "github.com/stretchr/testify" version = "^1.3.0" +[[constraint]] + branch = "master" + name = "github.com/casimir/xdg-go" + [[override]] name = "k8s.io/apiserver" branch = "release-1.13" diff --git a/cmd/helm/init.go b/cmd/helm/init.go index f665bbe42..ad91308d4 100644 --- a/cmd/helm/init.go +++ b/cmd/helm/init.go @@ -36,7 +36,7 @@ import ( ) const initDesc = ` -This command sets up local configuration in $HELM_HOME (default ~/.helm/). +This command sets up local configuration in $HELM_HOME (default $XDG_CONFIG_DIR/helm/). ` const ( diff --git a/cmd/helm/root.go b/cmd/helm/root.go index ec47071d7..dba679e93 100644 --- a/cmd/helm/root.go +++ b/cmd/helm/root.go @@ -44,7 +44,11 @@ Common actions from this point include: - helm list: list releases of charts Environment: - $HELM_HOME set an alternative location for Helm files. By default, these are stored in ~/.helm + $HELM_HOME set an alternative location for Helm files. By default, these are stored in + "$XDG_CONFIG_DIR/helm"" on *nix, "%APPDATA%\helm" on Windows and + "$HOME/Library/Preferences" on OSX. + NOTE: if you have old-style "~/.helm" directory, it will be used, but consider + moving it to a new home. $HELM_DRIVER set the backend storage driver. Values are: configmap, secret, memory $HELM_NO_PLUGINS disable plugins. Set HELM_NO_PLUGINS=1 to disable plugins. $KUBECONFIG set an alternative Kubernetes configuration file (default "~/.kube/config") diff --git a/cmd/helm/root_test.go b/cmd/helm/root_test.go index 163b24bb6..924ec8a7a 100644 --- a/cmd/helm/root_test.go +++ b/cmd/helm/root_test.go @@ -34,7 +34,7 @@ func TestRootCmd(t *testing.T) { { name: "defaults", args: "home", - home: filepath.Join(homedir.HomeDir(), ".helm"), + home: filepath.Join(homedir.HomeDir(), ".config/helm"), }, { name: "with --home set", diff --git a/pkg/helm/environment/environment.go b/pkg/helm/environment/environment.go index c0b911175..73744b78b 100644 --- a/pkg/helm/environment/environment.go +++ b/pkg/helm/environment/environment.go @@ -23,6 +23,7 @@ These dependencies are expressed as interfaces so that alternate implementations package environment import ( + "fmt" "github.com/casimir/xdg-go" "os" "path/filepath" @@ -33,7 +34,6 @@ import ( "k8s.io/helm/pkg/helm/helmpath" ) - var oldDefaultHelmHome = filepath.Join(homedir.HomeDir(), ".helm") var defaultHelmHome = filepath.Join(xdg.ConfigHome(), "helm") @@ -46,7 +46,7 @@ func getDefaultConfigHome() string { } else if _, err := os.Stat(oldDefaultHelmHome); err != nil { return defaultHelmHome } - // TODO: Write a warning to output + fmt.Printf("WARNING: using old-style configuration directiry. Please, consider moving it to %s\n", defaultHelmHome) return oldDefaultHelmHome } diff --git a/pkg/helm/environment/environment_test.go b/pkg/helm/environment/environment_test.go index 48e048862..f54127c6d 100644 --- a/pkg/helm/environment/environment_test.go +++ b/pkg/helm/environment/environment_test.go @@ -40,8 +40,8 @@ func TestEnvSettings(t *testing.T) { }{ { name: "defaults", - home: oldDefaultHelmHome, - plugins: helmpath.Home(oldDefaultHelmHome).Plugins(), + home: defaultHelmHome, + plugins: helmpath.Home(defaultHelmHome).Plugins(), ns: "", }, {