offset all the directories and files to $HELM_HOME/repository from $HELM_HOME

pull/716/head
vaikas-google 9 years ago
parent 5e1ef0ce86
commit a27e23990e

@ -74,7 +74,7 @@ func installTiller() error {
// //
// If $HELM_HOME does not exist, this function will create it. // If $HELM_HOME does not exist, this function will create it.
func ensureHome() error { func ensureHome() error {
configDirectories := []string{homePath(), cacheDirectory(), localRepoDirectory()} configDirectories := []string{homePath(), repositoryDirectory(), cacheDirectory(), localRepoDirectory()}
for _, p := range configDirectories { for _, p := range configDirectories {
if fi, err := os.Stat(p); err != nil { if fi, err := os.Stat(p); err != nil {

@ -6,6 +6,7 @@ import (
) )
const ( const (
repositoryDir string = "repository"
repositoriesFilePath string = "repositories.yaml" repositoriesFilePath string = "repositories.yaml"
cachePath string = "cache" cachePath string = "cache"
localRepoPath string = "local" localRepoPath string = "local"
@ -16,16 +17,21 @@ func homePath() string {
return os.ExpandEnv(helmHome) return os.ExpandEnv(helmHome)
} }
// All other directories go under the $HELM_HOME/repository.
func repositoryDirectory() string {
return homePath() + "/" + repositoryDir
}
func cacheDirectory(paths ...string) string { func cacheDirectory(paths ...string) string {
fragments := append([]string{homePath(), cachePath}, paths...) fragments := append([]string{repositoryDirectory(), cachePath}, paths...)
return filepath.Join(fragments...) return filepath.Join(fragments...)
} }
func localRepoDirectory(paths ...string) string { func localRepoDirectory(paths ...string) string {
fragments := append([]string{homePath(), localRepoPath}, paths...) fragments := append([]string{repositoryDirectory(), localRepoPath}, paths...)
return filepath.Join(fragments...) return filepath.Join(fragments...)
} }
func repositoriesFile() string { func repositoriesFile() string {
return filepath.Join(homePath(), repositoriesFilePath) return filepath.Join(repositoryDirectory(), repositoriesFilePath)
} }

Loading…
Cancel
Save