From 4ad54fe6c604d8f1140e01ba950c41af778a17a0 Mon Sep 17 00:00:00 2001 From: Aleksandar Stojanov Date: Tue, 25 Jun 2024 08:22:50 +0200 Subject: [PATCH 1/2] fix: rename config file rename configuration file to `.shema.yaml` Signed-off-by: Aleksandar Stojanov --- schema.yaml => .schema.yaml | 2 +- README.md | 4 ++-- main.go | 2 +- main_test.go | 14 +++++++------- 4 files changed, 11 insertions(+), 11 deletions(-) rename schema.yaml => .schema.yaml (94%) diff --git a/schema.yaml b/.schema.yaml similarity index 94% rename from schema.yaml rename to .schema.yaml index d17036d..b9b0f30 100644 --- a/schema.yaml +++ b/.schema.yaml @@ -1,6 +1,6 @@ # Required input: - - schema.yaml + - '.schema.yaml' draft: 2020 # @schema enum: [4, 6, 7, 2019, 2020]; default: 2020 indent: 4 # @schema default: 4 diff --git a/README.md b/README.md index 11646b7..af470cb 100644 --- a/README.md +++ b/README.md @@ -110,12 +110,12 @@ Usage: helm schema [options...] ### Configuration file -This plugin will look for it's configuration file called `schema.yaml` in the current working directory. All options available from CLI can be set in this file. Example: +This plugin will look for it's configuration file called `.schema.yaml` in the current working directory. All options available from CLI can be set in this file. Example: ```yaml # Required input: - - schema.yaml + - values.yaml draft: 2020 indent: 4 diff --git a/main.go b/main.go index d1e6e31..8c01b41 100644 --- a/main.go +++ b/main.go @@ -10,7 +10,7 @@ import ( func main() { // Load configuration from a YAML file - fileConfig, err := pkg.LoadConfig("schema.yaml") + fileConfig, err := pkg.LoadConfig(".schema.yaml") if err != nil { fmt.Println("Error loading config file:", err) } diff --git a/main_test.go b/main_test.go index ff805c7..117170a 100644 --- a/main_test.go +++ b/main_test.go @@ -47,26 +47,26 @@ func TestMain(t *testing.T) { name: "ErrorLoadingConfigFile", args: []string{"schema", "-input", "testdata/basic.yaml"}, setup: func() { - if _, err := os.Stat("schema.yaml"); err == nil { - if err := os.Rename("schema.yaml", "schema.yaml.bak"); err != nil { + if _, err := os.Stat(".schema.yaml"); err == nil { + if err := os.Rename(".schema.yaml", ".schema.yaml.bak"); err != nil { log.Fatalf("Error renaming file: %v", err) } } - file, _ := os.Create("schema.yaml") + file, _ := os.Create(".schema.yaml") defer file.Close() if _, err := file.WriteString("draft: invalid\n"); err != nil { log.Fatalf("Error writing to file: %v", err) } }, cleanup: func() { - if _, err := os.Stat("schema.yaml.bak"); err == nil { - os.Remove("schema.yaml") - if err := os.Rename("schema.yaml.bak", "schema.yaml"); err != nil { + if _, err := os.Stat(".schema.yaml.bak"); err == nil { + os.Remove(".schema.yaml") + if err := os.Rename(".schema.yaml.bak", ".schema.yaml"); err != nil { log.Fatalf("Error renaming file: %v", err) } } else { - os.Remove("schema.yaml") + os.Remove(".schema.yaml") } }, expectedOut: "", From ce383b499099aae63995038b447047a0d31019d4 Mon Sep 17 00:00:00 2001 From: Aleksandar Stojanov Date: Tue, 25 Jun 2024 08:23:47 +0200 Subject: [PATCH 2/2] bump to plugin version v1.5.1 Signed-off-by: Aleksandar Stojanov --- .pre-commit-config.yaml | 2 +- README.md | 2 +- plugin.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 19fce8f..49b2e53 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/losisin/helm-values-schema-json - rev: v1.5.0 + rev: v1.5.1 hooks: - id: helm-schema args: diff --git a/README.md b/README.md index af470cb..b7569d1 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ First [install pre-commit](https://pre-commit.com/#install) and then create or u ```yaml repos: - repo: https://github.com/losisin/helm-values-schema-json - rev: v1.5.0 + rev: v1.5.1 hooks: - id: helm-schema args: ["-input", "values.yaml"] diff --git a/plugin.yaml b/plugin.yaml index cbcdae4..684b98d 100644 --- a/plugin.yaml +++ b/plugin.yaml @@ -1,5 +1,5 @@ name: "schema" -version: "1.5.0" +version: "1.5.1" usage: "generate values.schema.json from values yaml" description: "Helm plugin for generating values.schema.json from multiple values files." ignoreFlags: false