Skip to content

Commit

Permalink
Merge pull request #27 from vssio/fix-update
Browse files Browse the repository at this point in the history
vss self update の最後に実行する `vss self version` が失敗する問題を修正
  • Loading branch information
zztkm authored Apr 21, 2024
2 parents 659f800 + afdbbac commit 7712a61
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
- FIX
- バグ修正

## v0.11.0

- [FIX] vss self update の最後に実行する `vss self version` が失敗する問題を修正しました

## v0.10.0

- [FIX] goroutine でコンテンツを生成するときに意図しないデータの上書きが発生し、ビルド結果が正しくないことがある問題を修正しました
Expand Down
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ serve-site: build

.PHONY: selfupdate
selfupdate: build
cp $(BIN) bin
cd bin && ./vss self update
./vss self update

.PHONY: show-version
show-version: $(GOBIN)/gobump
Expand Down
2 changes: 1 addition & 1 deletion commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package vss

import (
"github.com/mitchellh/cli"

"github.com/vssio/go-vss/internal/command"
)

Expand All @@ -19,7 +20,6 @@ func initCommands(metaPtr *command.Meta) map[string]cli.CommandFactory {
return &command.BuildCommand{
Meta: meta,
}, nil

},
"serve": func() (cli.Command, error) {
return &command.ServeCommand{
Expand Down
16 changes: 8 additions & 8 deletions internal/build/filedata.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package build

// FileData is a struct for markdown file data.
type FileData struct {
Path string
Content string
FrontMatter YamlFrontMatter
}
package build

// FileData is a struct for markdown file data.
type FileData struct {
Path string
Content string
FrontMatter YamlFrontMatter
}
13 changes: 5 additions & 8 deletions internal/command/self_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"io"
"log"
"net/http"
"os"
"os/exec"
"path/filepath"
"runtime"
Expand All @@ -22,6 +21,7 @@ import (

const (
latestReleaseUrl = "https://github.com/vssio/go-vss/releases/latest/download"
exe = "vss"
)

type SelfUpdateCommand struct {
Expand Down Expand Up @@ -81,13 +81,6 @@ func (c *SelfUpdateCommand) Run(args []string) int {
}
log.Printf("[INFO] Successfully updated")

// vss --version でバージョンが表示されるようにする
// 出力は標準出力になる
exe, err := filepath.Abs(os.Args[0])
if err != nil {
log.Printf("[ERROR] %s", err)
return 1
}
cmd := exec.Command(exe, "self", "version")
output, err := cmd.CombinedOutput()
if err != nil {
Expand Down Expand Up @@ -161,6 +154,10 @@ func extractZip(resp *http.Response) (io.Reader, error) {

bufr := bufra.NewBufReaderAt(bytes.NewReader(buf.Bytes()), buf.Len())
r, err := zip.NewReader(bufr, int64(buf.Len()))
if err != nil {
return nil, err
}

for _, file := range r.File {
filename := filepath.Join(strings.Split(file.Name, "/")[1:]...)
if filename == binaryName {
Expand Down

0 comments on commit 7712a61

Please sign in to comment.