func (r Repository) Exists(a model.Artifact) bool { repo := "releases" if a.IsSnapshot() { repo = "snapshots" } source := r.config.URL + filepath.Join(r.config.Path, repo, a.StorageLocation(r.settings.OS, a.AnyOS)) model.Printf("%s", source) // TODO return false }
func (r Repository) Fetch(a model.Artifact, destination string) error { repo := "releases" if a.IsSnapshot() { repo = "snapshots" } source := r.config.URL + filepath.Join(r.config.Path, repo, a.StorageLocation(r.settings.OS, a.AnyOS)) model.Printf("downloading %s to %s\n", source, destination) sourceURL, err := url.Parse(source) if err != nil { return fmt.Errorf("invalid http request:%v", err) } sourceURL.User = url.UserPassword(r.config.User, r.config.Password) return transport.HttpGetFile(sourceURL.String(), destination) }