rename and use CacheRelativeIndex to do something

pull/3596/head
Christopher A. Stelma 8 years ago
parent a7930fd906
commit 984dd54838

@ -86,7 +86,7 @@ func addRepository(name, url string, home helmpath.Home, certFile, keyFile, caFi
return fmt.Errorf("repository name (%s) already exists, please specify a different name", name)
}
cif := home.RelativeIndex(name)
cif := home.CacheRelativeIndex(name)
c := repo.Entry{
Name: name,
Cache: cif,

@ -57,12 +57,11 @@ func (h Home) Cache() string {
// CacheIndex returns the path to an index for the given named repository.
func (h Home) CacheIndex(name string) string {
target := fmt.Sprintf("%s-index.yaml", name)
return h.Path("repository", "cache", target)
return h.Path("repository", "cache", h.CacheRelativeIndex(name))
}
// RelativeIndex returns the relative path to an index for the given named repository.
func (h Home) RelativeIndex(name string) string {
// CacheRelativeIndex returns the relative path to an index for the given named repository from the cache path.
func (h Home) CacheRelativeIndex(name string) string {
target := fmt.Sprintf("%s-index.yaml", name)
return filepath.Join(target)
}

@ -36,7 +36,7 @@ func TestHelmHome(t *testing.T) {
isEq(t, hh.LocalRepository(), "/r/repository/local")
isEq(t, hh.Cache(), "/r/repository/cache")
isEq(t, hh.CacheIndex("t"), "/r/repository/cache/t-index.yaml")
isEq(t, hh.RelativeIndex("t"), "t-index.yaml")
isEq(t, hh.CacheRelativeIndex("t"), "t-index.yaml")
isEq(t, hh.Starters(), "/r/starters")
isEq(t, hh.Archive(), "/r/cache/archive")
isEq(t, hh.TLSCaCert(), "/r/ca.pem")

@ -33,7 +33,7 @@ func TestHelmHome(t *testing.T) {
isEq(t, hh.LocalRepository(), "r:\\repository\\local")
isEq(t, hh.Cache(), "r:\\repository\\cache")
isEq(t, hh.CacheIndex("t"), "r:\\repository\\cache\\t-index.yaml")
isEq(t, hh.RelativeIndex("t"), "t-index.yaml")
isEq(t, hh.CacheRelativeIndex("t"), "t-index.yaml")
isEq(t, hh.Starters(), "r:\\starters")
isEq(t, hh.Archive(), "r:\\cache\\archive")
isEq(t, hh.TLSCaCert(), "r:\\ca.pem")

Loading…
Cancel
Save