Skip to content

Commit

Permalink
Prep for release
Browse files Browse the repository at this point in the history
- add release scripts
- add CHANGELOG
- plug mangaeden in main help
- add version command
- update download command help
  • Loading branch information
kmwenja committed May 14, 2017
1 parent 13f81b7 commit 48cc9a4
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
bin
dist
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## v0.1.0 [2017-05-14]

# Release Notes

This is the initial release of Mangaeden.
43 changes: 36 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,40 @@
VERSION := $(shell sh -c 'git describe --always --tags')
LDFLAGS := -ldflags "-X main.version=$(VERSION)"

all: build

build: *.go cmd/mangaeden/*.go
mkdir -p bin
cd cmd/mangaeden/ && go build
mv cmd/mangaeden/mangaeden bin/mangaeden
build: *.go cmd/mangaeden/*.go clean-build
cd cmd/mangaeden/ && go build -o ../../bin/mangaeden $(LDFLAGS)

define go_dist
mkdir -p dist/mangaeden-$(VERSION)_$1_$2/
cd dist/mangaeden-$(VERSION)_$1_$2/ && GOOS=$1 GOARCH=$2 go build -v $(LDFLAGS) github.com/kmwenja/mangaeden/cmd/mangaeden
if [ "$1" = "windows" ]; then \
cd dist/ && zip mangaeden-$(VERSION)_$1_$2.zip mangaeden-$(VERSION)_$1_$2/*; \
else \
cd dist/ && tar -cvzf mangaeden-$(VERSION)_$1_$2.tar.gz mangaeden-$(VERSION)_$1_$2/*; \
fi
endef

dist: clean-dist dist-linux dist-macos dist-windows

dist-macos:
$(call go_dist,darwin,amd64)

dist-linux:
$(call go_dist,linux,amd64)
$(call go_dist,linux,386)

dist-windows:
go get -v github.com/inconshreveable/mousetrap
$(call go_dist,windows,amd64)

clean: clean-build clean-dist

clean-build:
rm -rf ./bin

clean:
rm -r bin
clean-dist:
rm -rf ./dist

.PHONY = clean
.PHONY = clean clean-build clean-dist dist dist-linux dist-macos dist-windows
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ Make sure to checkout [Mangaeden](www.mangaeden.com). All manga content belongs
Install
-------

**Prebuilt binaries**

See [Releases](https://github.com/kmwenja/mangaeden/releases) for Linux, Windows and Mac OS X binaries.

**From Source**

1. `go get -v github.com/kmwenja/mangaeden/cmd/mangaeden/`
2. `go install github.com/kmwenja/mangaeden/cmd/mangaeden/`

Expand Down Expand Up @@ -44,6 +50,7 @@ Hacking
3. Hack hack hack.
4. Build binary: `make`
5. Run the binary: `bin/mangaeden`
6. Make release: `make dist`

`github.com/kmwenja/mangaeden` has the client and supporting structs.
`github.com/kmwenja/mangaeden/cmd/mangaeden/` has the cli code, built with [Cobra](https://github.com/spf13/cobra).
Expand Down
2 changes: 1 addition & 1 deletion cmd/mangaeden/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func DownloadCmd() *cobra.Command {

var cmd = &cobra.Command{
Use: "download [manga id]",
Short: "Download a manga",
Short: "Download the manga with the id provided",
Run: func(ccmd *cobra.Command, args []string) {
if len(args) < 1 {
ccmd.HelpFunc()(ccmd, args)
Expand Down
14 changes: 12 additions & 2 deletions cmd/mangaeden/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,27 @@ import (
"github.com/spf13/cobra"
)

var version string

func main() {
var RootCmd = &cobra.Command{
Use: "mangaeden",
Short: "Mangaeden is a CLI for the Mangaeden API",
Long: `Mangeden is a simple lookup and download CLI
for the Mangaeden API`,
Long: `Mangeden is a simple lookup and download CLI for the Mangaeden API. Make sure to checkout www.mangaeden.com`,
}

var versionCmd = &cobra.Command{
Use: "version",
Short: "Print out the version of this app",
Run: func(ccmd *cobra.Command, args []string) {
fmt.Printf("%s\n", version)
},
}

RootCmd.AddCommand(ListCmd())
RootCmd.AddCommand(InfoCmd())
RootCmd.AddCommand(DownloadCmd())
RootCmd.AddCommand(versionCmd)

if err := RootCmd.Execute(); err != nil {
fmt.Println(err)
Expand Down

0 comments on commit 48cc9a4

Please sign in to comment.