Deprecate upgrade (#99)

* Deprecate upgrade

* Automate using goreleaser

* Fix name and version

* Automate
This commit is contained in:
Sung Won Cho 2018-09-01 16:30:15 +10:00 committed by GitHub
commit b3a12aed85
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 40 additions and 22 deletions

1
.gitignore vendored
View file

@ -3,3 +3,4 @@ main
tmp/
/vendor
test-dnote
/dist

25
.goreleaser.yml Normal file
View file

@ -0,0 +1,25 @@
archive:
format: binary
name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
builds:
-
binary: dnote
ldflags:
- -X core.Version={{.Version}}
- -X main.apiEndpoint=https://api.dnote.io
goos:
- darwin
- linux
- windows
- openbsd
goarch:
- amd64
- 386
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^refactor:'

View file

@ -4,7 +4,6 @@
- [view](#dnote-view)
- [edit](#dnote-edit)
- [remove](#dnote-remove)
- [upgrade](#dnote-upgrade)
- [login](#dnote-login)
- [sync](#dnote-sync)
@ -68,10 +67,6 @@ $ dnote remove JS 1
$ dnote remove -b JS
```
## dnote upgrade
Upgrade the Dnote if newer release is available
## dnote sync
_Dnote Cloud only_

View file

@ -1,20 +1,14 @@
release:
@echo "** Releasing version $(VERSION)..."
@echo "** Building..."
@$(MAKE) build
@echo "** Tagging and pushing..."
@git tag -a $(VERSION) -m "$(VERSION)"
@git push --tags
@goreleaser
.PHONY: release
build: install-gox
@$(GOPATH)/bin/gox -ldflags "-X main.apiEndpoint=https://api.dnote.io" -osarch="darwin/386 darwin/amd64 linux/386 linux/amd64 openbsd/386 openbsd/amd64 window/386 windows/amd64" -output="dnote-{{.OS}}-{{.Arch}}" ./...
.PHONY: build
install-gox:
@echo "** Installing Gox..."
@go get github.com/mitchellh/gox
.PHONY: install-gox
build-snapshot:
@goreleaser --snapshot --rm-dist
.PHONY: build-snapshot
clean:
@git clean -f

View file

@ -11,12 +11,15 @@ import (
var example = `
dnote upgrade`
var deprecationWarning = `see https://github.com/dnote/cli/issues/96.`
func NewCmd(ctx infra.DnoteCtx) *cobra.Command {
cmd := &cobra.Command{
Use: "upgrade",
Short: "Upgrades dnote",
Example: example,
RunE: newRun(ctx),
Use: "upgrade",
Short: "Upgrades dnote",
Example: example,
RunE: newRun(ctx),
Deprecated: deprecationWarning,
}
return cmd

View file

@ -14,7 +14,7 @@ func NewCmd(ctx infra.DnoteCtx) *cobra.Command {
Short: "Print the version number of Dnote",
Long: "Print the version number of Dnote",
Run: func(cmd *cobra.Command, args []string) {
fmt.Printf("dnote v%s\n", core.Version)
fmt.Printf("dnote %s\n", core.Version)
},
}

View file

@ -19,7 +19,7 @@ import (
const (
// Version is the current version of dnote
Version = "0.4.0"
Version = "master"
// TimestampFilename is the name of the file containing upgrade info
TimestampFilename = "timestamps"

View file

@ -17,11 +17,11 @@ import (
"github.com/dnote/cli/cmd/edit"
"github.com/dnote/cli/cmd/login"
"github.com/dnote/cli/cmd/ls"
"github.com/dnote/cli/cmd/view"
"github.com/dnote/cli/cmd/remove"
"github.com/dnote/cli/cmd/sync"
"github.com/dnote/cli/cmd/upgrade"
"github.com/dnote/cli/cmd/version"
"github.com/dnote/cli/cmd/view"
)
// apiEndpoint is populated during link time