forked from goffee/goffee
rebuild
This commit is contained in:
parent
7f4e3c39da
commit
48584d061c
2 changed files with 10 additions and 6 deletions
12
cmd/new.go
12
cmd/new.go
|
|
@ -40,7 +40,7 @@ type RepoMeta struct {
|
||||||
// Config file
|
// Config file
|
||||||
const CONFIG_URL string = "https://git.smarteching.com/goffee/goffee/raw/branch/main/config.json"
|
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
|
// Temporary file name
|
||||||
var tempName string
|
var tempName string
|
||||||
|
|
@ -97,11 +97,12 @@ var newCmd = &cobra.Command{
|
||||||
}
|
}
|
||||||
|
|
||||||
repoMeta := FetchRepoMeta(REPO_URL)
|
repoMeta := FetchRepoMeta(REPO_URL)
|
||||||
|
|
||||||
downloadUrl := strings.Replace(config.ReleaseUrl, "{name}", repoMeta.TagName, 1)
|
downloadUrl := strings.Replace(config.ReleaseUrl, "{name}", repoMeta.TagName, 1)
|
||||||
|
|
||||||
// Download the cup release
|
// Download the cup release
|
||||||
fmt.Println("Downloading a cup ...")
|
fmt.Println("Downloading a cup ...")
|
||||||
filePath := cn.DownloadGoCondor(&http.Client{}, downloadUrl, cn.GenerateTempName())
|
filePath := cn.DownloadCupGoffee(&http.Client{}, downloadUrl, cn.GenerateTempName())
|
||||||
//Unpack file
|
//Unpack file
|
||||||
fmt.Println("Unpacking ...")
|
fmt.Println("Unpacking ...")
|
||||||
pwd, _ := os.Getwd()
|
pwd, _ := os.Getwd()
|
||||||
|
|
@ -161,8 +162,11 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Download cup archive
|
// 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
|
tempFilePath := os.TempDir() + "/" + tempName
|
||||||
|
|
||||||
|
fmt.Println("the url", url)
|
||||||
|
|
||||||
response, err := http.Get(url)
|
response, err := http.Get(url)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("error downloading the Cup release")
|
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) {
|
func (cn *CmdNew) Unpack(filePath string, destPath string) {
|
||||||
// Open file
|
// Open file
|
||||||
file, err := os.Open(filePath)
|
file, err := os.Open(filePath)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"cliReleasedVersion": "v1.6.1",
|
"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": [
|
"paths": [
|
||||||
"git.smarteching.com/goffee/goffee"
|
"git.smarteching.com/goffee/cup"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue