From bd3404a593d9e891a2c70aadf25add80e7a71ae5 Mon Sep 17 00:00:00 2001 From: Andrew Rynhard Date: Sat, 22 Jul 2017 21:40:37 -0700 Subject: [PATCH] refactor(*): rename conform directory to pkg (#30) --- .conform.yaml | 4 ++-- .dockerignore | 2 +- cmd/enforce.go | 2 +- cmd/version.go | 2 +- {conform => pkg}/conform.go | 14 +++++++------- {conform => pkg}/git/git.go | 0 {conform => pkg}/metadata/metadata.go | 4 ++-- {conform => pkg}/pipeline/pipeline.go | 6 +++--- .../conventionalcommit/conventionalcommit.go | 8 ++++---- .../conventionalcommit/conventionalcommit_test.go | 6 +++--- {conform => pkg}/policy/policy.go | 6 +++--- {conform => pkg}/policy/version/version.go | 0 {conform => pkg}/renderer/renderer.go | 2 +- {conform => pkg}/script/script.go | 4 ++-- {conform => pkg}/stage/stage.go | 0 {conform => pkg}/task/task.go | 4 ++-- {conform => pkg}/utilities/utilities.go | 0 {conform => pkg}/version/version.go | 0 18 files changed, 32 insertions(+), 32 deletions(-) rename {conform => pkg}/conform.go (86%) rename {conform => pkg}/git/git.go (100%) rename {conform => pkg}/metadata/metadata.go (97%) rename {conform => pkg}/pipeline/pipeline.go (94%) rename {conform => pkg}/policy/conventionalcommit/conventionalcommit.go (94%) rename {conform => pkg}/policy/conventionalcommit/conventionalcommit_test.go (94%) rename {conform => pkg}/policy/policy.go (82%) rename {conform => pkg}/policy/version/version.go (100%) rename {conform => pkg}/renderer/renderer.go (90%) rename {conform => pkg}/script/script.go (90%) rename {conform => pkg}/stage/stage.go (100%) rename {conform => pkg}/task/task.go (80%) rename {conform => pkg}/utilities/utilities.go (100%) rename {conform => pkg}/version/version.go (100%) diff --git a/.conform.yaml b/.conform.yaml index 0b9e5ce3..e202527d 100644 --- a/.conform.yaml +++ b/.conform.yaml @@ -91,9 +91,9 @@ tasks: WORKDIR $GOPATH/src/github.com/{{ .Repository }} COPY ./ ./ {{ if and .Git.IsClean .Git.IsTag }} - RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o /conform -ldflags "-X \"github.com/{{ .Repository }}/conform/version.Tag={{ trimAll "v" .Git.Tag }}\" -X \"github.com/{{ .Repository }}/conform/version.SHA={{ .Git.SHA }}\" -X \"github.com/{{ .Repository }}/conform/version.Built={{ .Built }}\"" + RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o /conform -ldflags "-X \"github.com/{{ .Repository }}/pkg/version.Tag={{ trimAll "v" .Git.Tag }}\" -X \"github.com/{{ .Repository }}/pkg/version.SHA={{ .Git.SHA }}\" -X \"github.com/{{ .Repository }}/pkg/version.Built={{ .Built }}\"" {{ else if .Git.IsClean }} - RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o /conform -ldflags "-X \"github.com/{{ .Repository }}/conform/version.SHA={{ .Git.SHA }}\" -X \"github.com/{{ .Repository }}/conform/version.Built={{ .Built }}\"" + RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o /conform -ldflags "-X \"github.com/{{ .Repository }}/pkg/version.SHA={{ .Git.SHA }}\" -X \"github.com/{{ .Repository }}/pkg/version.Built={{ .Built }}\"" {{ else }} RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o /conform {{ end }} diff --git a/.dockerignore b/.dockerignore index 70c731e9..bc888e23 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,7 +1,7 @@ * !cmd -!conform !Gopkg* !main.go +!pkg !scripts !vendor diff --git a/cmd/enforce.go b/cmd/enforce.go index a5f8c08b..3540f158 100644 --- a/cmd/enforce.go +++ b/cmd/enforce.go @@ -18,7 +18,7 @@ import ( "fmt" "github.com/Masterminds/semver" - "github.com/autonomy/conform/conform" + conform "github.com/autonomy/conform/pkg" "github.com/docker/docker/client" "github.com/spf13/cobra" ) diff --git a/cmd/version.go b/cmd/version.go index dde078c8..1097311b 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -14,7 +14,7 @@ package cmd import ( - "github.com/autonomy/conform/conform/version" + "github.com/autonomy/conform/pkg/version" "github.com/spf13/cobra" ) diff --git a/conform/conform.go b/pkg/conform.go similarity index 86% rename from conform/conform.go rename to pkg/conform.go index 971a5823..ac862522 100644 --- a/conform/conform.go +++ b/pkg/conform.go @@ -5,13 +5,13 @@ import ( "io/ioutil" "os" - "github.com/autonomy/conform/conform/metadata" - "github.com/autonomy/conform/conform/pipeline" - "github.com/autonomy/conform/conform/policy" - "github.com/autonomy/conform/conform/policy/conventionalcommit" - "github.com/autonomy/conform/conform/script" - "github.com/autonomy/conform/conform/stage" - "github.com/autonomy/conform/conform/task" + "github.com/autonomy/conform/pkg/metadata" + "github.com/autonomy/conform/pkg/pipeline" + "github.com/autonomy/conform/pkg/policy" + "github.com/autonomy/conform/pkg/policy/conventionalcommit" + "github.com/autonomy/conform/pkg/script" + "github.com/autonomy/conform/pkg/stage" + "github.com/autonomy/conform/pkg/task" "github.com/mitchellh/mapstructure" yaml "gopkg.in/yaml.v2" diff --git a/conform/git/git.go b/pkg/git/git.go similarity index 100% rename from conform/git/git.go rename to pkg/git/git.go diff --git a/conform/metadata/metadata.go b/pkg/metadata/metadata.go similarity index 97% rename from conform/metadata/metadata.go rename to pkg/metadata/metadata.go index 3bc1b2e7..83580fff 100644 --- a/conform/metadata/metadata.go +++ b/pkg/metadata/metadata.go @@ -4,8 +4,8 @@ import ( "time" "github.com/Masterminds/semver" - "github.com/autonomy/conform/conform/git" - "github.com/autonomy/conform/conform/utilities" + "github.com/autonomy/conform/pkg/git" + "github.com/autonomy/conform/pkg/utilities" ) // Metadata contains metadata. diff --git a/conform/pipeline/pipeline.go b/pkg/pipeline/pipeline.go similarity index 94% rename from conform/pipeline/pipeline.go rename to pkg/pipeline/pipeline.go index 73a8df49..56ad416f 100644 --- a/conform/pipeline/pipeline.go +++ b/pkg/pipeline/pipeline.go @@ -7,9 +7,9 @@ import ( "path" "strings" - "github.com/autonomy/conform/conform/metadata" - "github.com/autonomy/conform/conform/stage" - "github.com/autonomy/conform/conform/task" + "github.com/autonomy/conform/pkg/metadata" + "github.com/autonomy/conform/pkg/stage" + "github.com/autonomy/conform/pkg/task" ) // Pipeline defines the stages and artifacts. diff --git a/conform/policy/conventionalcommit/conventionalcommit.go b/pkg/policy/conventionalcommit/conventionalcommit.go similarity index 94% rename from conform/policy/conventionalcommit/conventionalcommit.go rename to pkg/policy/conventionalcommit/conventionalcommit.go index 718e340b..314debbc 100644 --- a/conform/policy/conventionalcommit/conventionalcommit.go +++ b/pkg/policy/conventionalcommit/conventionalcommit.go @@ -5,10 +5,10 @@ import ( "regexp" "strings" - "github.com/autonomy/conform/conform/metadata" - "github.com/autonomy/conform/conform/pipeline" - "github.com/autonomy/conform/conform/policy" - "github.com/autonomy/conform/conform/task" + "github.com/autonomy/conform/pkg/metadata" + "github.com/autonomy/conform/pkg/pipeline" + "github.com/autonomy/conform/pkg/policy" + "github.com/autonomy/conform/pkg/task" ) // Conventional implements the policy.Policy interface and enforces commit diff --git a/conform/policy/conventionalcommit/conventionalcommit_test.go b/pkg/policy/conventionalcommit/conventionalcommit_test.go similarity index 94% rename from conform/policy/conventionalcommit/conventionalcommit_test.go rename to pkg/policy/conventionalcommit/conventionalcommit_test.go index f43702aa..8c0b8a5a 100644 --- a/conform/policy/conventionalcommit/conventionalcommit_test.go +++ b/pkg/policy/conventionalcommit/conventionalcommit_test.go @@ -7,9 +7,9 @@ import ( "os/exec" "testing" - "github.com/autonomy/conform/conform/git" - "github.com/autonomy/conform/conform/metadata" - "github.com/autonomy/conform/conform/policy" + "github.com/autonomy/conform/pkg/git" + "github.com/autonomy/conform/pkg/metadata" + "github.com/autonomy/conform/pkg/policy" ) func RemoveAll(dir string) { diff --git a/conform/policy/policy.go b/pkg/policy/policy.go similarity index 82% rename from conform/policy/policy.go rename to pkg/policy/policy.go index d3089b28..df6d5007 100644 --- a/conform/policy/policy.go +++ b/pkg/policy/policy.go @@ -1,9 +1,9 @@ package policy import ( - "github.com/autonomy/conform/conform/metadata" - "github.com/autonomy/conform/conform/pipeline" - "github.com/autonomy/conform/conform/task" + "github.com/autonomy/conform/pkg/metadata" + "github.com/autonomy/conform/pkg/pipeline" + "github.com/autonomy/conform/pkg/task" ) // Option is a functional option used to pass in arguments to a Policy. diff --git a/conform/policy/version/version.go b/pkg/policy/version/version.go similarity index 100% rename from conform/policy/version/version.go rename to pkg/policy/version/version.go diff --git a/conform/renderer/renderer.go b/pkg/renderer/renderer.go similarity index 90% rename from conform/renderer/renderer.go rename to pkg/renderer/renderer.go index 4302221d..5c6efd7e 100644 --- a/conform/renderer/renderer.go +++ b/pkg/renderer/renderer.go @@ -5,7 +5,7 @@ import ( "text/template" "github.com/Masterminds/sprig" - "github.com/autonomy/conform/conform/metadata" + "github.com/autonomy/conform/pkg/metadata" ) // Renderer renders all pipeline templates. diff --git a/conform/script/script.go b/pkg/script/script.go similarity index 90% rename from conform/script/script.go rename to pkg/script/script.go index 68201e24..c1ef0b5e 100644 --- a/conform/script/script.go +++ b/pkg/script/script.go @@ -5,8 +5,8 @@ import ( "os" "os/exec" - "github.com/autonomy/conform/conform/metadata" - "github.com/autonomy/conform/conform/renderer" + "github.com/autonomy/conform/pkg/metadata" + "github.com/autonomy/conform/pkg/renderer" ) // Script defines a template that can be executed. diff --git a/conform/stage/stage.go b/pkg/stage/stage.go similarity index 100% rename from conform/stage/stage.go rename to pkg/stage/stage.go diff --git a/conform/task/task.go b/pkg/task/task.go similarity index 80% rename from conform/task/task.go rename to pkg/task/task.go index 87800ae0..d20068c3 100644 --- a/conform/task/task.go +++ b/pkg/task/task.go @@ -1,8 +1,8 @@ package task import ( - "github.com/autonomy/conform/conform/metadata" - "github.com/autonomy/conform/conform/renderer" + "github.com/autonomy/conform/pkg/metadata" + "github.com/autonomy/conform/pkg/renderer" ) // Task defines a stage that can be used within a pipeline. diff --git a/conform/utilities/utilities.go b/pkg/utilities/utilities.go similarity index 100% rename from conform/utilities/utilities.go rename to pkg/utilities/utilities.go diff --git a/conform/version/version.go b/pkg/version/version.go similarity index 100% rename from conform/version/version.go rename to pkg/version/version.go