Skip to content
This repository was archived by the owner on Jun 25, 2024. It is now read-only.

Commit 97f43ad

Browse files
authored
Merge pull request #31 from KusionStack/fix-npe-for-cdn-source
fix: npe problem in cdn source and refine docs
2 parents 98bd07f + 23534c1 commit 97f43ad

3 files changed

Lines changed: 47 additions & 23 deletions

File tree

README-zh.md

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,24 @@
3333

3434
### Homebrew
3535

36-
`KusionStack/tap` 有 MacOS 和 GNU/Linux 的预编译二进制版本可用
36+
`KusionStack/tap` 有 MacOS 和 GNU/Linux 的预编译二进制版本可用
3737

38+
第一次安装:
3839
```
39-
brew install KusionStack/tap/kusionup
40+
brew install KusionStack/tap/kusionup && kusionup init
41+
```
42+
43+
升级:
44+
```
45+
brew upgrade KusionStack/tap/kusionup
4046
```
4147

4248
### 从源码构建
4349

4450
使用 Go 1.17+ 版本,你可以通过 `go install` 直接从源码安装 `kusionup`
4551

4652
```
47-
go install github.com/KusionStack/kusionup/cmd@latest
53+
go install github.com/KusionStack/kusionup/cmd@latest && kusionup init
4854
```
4955

5056
### Docker
@@ -58,7 +64,15 @@ docker pull kusionstack/kusionup:latest
5864
## ⚡ 使用
5965

6066
```
61-
$ kusionup install
67+
$ kusionup init # Need to run at first execution
68+
69+
$ kusionup ls-ver # View all installable kusion versions
70+
github@latest
71+
github@v0.4.3
72+
cdn@latest
73+
cdn@v0.4.3
74+
75+
$ kusionup install cdn@latest # Install the specified kusion version
6276
Downloaded 0.0% ( 2426 / 139988826 bytes) ...
6377
Downloaded 11.4% ( 16003466 / 139988826 bytes) ...
6478
Downloaded 21.0% ( 29433014 / 139988826 bytes) ...
@@ -70,16 +84,14 @@ Downloaded 71.2% ( 99667706 / 139988826 bytes) ...
7084
Downloaded 81.5% (114078806 / 139988826 bytes) ...
7185
Downloaded 91.5% (128134166 / 139988826 bytes) ...
7286
Downloaded 100.0% (139988826 / 139988826 bytes)
73-
INFO[0053] Unpacking ~/.kusionup/kusion-open@latest/kusion-darwin.tgz ...
74-
INFO[0059] Success: latest downloaded in ~/.kusionup/kusion-open@latest
75-
INFO[0059] Default Kusion is set to 'latest'
87+
INFO[0053] Unpacking ~/.kusionup/kusion-cdn@latest/kusion-darwin.tgz ...
88+
INFO[0059] Success: latest downloaded in ~/.kusionup/kusion-cdn@latest
89+
INFO[0059] Default Kusion is set to 'cdn@latest'
7690
77-
$ kusionup show
91+
$ kusionup show # View all installed kusion versions
7892
| VERSION | ACTIVE |
7993
|---------------|--------|
80-
| latest | * |
81-
82-
$ kusion version
94+
| cdn@latest | * |
8395
```
8496

8597
详情请参考[文档](https://kusionstack.io/docs/user_docs/getting-started/install/kusionup)

README.md

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,24 @@ To get the binary just download the latest release for your OS/Arch from the [re
3333

3434
### Homebrew
3535

36-
The `KusionStack/tap` has macOS and GNU/Linux pre-built binaries available:
36+
The `KusionStack/tap` has macOS and GNU/Linux pre-built binaries available.
3737

38+
First installation:
3839
```
39-
brew install KusionStack/tap/kusionup
40+
brew install KusionStack/tap/kusionup && kusionup init
41+
```
42+
43+
Upgrade:
44+
```
45+
brew upgrade KusionStack/tap/kusionup
4046
```
4147

4248
### Build from Source
4349

4450
Starting with Go 1.17, you can install `kusionup` from source using go install:
4551

4652
```
47-
go install github.com/KusionStack/kusionup/cmd@latest
53+
go install github.com/KusionStack/kusionup/cmd@latest && kusionup init
4854
```
4955

5056
### Docker
@@ -58,7 +64,15 @@ docker pull kusionstack/kusionup:latest
5864
## ⚡ Usage
5965

6066
```
61-
$ kusionup install
67+
$ kusionup init # Need to run at first execution
68+
69+
$ kusionup ls-ver # View all installable kusion versions
70+
github@latest
71+
github@v0.4.3
72+
cdn@latest
73+
cdn@v0.4.3
74+
75+
$ kusionup install cdn@latest # Install the specified kusion version
6276
Downloaded 0.0% ( 2426 / 139988826 bytes) ...
6377
Downloaded 11.4% ( 16003466 / 139988826 bytes) ...
6478
Downloaded 21.0% ( 29433014 / 139988826 bytes) ...
@@ -70,16 +84,14 @@ Downloaded 71.2% ( 99667706 / 139988826 bytes) ...
7084
Downloaded 81.5% (114078806 / 139988826 bytes) ...
7185
Downloaded 91.5% (128134166 / 139988826 bytes) ...
7286
Downloaded 100.0% (139988826 / 139988826 bytes)
73-
INFO[0053] Unpacking ~/.kusionup/kusion-open@latest/kusion-darwin.tgz ...
74-
INFO[0059] Success: latest downloaded in ~/.kusionup/kusion-open@latest
75-
INFO[0059] Default Kusion is set to 'open@latest'
87+
INFO[0053] Unpacking ~/.kusionup/kusion-cdn@latest/kusion-darwin.tgz ...
88+
INFO[0059] Success: latest downloaded in ~/.kusionup/kusion-cdn@latest
89+
INFO[0059] Default Kusion is set to 'cdn@latest'
7690
77-
$ kusionup show
91+
$ kusionup show # View all installed kusion versions
7892
| VERSION | ACTIVE |
7993
|---------------|--------|
80-
| latest | * |
81-
82-
$ kusion version
94+
| cdn@latest | * |
8395
```
8496

8597
For details, please refer to the [documentation](https://kusionstack.io/docs/user_docs/getting-started/install/kusionup)

pkg/sources/cdn/source.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func (s *releaseSource) GetVersions() []string {
4242

4343
func (s *releaseSource) GetDownloadURL(ver string) (string, error) {
4444
vers := s.GetVersions()
45-
if ver == "latest" && len(vers) > 0 {
45+
if ver == "latest" && len(vers) > 1 {
4646
return getArchiveDownloadURL(vers[1])
4747
}
4848

0 commit comments

Comments
 (0)