From 7961ed1089d912eb0f10502ad60b175d0ae6e792 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9sar=20Gallego=20Rodr=C3=ADguez?= Date: Wed, 4 Sep 2019 10:15:56 +0200 Subject: [PATCH 1/5] first main file --- main.go | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 main.go diff --git a/main.go b/main.go new file mode 100644 index 0000000..4f45c86 --- /dev/null +++ b/main.go @@ -0,0 +1,9 @@ +package main + +import ( + "fmt" +) + +func main() { + fmt.Println("Kapow!") +} From bc0ca07dc2effe50850bbf680f80d31b00d9e37d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9sar=20Gallego=20Rodr=C3=ADguez?= Date: Wed, 4 Sep 2019 10:59:30 +0200 Subject: [PATCH 2/5] first working build --- .gitignore | 1 + Makefile | 16 ++++++++++++++++ Pipfile | 11 +++++++++++ main.go | 5 ++++- pkg/banner/banner.go | 5 +++++ pkg/banner/banner_test.go | 11 +++++++++++ 6 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 Makefile create mode 100644 Pipfile create mode 100644 pkg/banner/banner.go create mode 100644 pkg/banner/banner_test.go diff --git a/.gitignore b/.gitignore index bee8a64..8fa3fbe 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ __pycache__ +coverage.html diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..05a2536 --- /dev/null +++ b/Makefile @@ -0,0 +1,16 @@ +.PHONY: test install acceptance deps + +all: acceptance + +test: deps + go test -race -coverprofile=/tmp/c.out github.com/BBVA/kapow/pkg/... + go tool cover -html=/tmp/c.out -o coverage.html + +install: test + go install github.com/BBVA/kapow/... + +acceptance: install + pipenv run make -C spec/test + +deps: + go install github.com/spf13/cobra diff --git a/Pipfile b/Pipfile new file mode 100644 index 0000000..b723d01 --- /dev/null +++ b/Pipfile @@ -0,0 +1,11 @@ +[[source]] +name = "pypi" +url = "https://pypi.org/simple" +verify_ssl = true + +[dev-packages] + +[packages] + +[requires] +python_version = "3.7" diff --git a/main.go b/main.go index 4f45c86..de00634 100644 --- a/main.go +++ b/main.go @@ -2,8 +2,11 @@ package main import ( "fmt" + + b "github.com/BBVA/kapow/pkg/banner" ) func main() { - fmt.Println("Kapow!") + ban := b.Banner() + fmt.Println(ban) } diff --git a/pkg/banner/banner.go b/pkg/banner/banner.go new file mode 100644 index 0000000..44bd0ce --- /dev/null +++ b/pkg/banner/banner.go @@ -0,0 +1,5 @@ +package banner + +func Banner() string { + return "KAPOW!!!" +} diff --git a/pkg/banner/banner_test.go b/pkg/banner/banner_test.go new file mode 100644 index 0000000..dbd3ddd --- /dev/null +++ b/pkg/banner/banner_test.go @@ -0,0 +1,11 @@ +package banner + +import "testing" + +func TestBanner(t *testing.T) { + ban := Banner() + if ban != "KAPOW!!!" { + t.Errorf("Banner expected KAPOW!!!, but got %v", ban) + t.Fail() + } +} From d56850e69e41eb043dc0d75f7b0e21fc3a949ddc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9sar=20Gallego=20Rodr=C3=ADguez?= Date: Wed, 4 Sep 2019 12:16:14 +0200 Subject: [PATCH 3/5] use a real cool banner --- main.go | 2 +- pkg/banner/banner.go | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index de00634..4e3db80 100644 --- a/main.go +++ b/main.go @@ -7,6 +7,6 @@ import ( ) func main() { - ban := b.Banner() + ban := b.Banner("0.1.0") fmt.Println(ban) } diff --git a/pkg/banner/banner.go b/pkg/banner/banner.go index 44bd0ce..05d42a6 100644 --- a/pkg/banner/banner.go +++ b/pkg/banner/banner.go @@ -1,5 +1,18 @@ package banner -func Banner() string { - return "KAPOW!!!" +import "fmt" + +func Banner(version string) string { + return fmt.Sprintf(` + ___ __ ________ ________ ________ ___ __ ___ +|\ \|\ \ |\ __ \|\ __ \|\ __ \|\ \ |\ \|\ \ +\ \ \/ /|\ \ \|\ \ \ \|\ \ \ \|\ \ \ \ \ \ \ \ \ + \ \ ___ \ \ __ \ \ ____\ \ \\\ \ \ \ __\ \ \ \ \ + \ \ \\ \ \ \ \ \ \ \ \___|\ \ \\\ \ \ \|\__\_\ \ \__\ + \ \__\\ \__\ \__\ \__\ \__\ \ \_______\ \____________\|__| + \|__| \|__|\|__|\|__|\|__| \|_______|\|____________| ___ + |\__\ + \|__| + ver: %s +`, version) } From 02929e0d498ffbed5203dc6c0d7ec690effdd042 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9sar=20Gallego=20Rodr=C3=ADguez?= Date: Wed, 4 Sep 2019 12:31:16 +0200 Subject: [PATCH 4/5] Fix Pipenv creation file from unnecesary running of pipenv. Co-authored-by: nilpointer --- Makefile | 2 +- Pipfile | 11 ----------- pkg/banner/banner_test.go | 4 ++-- 3 files changed, 3 insertions(+), 14 deletions(-) delete mode 100644 Pipfile diff --git a/Makefile b/Makefile index 05a2536..41c5a7b 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ install: test go install github.com/BBVA/kapow/... acceptance: install - pipenv run make -C spec/test + make -C spec/test deps: go install github.com/spf13/cobra diff --git a/Pipfile b/Pipfile deleted file mode 100644 index b723d01..0000000 --- a/Pipfile +++ /dev/null @@ -1,11 +0,0 @@ -[[source]] -name = "pypi" -url = "https://pypi.org/simple" -verify_ssl = true - -[dev-packages] - -[packages] - -[requires] -python_version = "3.7" diff --git a/pkg/banner/banner_test.go b/pkg/banner/banner_test.go index dbd3ddd..9e7b953 100644 --- a/pkg/banner/banner_test.go +++ b/pkg/banner/banner_test.go @@ -3,8 +3,8 @@ package banner import "testing" func TestBanner(t *testing.T) { - ban := Banner() - if ban != "KAPOW!!!" { + ban := Banner("0.0.0") + if ban == "" { t.Errorf("Banner expected KAPOW!!!, but got %v", ban) t.Fail() } From 9ccd3cd61a02a94f9997bf110d64a114d1860ab7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9sar=20Gallego=20Rodr=C3=ADguez?= Date: Wed, 4 Sep 2019 12:40:22 +0200 Subject: [PATCH 5/5] No new deps Co-authored-by: Nilpointer --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 41c5a7b..e6c08a3 100644 --- a/Makefile +++ b/Makefile @@ -13,4 +13,4 @@ acceptance: install make -C spec/test deps: - go install github.com/spf13/cobra + @echo "deps here"