From 48584d061c1e140c6b85f94d0fc31d0abc28d4f3 Mon Sep 17 00:00:00 2001 From: Zeni Kim Date: Sun, 15 Sep 2024 12:57:15 -0500 Subject: [PATCH] rebuild --- cmd/new.go | 12 ++++++++---- config.json | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/cmd/new.go b/cmd/new.go index 8f50cf1..6658ebf 100644 --- a/cmd/new.go +++ b/cmd/new.go @@ -40,7 +40,7 @@ type RepoMeta struct { // Config file const CONFIG_URL string = "https://git.smarteching.com/goffee/goffee/raw/branch/main/config.json" -const REPO_URL string = "https://git.smarteching.com/goffee/goffee/cup/releases/latest" +const REPO_URL string = "https://git.smarteching.com/api/v1/repos/goffee/cup/releases/latest" // Temporary file name var tempName string @@ -97,11 +97,12 @@ var newCmd = &cobra.Command{ } repoMeta := FetchRepoMeta(REPO_URL) + downloadUrl := strings.Replace(config.ReleaseUrl, "{name}", repoMeta.TagName, 1) // Download the cup release fmt.Println("Downloading a cup ...") - filePath := cn.DownloadGoCondor(&http.Client{}, downloadUrl, cn.GenerateTempName()) + filePath := cn.DownloadCupGoffee(&http.Client{}, downloadUrl, cn.GenerateTempName()) //Unpack file fmt.Println("Unpacking ...") pwd, _ := os.Getwd() @@ -161,8 +162,11 @@ func init() { } // Download cup archive -func (cn *CmdNew) DownloadGoCondor(http *http.Client, url string, tempName string) string { +func (cn *CmdNew) DownloadCupGoffee(http *http.Client, url string, tempName string) string { tempFilePath := os.TempDir() + "/" + tempName + + fmt.Println("the url", url) + response, err := http.Get(url) if err != nil { fmt.Println("error downloading the Cup release") @@ -252,7 +256,7 @@ func fixImports(dirName string, projectRepo string, paths []string) { } } -// Unpack GoCondor +// Unpack cup func (cn *CmdNew) Unpack(filePath string, destPath string) { // Open file file, err := os.Open(filePath) diff --git a/config.json b/config.json index 968b496..060ce68 100644 --- a/config.json +++ b/config.json @@ -1,7 +1,7 @@ { "cliReleasedVersion": "v1.6.1", - "releaseUrl": "https://git.smarteching.com/goffee/goffee/archive/{name}.tar.gz", + "releaseUrl": "https://git.smarteching.com/goffee/cup/archive/{name}.tar.gz", "paths": [ - "git.smarteching.com/goffee/goffee" + "git.smarteching.com/goffee/cup" ] }