From 69e35642681740364c5b01aff18895c326f8f263 Mon Sep 17 00:00:00 2001 From: Caleb Bassi Date: Mon, 22 Oct 2018 19:18:06 -0700 Subject: [PATCH] Cleanup merge from chiefy:feature/nfpm --- .gitignore | 3 +-- Makefile | 32 +++++++++++------------ README.md | 7 +++-- build/{gotop-nfpm.yaml => gotop-nfpm.yml} | 2 +- 4 files changed, 20 insertions(+), 24 deletions(-) rename build/{gotop-nfpm.yaml => gotop-nfpm.yml} (90%) diff --git a/.gitignore b/.gitignore index 0e27b06..9b11b36 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ dist/ -build/gotop -pkg/ \ No newline at end of file +gotop diff --git a/Makefile b/Makefile index 7ddce40..9a31df0 100644 --- a/Makefile +++ b/Makefile @@ -1,34 +1,32 @@ - VERSION=$(shell awk '/([0-9]{1}.?){3}/ {print $$4;}' main.go) -.PHONY: all -all: pkg/gotop.rpm pkg/gotop.deb +.PHONY: default +default: dist/gotop.rpm dist/gotop.deb -build/gotop: +dist/gotop: @GOOS=linux GOARCH=amd64 go build -o $@ -pkg: +dist: @mkdir $@ -pkg/gotop.rpm: pkg build/gotop +dist/gotop.rpm: dist dist/gotop @docker run --rm \ - -v "$(PWD)/build:/tmp/pkg" \ + -v "$(PWD)/build:/tmp/build" \ + -v "$(PWD)/dist:/tmp/dist" \ -e "VERSION=$(VERSION)" \ goreleaser/nfpm pkg \ - --config /tmp/pkg/gotop-nfpm.yaml \ - --target /tmp/pkg/gotop.rpm \ - && mv ./build/gotop.rpm $@ + --config /tmp/build/gotop-nfpm.yml \ + --target /tmp/dist/gotop.rpm -pkg/gotop.deb: pkg build/gotop +dist/gotop.deb: dist dist/gotop @docker run --rm \ - -v "$(PWD)/build:/tmp/pkg" \ + -v "$(PWD)/build:/tmp/build" \ + -v "$(PWD)/dist:/tmp/dist" \ -e "VERSION=$(VERSION)" \ goreleaser/nfpm pkg \ - --config /tmp/pkg/gotop-nfpm.yaml \ - --target /tmp/pkg/gotop.deb \ - && mv ./build/gotop.deb $@ + --config /tmp/build/gotop-nfpm.yml \ + --target /tmp/dist/gotop.deb .PHONY: clean clean: - @-rm -f build/gotop - @-rm -rf pkg \ No newline at end of file + @-rm -rf dist diff --git a/README.md b/README.md index 0cb6b6d..7021e93 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Working and tested on Linux and OSX. Windows support is planned. Clone the repo and then run [scripts/download.sh](https://github.com/cjbassi/gotop/blob/master/scripts/download.sh) to download the correct binary for your system from the [releases tab](https://github.com/cjbassi/gotop/releases): -```sh +```bash git clone --depth 1 https://github.com/cjbassi/gotop /tmp/gotop /tmp/gotop/scripts/download.sh ``` @@ -38,7 +38,7 @@ brew install gotop ### Source -```sh +```bash go get github.com/cjbassi/gotop ``` @@ -81,7 +81,6 @@ To make a custom colorscheme, check out the [template](https://github.com/cjbass `-p`, `--percpu` Show each CPU in the CPU widget. `-a`, `--averagecpu` Show average CPU in the CPU widget. - ## Building deb/rpms To build dep/rpms using [nfpm](https://github.com/goreleaser/nfpm): @@ -90,7 +89,7 @@ To build dep/rpms using [nfpm](https://github.com/goreleaser/nfpm): make all ``` -This will place the built packages into the `pkg` folder. +This will place the built packages into the `dist` folder. ## Credits diff --git a/build/gotop-nfpm.yaml b/build/gotop-nfpm.yml similarity index 90% rename from build/gotop-nfpm.yaml rename to build/gotop-nfpm.yml index a15824a..1e9501a 100644 --- a/build/gotop-nfpm.yaml +++ b/build/gotop-nfpm.yml @@ -12,4 +12,4 @@ homepage: "https://github.com/cjbassi/gotop" license: "GNU Affero General Public License v3.0" bindir: "/usr/local/bin" files: - /tmp/pkg/gotop: "/usr/local/bin/gotop" + /tmp/dist/gotop: "/usr/local/bin/gotop"