diff --git a/Readme.md b/Readme.md index 0f315a1..b2ae07c 100644 --- a/Readme.md +++ b/Readme.md @@ -5,8 +5,25 @@ Currently we are supporting GitLab and Community Registry as a terraform modules ## Installation +### MacOS via homebrew + +```bash +brew tap netvolart/tap +brew install joven +``` +### Linux and MacOS from binary + To install Joven, you can download the latest release from the [Releases](https://github.com/yourusername/joven/releases) page. Choose the binary that matches your operating system and architecture, download it, and place it in your system's PATH. +For example: + +```sh +wget https://github.com/netvolart/joven/releases/download/v0.0.1/joven_0.0.1_linux_amd64.tar.gz +tar -xvzf joven_0.0.1_linux_amd64.tar.gz +chmod +x joven +sudo mv joven /usr/local/bin/ +``` + ## Configuration Joven uses a configuration file to store settings. diff --git a/cmd/root.go b/cmd/root.go index b07dc03..3ace418 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -11,8 +11,7 @@ import ( // rootCmd represents the base command when called without any subcommands var rootCmd = &cobra.Command{ - Use: "joven", - + Use: "joven", } // Execute adds all child commands to the root command and sets flags appropriately. diff --git a/terraform/community.go b/terraform/community.go index 064879d..bcf19b6 100644 --- a/terraform/community.go +++ b/terraform/community.go @@ -5,8 +5,6 @@ import ( "net/http" "net/url" "strings" - - "github.com/netvolart/joven/config" ) func getModuleVersionsFromRegistry(url string, localModule LocalModule) (module TerraformModule, Error error) { @@ -41,7 +39,7 @@ func getModuleVersionsFromRegistry(url string, localModule LocalModule) (module } -func CreateModuleGitlabUrl(c *config.Config, moduleName string) (string, error) { +func createModuleCommunityUrl(moduleName string) (string, error) { if moduleName == "" { return "", ErrorPageNumberEmpty } diff --git a/terraform/community_test.go b/terraform/community_test.go index 63c557d..f489c97 100644 --- a/terraform/community_test.go +++ b/terraform/community_test.go @@ -79,7 +79,7 @@ func createRegistryMockServer(t *testing.T) *httptest.Server { func TestCreateModuleCommunityUrl(t *testing.T) { t.Run("Test First page", func(t *testing.T) { config := generateMockConfig(t) - url, err := CreateModuleGitlabUrl(config, "registry.terraform.io/terraform-aws-modules/vpc/aws") + url, err := createModuleGitlabUrl(config, "registry.terraform.io/terraform-aws-modules/vpc/aws") if err != nil { t.Errorf("Unable to generate URL %s", err) } diff --git a/terraform/compare.go b/terraform/compare.go index b06c501..3a92960 100644 --- a/terraform/compare.go +++ b/terraform/compare.go @@ -32,7 +32,7 @@ func findOutdated(modules []*TerraformModule) ([]*TerraformModule, error) { func CompareGitLabModules(c *config.Config, localModulesData []byte) ([]*TerraformModule, error) { // parse local modules - localModulesResult, err := GetLocalModules(localModulesData) + localModulesResult, err := getLocalModules(localModulesData) if err != nil { return nil, err } @@ -65,7 +65,7 @@ func CompareGitLabModules(c *config.Config, localModulesData []byte) ([]*Terrafo } else if localModule.Type == "community" { - url, err := CreateModuleGitlabUrl(c, localModule.Source) + url, err := createModuleCommunityUrl(localModule.Source) if err != nil { return nil, err } @@ -73,7 +73,6 @@ func CompareGitLabModules(c *config.Config, localModulesData []byte) ([]*Terrafo if err != nil { return nil, err } - // log.Println(communityModule) resultModules = append(resultModules, &communityModule) } diff --git a/terraform/gitlab_batch.go b/terraform/gitlab_batch.go index 22bbb97..de6a395 100644 --- a/terraform/gitlab_batch.go +++ b/terraform/gitlab_batch.go @@ -98,7 +98,7 @@ func downloadModulesMetadata(c *config.Config) ([]Response, error) { return fullResponses, nil } -func GetModulesFromGitlab(c *config.Config) ([]*TerraformModule, error) { +func getModulesFromGitlab(c *config.Config) ([]*TerraformModule, error) { responses, err := downloadModulesMetadata(c) if err != nil { log.Printf("Error getting modules from GitLab: %v", err) diff --git a/terraform/local.go b/terraform/local.go index a783624..4192595 100644 --- a/terraform/local.go +++ b/terraform/local.go @@ -47,7 +47,7 @@ type LocalModules struct { Modules []LocalModule `json:"Modules"` } -func GetLocalModules(data []byte) (*LocalModules, error) { +func getLocalModules(data []byte) (*LocalModules, error) { var localModules LocalModules err := json.Unmarshal(data, &localModules) if err != nil { diff --git a/terraform/local_test.go b/terraform/local_test.go index 2b9535a..44889d1 100644 --- a/terraform/local_test.go +++ b/terraform/local_test.go @@ -34,7 +34,7 @@ func TestGetLocalModules(t *testing.T) { ] }` - localModules, err := GetLocalModules([]byte(data)) + localModules, err := getLocalModules([]byte(data)) if err != nil { t.Errorf(err.Error()) }