From fc4700d9ce35eaf7c77aca29b1b12fbbd0732ce3 Mon Sep 17 00:00:00 2001 From: Brian Newton Date: Mon, 5 Nov 2018 15:52:39 -0500 Subject: [PATCH] PLIN-1851: renaming it to balsa --- .gitignore | 2 +- Makefile | 14 ++++++++++++++ README.md | 8 ++++---- cmd/root.go | 6 +++--- main.go | 2 +- pkg/condparse_test.go | 2 +- pkg/parse.go | 2 +- pkg/parse_test.go | 2 +- pkg/remove.go | 2 +- pkg/remove_test.go | 2 +- pkg/serialize.go | 2 +- pkg/serialize_test.go | 2 +- pkg/stack.go | 2 +- pkg/tree.go | 2 +- 14 files changed, 32 insertions(+), 18 deletions(-) create mode 100644 Makefile diff --git a/.gitignore b/.gitignore index 8fa2521..fe82592 100644 --- a/.gitignore +++ b/.gitignore @@ -13,7 +13,7 @@ redis coverage.out # Build artifacts -condparse +balsa # build/test files env.sh diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0a917cd --- /dev/null +++ b/Makefile @@ -0,0 +1,14 @@ +REPO=balsa + +.PHONY: clean + +all: build + +test: + @go test -cover ./... + +build: + @go build + +clean: + rm ./$(REPO) diff --git a/README.md b/README.md index f877509..065a0d7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# condparse +# balsa This is mostly intended to be used as a library for parsing, manipulating, and serializing a condition logic string. @@ -12,12 +12,12 @@ To parse an existing condition logic string, call `Parse(string) error` ```go import { - "github.com/skuid/condparse/condparse" + "github.com/skuid/balsa/parse" } logic := "1 OR 2 AND (3 OR 4)" -tree, err := condparse.Parse(logic) +tree, err := parse.Parse(logic) if err != nil { fmt.Print("Error: %v", err) @@ -49,7 +49,7 @@ This can be called multiple times to remove leafs from the tree by value. It wil ```go logic := "1 OR (5 AND (1 OR 1)) AND (1 AND 2 OR (56 AND 1)) OR 4" -tree, _ := condparse.Parse(logic) +tree, _ := parse.Parse(logic) n := tree.Remove(1) n = tree.Remove(8) diff --git a/cmd/root.go b/cmd/root.go index d97092f..e5a86fb 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -3,7 +3,7 @@ package cmd import ( "os" - "github.com/skuid/condparse/pkg/version" + "github.com/skuid/balsa/pkg/version" "github.com/spf13/cobra" "github.com/spf13/viper" "go.uber.org/zap" @@ -13,7 +13,7 @@ var sugar = zap.L().Sugar() // RootCmd represents the base command when called without any subcommands var RootCmd = &cobra.Command{ - Use: "CondParse", + Use: "Balsa", Short: "A utility and set of functions to parse condition logic", Version: version.Name, } @@ -39,6 +39,6 @@ func initConfig() { os.Exit(1) } - viper.SetEnvPrefix("condparse") + viper.SetEnvPrefix("balsa") viper.AutomaticEnv() } diff --git a/main.go b/main.go index f4606de..3f8b5bb 100644 --- a/main.go +++ b/main.go @@ -5,7 +5,7 @@ import ( "go.uber.org/zap" - "github.com/skuid/condparse/cmd" + "github.com/skuid/balsa/cmd" ) func main() { diff --git a/pkg/condparse_test.go b/pkg/condparse_test.go index ad85499..42136eb 100644 --- a/pkg/condparse_test.go +++ b/pkg/condparse_test.go @@ -1,4 +1,4 @@ -package condparse +package parse import ( "fmt" diff --git a/pkg/parse.go b/pkg/parse.go index 7b77ab0..b5f52a0 100644 --- a/pkg/parse.go +++ b/pkg/parse.go @@ -1,4 +1,4 @@ -package condparse +package parse import ( "bytes" diff --git a/pkg/parse_test.go b/pkg/parse_test.go index 2291d97..20ef8ca 100644 --- a/pkg/parse_test.go +++ b/pkg/parse_test.go @@ -1,4 +1,4 @@ -package condparse +package parse import ( "testing" diff --git a/pkg/remove.go b/pkg/remove.go index 0f4d48d..eeaa15c 100644 --- a/pkg/remove.go +++ b/pkg/remove.go @@ -1,4 +1,4 @@ -package condparse +package parse // Remove a node by value // n.Remove(1) diff --git a/pkg/remove_test.go b/pkg/remove_test.go index f060ab9..d2fde3d 100644 --- a/pkg/remove_test.go +++ b/pkg/remove_test.go @@ -1,4 +1,4 @@ -package condparse +package parse import ( "strings" diff --git a/pkg/serialize.go b/pkg/serialize.go index 292219a..4a1f456 100644 --- a/pkg/serialize.go +++ b/pkg/serialize.go @@ -1,4 +1,4 @@ -package condparse +package parse import ( "fmt" diff --git a/pkg/serialize_test.go b/pkg/serialize_test.go index 07c70a3..ffe420a 100644 --- a/pkg/serialize_test.go +++ b/pkg/serialize_test.go @@ -1,4 +1,4 @@ -package condparse +package parse import ( "strings" diff --git a/pkg/stack.go b/pkg/stack.go index 3d33a3b..b87b598 100644 --- a/pkg/stack.go +++ b/pkg/stack.go @@ -1,4 +1,4 @@ -package condparse +package parse func pop(slice []Node) (Node, []Node) { return slice[len(slice)-1], slice[:len(slice)-1] diff --git a/pkg/tree.go b/pkg/tree.go index cad0043..58def7a 100644 --- a/pkg/tree.go +++ b/pkg/tree.go @@ -1,4 +1,4 @@ -package condparse +package parse import ( "fmt"