Merge pull request #1453 from technosophos/fix/792-serve-update-index

fix(helm): create index file as 'helm serve' starts up.
pull/1457/head
Matt Butcher 8 years ago committed by GitHub
commit 7009c3c377

@ -28,11 +28,16 @@ import (
"k8s.io/helm/pkg/repo" "k8s.io/helm/pkg/repo"
) )
const serveDesc = `This command starts a local chart repository server that serves charts from a local directory.` const serveDesc = `
This command starts a local chart repository server that serves charts from a local directory.
The new server will provide HTTP access to a repository. By default, it will
scan all of the charts in '$HELM_HOME/repository/local' and serve those over
the a local IPv4 TCP port (default '127.0.0.1:8879').
`
type serveCmd struct { type serveCmd struct {
out io.Writer out io.Writer
home helmpath.Home
address string address string
repoPath string repoPath string
} }
@ -44,7 +49,6 @@ func newServeCmd(out io.Writer) *cobra.Command {
Short: "start a local http web server", Short: "start a local http web server",
Long: serveDesc, Long: serveDesc,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
srv.home = helmpath.Home(homePath())
return srv.run() return srv.run()
}, },
} }
@ -65,6 +69,11 @@ func (s *serveCmd) run() error {
return err return err
} }
fmt.Fprintln(s.out, "Regenerating index. This may take a moment.")
if err := index(repoPath, "http://"+s.address, ""); err != nil {
return err
}
fmt.Fprintf(s.out, "Now serving you on %s\n", s.address) fmt.Fprintf(s.out, "Now serving you on %s\n", s.address)
return repo.StartLocalRepo(repoPath, s.address) return repo.StartLocalRepo(repoPath, s.address)
} }

Loading…
Cancel
Save