feat(helm): add local dir in home to store charts

pull/613/head
Michelle Noorali 9 years ago
parent 00b9356a95
commit fbd6ffa4b9

@ -19,6 +19,7 @@ Kubernetes Cluster and sets up local configuration in $HELM_HOME (default: ~/.he
const repositoriesPath = ".repositories"
const cachePath = "cache"
const localPath = "local"
var defaultRepo = map[string]string{"default-name": "default-url"}
var tillerImg string
@ -79,7 +80,7 @@ func buildKubectlRunner(kubectlPath string) kubectl.Runner {
//
// If $HELM_HOME does not exist, this function will create it.
func ensureHome(home string) error {
configDirectories := []string{home, cacheDirectory(home)}
configDirectories := []string{home, CacheDirectory(home), LocalDirectory(home)}
for _, p := range configDirectories {
if fi, err := os.Stat(p); err != nil {
@ -111,3 +112,7 @@ func cacheDirectory(home string) string {
func repositoriesFile(home string) string {
return filepath.Join(home, repositoriesPath)
}
func LocalDirectory(home string) string {
return filepath.Join(home, localPath)
}

@ -12,7 +12,7 @@ func TestEnsureHome(t *testing.T) {
t.Errorf("%s", err)
}
dirs := []string{home, cacheDirectory(home)}
dirs := []string{home, CacheDirectory(home), LocalDirectory(home)}
for _, dir := range dirs {
if fi, err := os.Stat(dir); err != nil {
t.Errorf("%s", err)

@ -24,6 +24,5 @@ var serveCmd = &cobra.Command{
}
func ServeLocal(cmd *cobra.Command, args []string) {
localRepoPath := os.ExpandEnv(helmHome) + "/local/"
repo.StartLocalRepo(localRepoPath)
repo.StartLocalRepo(LocalDirectory(os.ExpandEnv(helmHome)))
}

@ -3,6 +3,7 @@ package repo
import (
"fmt"
"net/http"
"path/filepath"
"strings"
)
@ -32,5 +33,5 @@ func indexHandler(w http.ResponseWriter, r *http.Request) {
}
func serveFile(w http.ResponseWriter, r *http.Request, file string) {
http.ServeFile(w, r, localRepoPath+file)
http.ServeFile(w, r, filepath.Join(localRepoPath, file))
}

Loading…
Cancel
Save