From 527824cf833ee8bb0a8d01e51285e84957255a86 Mon Sep 17 00:00:00 2001 From: Maksym Kryvchun Date: Sun, 12 Jun 2022 20:27:34 +0300 Subject: [PATCH] v2 version (#33) * v2 version * Fix naming --- .gitignore | 3 +++ cmd/gherkingen/main.go | 2 +- go.mod | 2 +- internal/app/app.go | 2 +- internal/app/app_test.go | 4 ++-- internal/app/generator.go | 8 ++++---- internal/app/readers.go | 2 +- internal/app/templates.go | 2 +- internal/app/version.go | 2 +- internal/assets/assets_test.go | 2 +- internal/assets/std.struct.v1.go.tmpl | 2 +- .../docplugin/goplugin/goaliaser/goaliaser_test.go | 2 +- internal/docplugin/goplugin/goplugin.go | 4 ++-- internal/docplugin/goplugin/goplugin_test.go | 6 +++--- internal/docplugin/multiplugin/multiplugin.go | 4 ++-- internal/docplugin/multiplugin/multiplugin_test.go | 6 +++--- internal/docplugin/plugin.go | 2 +- internal/generator/examples/background.feature_test.go | 2 +- internal/generator/examples/issue_26.feature_test.go | 2 +- internal/generator/examples/readme.feature_test.go | 2 +- internal/generator/examples/rules.feature_test.go | 2 +- internal/generator/examples/scenario.feature_test.go | 2 +- internal/generator/examples/simple.feature_test.go | 2 +- internal/generator/generator.go | 4 ++-- internal/generator/generator_test.go | 4 ++-- internal/generator/golang.go | 2 +- internal/generator/golang_test.go | 10 +++++----- internal/generator/json.go | 2 +- internal/generator/json_test.go | 4 ++-- internal/generator/raw.go | 2 +- internal/generator/raw_test.go | 4 ++-- internal/model/document_test.go | 2 +- internal/model/enums_test.go | 2 +- pkg/{v1 => }/bdd/bdd.go | 0 pkg/{v1 => }/bdd/bdd_test.go | 2 +- 35 files changed, 54 insertions(+), 51 deletions(-) rename pkg/{v1 => }/bdd/bdd.go (100%) rename pkg/{v1 => }/bdd/bdd_test.go (97%) diff --git a/.gitignore b/.gitignore index 0408850..d7efa53 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,9 @@ *.dylib bin +# IDE +.vscode + # Test binary, built with `go test -c` *.test diff --git a/cmd/gherkingen/main.go b/cmd/gherkingen/main.go index f0ecc98..52a2755 100644 --- a/cmd/gherkingen/main.go +++ b/cmd/gherkingen/main.go @@ -3,7 +3,7 @@ package main import ( "os" - "github.com/hedhyw/gherkingen/internal/app" + "github.com/hedhyw/gherkingen/v2/internal/app" ) // Version will be set on build. diff --git a/go.mod b/go.mod index 0526b9c..c0a9ef1 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/hedhyw/gherkingen +module github.com/hedhyw/gherkingen/v2 go 1.18 diff --git a/internal/app/app.go b/internal/app/app.go index 059cf40..4b94054 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -7,7 +7,7 @@ import ( "strings" "time" - "github.com/hedhyw/gherkingen/internal/model" + "github.com/hedhyw/gherkingen/v2/internal/model" "github.com/google/uuid" ) diff --git a/internal/app/app_test.go b/internal/app/app_test.go index 6b3a100..dae22c6 100644 --- a/internal/app/app_test.go +++ b/internal/app/app_test.go @@ -5,8 +5,8 @@ import ( "flag" "testing" - "github.com/hedhyw/gherkingen/internal/app" - "github.com/hedhyw/gherkingen/pkg/v1/bdd" + "github.com/hedhyw/gherkingen/v2/internal/app" + "github.com/hedhyw/gherkingen/v2/pkg/bdd" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/internal/app/generator.go b/internal/app/generator.go index d11edc3..d7d4512 100644 --- a/internal/app/generator.go +++ b/internal/app/generator.go @@ -4,10 +4,10 @@ import ( "fmt" "io" - "github.com/hedhyw/gherkingen/internal/docplugin/goplugin" - "github.com/hedhyw/gherkingen/internal/docplugin/multiplugin" - "github.com/hedhyw/gherkingen/internal/generator" - "github.com/hedhyw/gherkingen/internal/model" + "github.com/hedhyw/gherkingen/v2/internal/docplugin/goplugin" + "github.com/hedhyw/gherkingen/v2/internal/docplugin/multiplugin" + "github.com/hedhyw/gherkingen/v2/internal/generator" + "github.com/hedhyw/gherkingen/v2/internal/model" ) func runGenerator( diff --git a/internal/app/readers.go b/internal/app/readers.go index 778502b..7352b79 100644 --- a/internal/app/readers.go +++ b/internal/app/readers.go @@ -7,7 +7,7 @@ import ( "os" "strings" - "github.com/hedhyw/gherkingen/internal/assets" + "github.com/hedhyw/gherkingen/v2/internal/assets" "github.com/hedhyw/semerr/pkg/v1/semerr" ) diff --git a/internal/app/templates.go b/internal/app/templates.go index 089de72..b54828c 100644 --- a/internal/app/templates.go +++ b/internal/app/templates.go @@ -4,7 +4,7 @@ import ( "fmt" "io" - "github.com/hedhyw/gherkingen/internal/assets" + "github.com/hedhyw/gherkingen/v2/internal/assets" ) func runListTemplates(out io.Writer) (err error) { diff --git a/internal/app/version.go b/internal/app/version.go index 283cd9f..aa21deb 100644 --- a/internal/app/version.go +++ b/internal/app/version.go @@ -6,7 +6,7 @@ import ( ) func runVersion(w io.Writer, version string) error { - fmt.Fprintln(w, "github.com/hedhyw/gherkingen@"+version) + fmt.Fprintln(w, "github.com/hedhyw/gherkingen/v2@"+version) return nil } diff --git a/internal/assets/assets_test.go b/internal/assets/assets_test.go index f07ecdd..c38bea4 100644 --- a/internal/assets/assets_test.go +++ b/internal/assets/assets_test.go @@ -4,7 +4,7 @@ import ( "io/ioutil" "testing" - "github.com/hedhyw/gherkingen/internal/assets" + "github.com/hedhyw/gherkingen/v2/internal/assets" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/internal/assets/std.struct.v1.go.tmpl b/internal/assets/std.struct.v1.go.tmpl index 0e752cf..8b09f63 100644 --- a/internal/assets/std.struct.v1.go.tmpl +++ b/internal/assets/std.struct.v1.go.tmpl @@ -3,7 +3,7 @@ package {{ .PackageName }} import ( "testing" - "github.com/hedhyw/gherkingen/pkg/v1/bdd" + "github.com/hedhyw/gherkingen/v2/pkg/bdd" ) {{ define "Background" }} diff --git a/internal/docplugin/goplugin/goaliaser/goaliaser_test.go b/internal/docplugin/goplugin/goaliaser/goaliaser_test.go index 3f0c8a6..3fd3fb4 100644 --- a/internal/docplugin/goplugin/goaliaser/goaliaser_test.go +++ b/internal/docplugin/goplugin/goaliaser/goaliaser_test.go @@ -3,7 +3,7 @@ package goaliaser_test import ( "testing" - "github.com/hedhyw/gherkingen/internal/docplugin/goplugin/goaliaser" + "github.com/hedhyw/gherkingen/v2/internal/docplugin/goplugin/goaliaser" "github.com/stretchr/testify/assert" ) diff --git a/internal/docplugin/goplugin/goplugin.go b/internal/docplugin/goplugin/goplugin.go index 1a5be7a..42ea213 100644 --- a/internal/docplugin/goplugin/goplugin.go +++ b/internal/docplugin/goplugin/goplugin.go @@ -6,8 +6,8 @@ import ( "reflect" "strings" - "github.com/hedhyw/gherkingen/internal/docplugin/goplugin/goaliaser" - "github.com/hedhyw/gherkingen/internal/model" + "github.com/hedhyw/gherkingen/v2/internal/docplugin/goplugin/goaliaser" + "github.com/hedhyw/gherkingen/v2/internal/model" ) const maxRecursionDepth = 10 diff --git a/internal/docplugin/goplugin/goplugin_test.go b/internal/docplugin/goplugin/goplugin_test.go index d95516e..e408fc2 100644 --- a/internal/docplugin/goplugin/goplugin_test.go +++ b/internal/docplugin/goplugin/goplugin_test.go @@ -4,8 +4,8 @@ import ( "context" "testing" - "github.com/hedhyw/gherkingen/internal/docplugin/goplugin" - "github.com/hedhyw/gherkingen/internal/model" + "github.com/hedhyw/gherkingen/v2/internal/docplugin/goplugin" + "github.com/hedhyw/gherkingen/v2/internal/model" "github.com/stretchr/testify/assert" ) @@ -65,7 +65,7 @@ func TestGoPluginProcess(t *testing.T) { t.Run("Examples_underscore", func(t *testing.T) { t.Parallel() - // It tests https://github.com/hedhyw/gherkingen/issues/26. + // It tests https://github.com/hedhyw/gherkingen/v2/issues/26. doc := getExampleDocument() if assert.NoError(t, p.Process(ctx, doc)) { diff --git a/internal/docplugin/multiplugin/multiplugin.go b/internal/docplugin/multiplugin/multiplugin.go index ef8ced5..5fc6e34 100644 --- a/internal/docplugin/multiplugin/multiplugin.go +++ b/internal/docplugin/multiplugin/multiplugin.go @@ -4,8 +4,8 @@ import ( "context" "fmt" - "github.com/hedhyw/gherkingen/internal/docplugin" - "github.com/hedhyw/gherkingen/internal/model" + "github.com/hedhyw/gherkingen/v2/internal/docplugin" + "github.com/hedhyw/gherkingen/v2/internal/model" ) // MultiPlugin helps to process many plugins. diff --git a/internal/docplugin/multiplugin/multiplugin_test.go b/internal/docplugin/multiplugin/multiplugin_test.go index a743da7..b30aaef 100644 --- a/internal/docplugin/multiplugin/multiplugin_test.go +++ b/internal/docplugin/multiplugin/multiplugin_test.go @@ -4,9 +4,9 @@ import ( "context" "testing" - "github.com/hedhyw/gherkingen/internal/docplugin/goplugin" - "github.com/hedhyw/gherkingen/internal/docplugin/multiplugin" - "github.com/hedhyw/gherkingen/internal/model" + "github.com/hedhyw/gherkingen/v2/internal/docplugin/goplugin" + "github.com/hedhyw/gherkingen/v2/internal/docplugin/multiplugin" + "github.com/hedhyw/gherkingen/v2/internal/model" "github.com/hedhyw/semerr/pkg/v1/semerr" "github.com/stretchr/testify/assert" diff --git a/internal/docplugin/plugin.go b/internal/docplugin/plugin.go index 3a905ba..e16036b 100644 --- a/internal/docplugin/plugin.go +++ b/internal/docplugin/plugin.go @@ -3,7 +3,7 @@ package docplugin import ( "context" - "github.com/hedhyw/gherkingen/internal/model" + "github.com/hedhyw/gherkingen/v2/internal/model" ) // Plugin injects extra data to document. diff --git a/internal/generator/examples/background.feature_test.go b/internal/generator/examples/background.feature_test.go index 9fd5ff2..e6044d3 100644 --- a/internal/generator/examples/background.feature_test.go +++ b/internal/generator/examples/background.feature_test.go @@ -3,7 +3,7 @@ package examples_test import ( "testing" - "github.com/hedhyw/gherkingen/pkg/v1/bdd" + "github.com/hedhyw/gherkingen/v2/pkg/bdd" ) func TestMultipleSiteSupport(t *testing.T) { diff --git a/internal/generator/examples/issue_26.feature_test.go b/internal/generator/examples/issue_26.feature_test.go index 65d6c8c..20863db 100644 --- a/internal/generator/examples/issue_26.feature_test.go +++ b/internal/generator/examples/issue_26.feature_test.go @@ -3,7 +3,7 @@ package examples_test import ( "testing" - "github.com/hedhyw/gherkingen/pkg/v1/bdd" + "github.com/hedhyw/gherkingen/v2/pkg/bdd" ) func TestIssueExample(t *testing.T) { diff --git a/internal/generator/examples/readme.feature_test.go b/internal/generator/examples/readme.feature_test.go index fb74ad1..b58a611 100644 --- a/internal/generator/examples/readme.feature_test.go +++ b/internal/generator/examples/readme.feature_test.go @@ -3,7 +3,7 @@ package examples_test import ( "testing" - "github.com/hedhyw/gherkingen/pkg/v1/bdd" + "github.com/hedhyw/gherkingen/v2/pkg/bdd" ) func TestApplicationCommandLineTool(t *testing.T) { diff --git a/internal/generator/examples/rules.feature_test.go b/internal/generator/examples/rules.feature_test.go index 6d05235..dfc2fda 100644 --- a/internal/generator/examples/rules.feature_test.go +++ b/internal/generator/examples/rules.feature_test.go @@ -3,7 +3,7 @@ package examples_test import ( "testing" - "github.com/hedhyw/gherkingen/pkg/v1/bdd" + "github.com/hedhyw/gherkingen/v2/pkg/bdd" ) func TestHighlander(t *testing.T) { diff --git a/internal/generator/examples/scenario.feature_test.go b/internal/generator/examples/scenario.feature_test.go index 7422f93..2017b3d 100644 --- a/internal/generator/examples/scenario.feature_test.go +++ b/internal/generator/examples/scenario.feature_test.go @@ -3,7 +3,7 @@ package examples_test import ( "testing" - "github.com/hedhyw/gherkingen/pkg/v1/bdd" + "github.com/hedhyw/gherkingen/v2/pkg/bdd" ) func TestSomeTerseYetDescriptiveTextOfWhatIsDesired(t *testing.T) { diff --git a/internal/generator/examples/simple.feature_test.go b/internal/generator/examples/simple.feature_test.go index 214f75d..2cad239 100644 --- a/internal/generator/examples/simple.feature_test.go +++ b/internal/generator/examples/simple.feature_test.go @@ -3,7 +3,7 @@ package examples_test import ( "testing" - "github.com/hedhyw/gherkingen/pkg/v1/bdd" + "github.com/hedhyw/gherkingen/v2/pkg/bdd" ) func TestGuessTheWord(t *testing.T) { diff --git a/internal/generator/generator.go b/internal/generator/generator.go index ac34fb1..7595265 100644 --- a/internal/generator/generator.go +++ b/internal/generator/generator.go @@ -5,8 +5,8 @@ import ( "context" "fmt" - "github.com/hedhyw/gherkingen/internal/docplugin" - "github.com/hedhyw/gherkingen/internal/model" + "github.com/hedhyw/gherkingen/v2/internal/docplugin" + "github.com/hedhyw/gherkingen/v2/internal/model" "github.com/cucumber/gherkin-go/v19" "github.com/google/uuid" diff --git a/internal/generator/generator_test.go b/internal/generator/generator_test.go index c624db5..baa2152 100644 --- a/internal/generator/generator_test.go +++ b/internal/generator/generator_test.go @@ -4,8 +4,8 @@ import ( _ "embed" "testing" - "github.com/hedhyw/gherkingen/internal/generator" - "github.com/hedhyw/gherkingen/internal/model" + "github.com/hedhyw/gherkingen/v2/internal/generator" + "github.com/hedhyw/gherkingen/v2/internal/model" "github.com/stretchr/testify/assert" ) diff --git a/internal/generator/golang.go b/internal/generator/golang.go index 9782024..2ce78c2 100644 --- a/internal/generator/golang.go +++ b/internal/generator/golang.go @@ -4,7 +4,7 @@ import ( "fmt" "go/format" - "github.com/hedhyw/gherkingen/internal/model" + "github.com/hedhyw/gherkingen/v2/internal/model" ) // generateGo generates raw output and formates it with go formatter. diff --git a/internal/generator/golang_test.go b/internal/generator/golang_test.go index 0828387..db79680 100644 --- a/internal/generator/golang_test.go +++ b/internal/generator/golang_test.go @@ -5,11 +5,11 @@ import ( "io" "testing" - "github.com/hedhyw/gherkingen/internal/assets" - "github.com/hedhyw/gherkingen/internal/docplugin/goplugin" - "github.com/hedhyw/gherkingen/internal/docplugin/multiplugin" - "github.com/hedhyw/gherkingen/internal/generator" - "github.com/hedhyw/gherkingen/internal/model" + "github.com/hedhyw/gherkingen/v2/internal/assets" + "github.com/hedhyw/gherkingen/v2/internal/docplugin/goplugin" + "github.com/hedhyw/gherkingen/v2/internal/docplugin/multiplugin" + "github.com/hedhyw/gherkingen/v2/internal/generator" + "github.com/hedhyw/gherkingen/v2/internal/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/internal/generator/json.go b/internal/generator/json.go index 3481340..efae874 100644 --- a/internal/generator/json.go +++ b/internal/generator/json.go @@ -5,7 +5,7 @@ import ( "encoding/json" "fmt" - "github.com/hedhyw/gherkingen/internal/model" + "github.com/hedhyw/gherkingen/v2/internal/model" ) // generateJSON generates output in JSON. diff --git a/internal/generator/json_test.go b/internal/generator/json_test.go index 825c3b0..a545fa1 100644 --- a/internal/generator/json_test.go +++ b/internal/generator/json_test.go @@ -4,8 +4,8 @@ import ( "encoding/json" "testing" - "github.com/hedhyw/gherkingen/internal/generator" - "github.com/hedhyw/gherkingen/internal/model" + "github.com/hedhyw/gherkingen/v2/internal/generator" + "github.com/hedhyw/gherkingen/v2/internal/model" "github.com/stretchr/testify/assert" ) diff --git a/internal/generator/raw.go b/internal/generator/raw.go index a8e3727..1f77723 100644 --- a/internal/generator/raw.go +++ b/internal/generator/raw.go @@ -8,7 +8,7 @@ import ( "text/template" "unicode" - "github.com/hedhyw/gherkingen/internal/model" + "github.com/hedhyw/gherkingen/v2/internal/model" "github.com/iancoleman/strcase" ) diff --git a/internal/generator/raw_test.go b/internal/generator/raw_test.go index 9b319c7..843b953 100644 --- a/internal/generator/raw_test.go +++ b/internal/generator/raw_test.go @@ -3,8 +3,8 @@ package generator_test import ( "testing" - "github.com/hedhyw/gherkingen/internal/generator" - "github.com/hedhyw/gherkingen/internal/model" + "github.com/hedhyw/gherkingen/v2/internal/generator" + "github.com/hedhyw/gherkingen/v2/internal/model" "github.com/stretchr/testify/assert" ) diff --git a/internal/model/document_test.go b/internal/model/document_test.go index 85a442e..ff03b87 100644 --- a/internal/model/document_test.go +++ b/internal/model/document_test.go @@ -4,7 +4,7 @@ import ( "strconv" "testing" - "github.com/hedhyw/gherkingen/internal/model" + "github.com/hedhyw/gherkingen/v2/internal/model" "github.com/cucumber/messages-go/v16" "github.com/stretchr/testify/assert" diff --git a/internal/model/enums_test.go b/internal/model/enums_test.go index 0249ef9..1525b53 100644 --- a/internal/model/enums_test.go +++ b/internal/model/enums_test.go @@ -3,7 +3,7 @@ package model_test import ( "testing" - "github.com/hedhyw/gherkingen/internal/model" + "github.com/hedhyw/gherkingen/v2/internal/model" "github.com/stretchr/testify/assert" ) diff --git a/pkg/v1/bdd/bdd.go b/pkg/bdd/bdd.go similarity index 100% rename from pkg/v1/bdd/bdd.go rename to pkg/bdd/bdd.go diff --git a/pkg/v1/bdd/bdd_test.go b/pkg/bdd/bdd_test.go similarity index 97% rename from pkg/v1/bdd/bdd_test.go rename to pkg/bdd/bdd_test.go index 471e9d0..012551a 100644 --- a/pkg/v1/bdd/bdd_test.go +++ b/pkg/bdd/bdd_test.go @@ -3,7 +3,7 @@ package bdd_test import ( "testing" - "github.com/hedhyw/gherkingen/pkg/v1/bdd" + "github.com/hedhyw/gherkingen/v2/pkg/bdd" ) func TestBDDTestCases(t *testing.T) {