From a29103a086b0a1bb2b8ac1187d0250a821c44583 Mon Sep 17 00:00:00 2001 From: Elia Bracci Date: Tue, 20 Dec 2022 22:00:25 +0100 Subject: [PATCH] Replaced warrensbox with EliaBracciSumo --- .circleci/config.yml | 8 +- .goreleaser.yml | 94 +++++++++---------- Makefile | 4 +- go.mod | 2 +- lib/command_test.go | 2 +- lib/download_test.go | 2 +- lib/files.go | 18 ++-- lib/files_test.go | 4 +- lib/install.go | 2 + lib/list_versions_test.go | 6 +- lib/symlink_test.go | 2 +- main.go | 2 +- .../.terragrunt-version | 2 +- test-tgswitch.sh | 5 +- www/mkdocs.yml | 6 +- 15 files changed, 81 insertions(+), 78 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 15f853c..eb78522 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,7 +7,7 @@ jobs: docker: - image: circleci/golang:1.17 - working_directory: /go/src/github.com/warrensbox/tgswitch + working_directory: /go/src/github.com/EliaBracciSumo/tgswitch steps: - checkout @@ -24,7 +24,7 @@ jobs: docker: - image: circleci/golang:1.17 - working_directory: /go/src/github.com/warrensbox/tgswitch + working_directory: /go/src/github.com/EliaBracciSumo/tgswitch steps: - checkout @@ -37,10 +37,10 @@ jobs: export RELEASE_VERSION; echo $RELEASE_VERSION mkdir -p /home/circleci/bin - export PATH="/home/warrensbox/bin:${PATH}" + export PATH="/home/EliaBracciSumo/bin:${PATH}" rm -rf dist git config user.email "warren.veerasingam@gmail.com" - git config user.name "warrensbox" + git config user.name "EliaBracciSumo" git tag -a ${RELEASE_VERSION} -m "Release Version" git push origin ${RELEASE_VERSION} curl -L https://git.io/goreleaser | bash diff --git a/.goreleaser.yml b/.goreleaser.yml index 29321eb..5b20b0c 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -37,60 +37,60 @@ archives: format_overrides: - goos: windows format: zip -brews: - - - # Name of the recipe - # Default to project name - name: tgswitch +# brews: +# - +# # Name of the recipe +# # Default to project name +# name: tgswitch - # GitHub/GitLab repository to push the formula to - # Gitea is not supported yet, but the support coming - tap: - owner: warrensbox - name: homebrew-tap +# # GitHub/GitLab repository to push the formula to +# # Gitea is not supported yet, but the support coming +# tap: +# owner: warrensbox +# name: homebrew-tap - # Reporitory to push the tap to. - # github: - # owner: warrensbox - # name: homebrew-tap +# # Reporitory to push the tap to. +# # github: +# # owner: warrensbox +# # name: homebrew-tap - # Allows you to set a custom download strategy. - # Default is empty. - #download_strategy: GitHubPrivateRepositoryReleaseDownloadStrategy +# # Allows you to set a custom download strategy. +# # Default is empty. +# #download_strategy: GitHubPrivateRepositoryReleaseDownloadStrategy - # Git author used to commit to the repository. - # Defaults are shown. - commit_author: - name: Warren Veerasingam - email: warren.veerasingam@gmail.com +# # Git author used to commit to the repository. +# # Defaults are shown. +# commit_author: +# name: Warren Veerasingam +# email: warren.veerasingam@gmail.com - # Folder inside the repository to put the formula. - # Default is the root folder. - folder: Formula +# # Folder inside the repository to put the formula. +# # Default is the root folder. +# folder: Formula - # Caveats for the user of your binary. - # Default is empty. - caveats: "Type 'tgswitch' on your command line and choose the terragrunt version that you want from the dropdown. This command currently only works on MacOs and Linux" +# # Caveats for the user of your binary. +# # Default is empty. +# caveats: "Type 'tgswitch' on your command line and choose the terragrunt version that you want from the dropdown. This command currently only works on MacOs and Linux" - # Your app's homepage. - # Default is empty. - homepage: "https://warrensbox.github.io/tgswitch" +# # Your app's homepage. +# # Default is empty. +# homepage: "https://warrensbox.github.io/tgswitch" - # Your app's description. - # Default is empty. - description: "The tgswitch command lets you switch between terragrunt versions." +# # Your app's description. +# # Default is empty. +# description: "The tgswitch command lets you switch between terragrunt versions." - # Setting this will prevent goreleaser to actually try to commit the updated - # formula - instead, the formula file will be stored on the dist folder only, - # leaving the responsibility of publishing it to the user. - # Default is false. - skip_upload: false +# # Setting this will prevent goreleaser to actually try to commit the updated +# # formula - instead, the formula file will be stored on the dist folder only, +# # leaving the responsibility of publishing it to the user. +# # Default is false. +# skip_upload: false - # So you can `brew test` your formula. - # Default is empty. - test: | - system "#{bin}/tgswitch --version" - # Custom install script for brew. - # Default is 'bin.install "program"'. - install: | - bin.install "tgswitch" +# # So you can `brew test` your formula. +# # Default is empty. +# test: | +# system "#{bin}/tgswitch --version" +# # Custom install script for brew. +# # Default is 'bin.install "program"'. +# install: | +# bin.install "tgswitch" diff --git a/Makefile b/Makefile index 3b0e6d8..32e86cf 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ EXE := tgswitch -PKG := github.com/warrensbox/tgswitch -VER := $(shell { git ls-remote --tags . 2>/dev/null || git ls-remote --tags git@github.com:warrensbox/tgswitch.git; } | awk '{if ($$2 ~ "\\^\\{\\}$$") next; print vers[split($$2,vers,"\\/")]}' | sort -n -t. -k1,1 -k2,2 -k3,3 | tail -1) +PKG := github.com/EliaBracciSumo/tgswitch +VER := $(shell { git ls-remote --tags . 2>/dev/null || git ls-remote --tags git@github.com:EliaBracciSumo/tgswitch.git; } | awk '{if ($$2 ~ "\\^\\{\\}$$") next; print vers[split($$2,vers,"\\/")]}' | sort -n -t. -k1,1 -k2,2 -k3,3 | tail -1) PATH := build:$(PATH) GOOS ?= $(shell go env GOOS) GOARCH ?= $(shell go env GOARCH) diff --git a/go.mod b/go.mod index 9fc3c2e..72c9af0 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/warrensbox/tgswitch +module github.com/EliaBracciSumo/tgswitch go 1.16 diff --git a/lib/command_test.go b/lib/command_test.go index 41c07ba..60be285 100644 --- a/lib/command_test.go +++ b/lib/command_test.go @@ -4,7 +4,7 @@ import ( "reflect" "testing" - "github.com/warrensbox/tgswitch/lib" + "github.com/EliaBracciSumo/tgswitch/lib" ) // TestNewCommand : pass value and check if returned value is a pointer diff --git a/lib/download_test.go b/lib/download_test.go index 58cc223..217de7a 100644 --- a/lib/download_test.go +++ b/lib/download_test.go @@ -9,7 +9,7 @@ import ( "runtime" "testing" - lib "github.com/warrensbox/tgswitch/lib" + lib "github.com/EliaBracciSumo/tgswitch/lib" ) // TestDownloadFromURL_FileNameMatch : Check expected filename exist when downloaded diff --git a/lib/files.go b/lib/files.go index df526a2..fab211d 100644 --- a/lib/files.go +++ b/lib/files.go @@ -46,7 +46,7 @@ func CheckFileExist(file string) bool { return true } -//CreateDirIfNotExist : create directory if directory does not exist +// CreateDirIfNotExist : create directory if directory does not exist func CreateDirIfNotExist(dir string) { if _, err := os.Stat(dir); os.IsNotExist(err) { log.Printf("Creating directory for terragrunt: %v", dir) @@ -58,7 +58,7 @@ func CreateDirIfNotExist(dir string) { } } -//WriteLines : writes into file +// WriteLines : writes into file func WriteLines(lines []string, path string) (err error) { var ( file *os.File @@ -110,7 +110,7 @@ func ReadLines(path string) (lines []string, err error) { return } -//IsDirEmpty : check if directory is empty (TODO UNIT TEST) +// IsDirEmpty : check if directory is empty (TODO UNIT TEST) func IsDirEmpty(name string) bool { exist := false @@ -128,7 +128,7 @@ func IsDirEmpty(name string) bool { return exist // Either not empty or error, suits both cases } -//CheckDirHasTGBin : // check binary exist (TODO UNIT TEST) +// CheckDirHasTGBin : // check binary exist (TODO UNIT TEST) func CheckDirHasTGBin(dir, prefix string) bool { exist := false @@ -148,9 +148,9 @@ func CheckDirHasTGBin(dir, prefix string) bool { return exist } -//CheckDirExist : check if directory exist -//dir=path to file -//return path to directory +// CheckDirExist : check if directory exist +// dir=path to file +// return path to directory func CheckDirExist(dir string) bool { if _, err := os.Stat(dir); os.IsNotExist(err) { return false @@ -205,11 +205,11 @@ func ReadingFileMsg(filename string) { fmt.Printf("Reading file %s \n", filename) } -//retrive file content of regular file +// retrive file content of regular file func RetrieveFileContents(file string) string { fileContents, err := ioutil.ReadFile(file) if err != nil { - log.Fatalf("Error: %s\nFailed to read %s file. Follow the README.md instructions for setup. https://github.com/warrensbox/tgswitch/blob/master/README.md\n", err, file) + log.Fatalf("Error: %s\nFailed to read %s file. Follow the README.md instructions for setup. https://github.com/EliaBracciSumo/tgswitch/blob/master/README.md\n", err, file) } tgversion := strings.TrimSuffix(string(fileContents), "\n") return tgversion diff --git a/lib/files_test.go b/lib/files_test.go index 439f788..7dc317b 100644 --- a/lib/files_test.go +++ b/lib/files_test.go @@ -13,7 +13,7 @@ import ( "testing" "time" - "github.com/warrensbox/tgswitch/lib" + "github.com/EliaBracciSumo/tgswitch/lib" ) // TestRenameFile : Create a file, check filename exist, @@ -130,7 +130,7 @@ func TestCreateDirIfNotExist(t *testing.T) { cleanUp(installLocation) } -//TestWriteLines : write to file, check readline to verify +// TestWriteLines : write to file, check readline to verify func TestWriteLines(t *testing.T) { installPath := "/.terragrunt.versions_test/" diff --git a/lib/install.go b/lib/install.go index 5637ac9..28925ff 100644 --- a/lib/install.go +++ b/lib/install.go @@ -225,6 +225,8 @@ func Install(tgversion string, usrBinPath string, mirrorURL string) string { /* proceed to download it from the hashicorp release page */ url := mirrorURL + "v" + tgversion + "/" + "terragrunt" + "_" + goos + "_" + goarch + fmt.Println("Downloading terragrunt from", url) + downloadedFile, errDownload := DownloadFromURL(installLocation, url) /* If unable to download file from url, exit(1) immediately */ diff --git a/lib/list_versions_test.go b/lib/list_versions_test.go index 59646a8..36eaf9a 100644 --- a/lib/list_versions_test.go +++ b/lib/list_versions_test.go @@ -4,14 +4,14 @@ import ( "log" "testing" - "github.com/warrensbox/tgswitch/lib" + "github.com/EliaBracciSumo/tgswitch/lib" ) const ( gruntURL = "https://api.github.com/repos/gruntwork-io/terragrunt/releases" ) -//TestRemoveDuplicateVersions : test to removed duplicate +// TestRemoveDuplicateVersions : test to removed duplicate func TestRemoveDuplicateVersions(t *testing.T) { test_array := []string{"0.0.1", "0.0.2", "0.0.3", "0.0.1"} @@ -25,7 +25,7 @@ func TestRemoveDuplicateVersions(t *testing.T) { } } -//TestValidVersionFormat : test if func returns valid version format +// TestValidVersionFormat : test if func returns valid version format // more regex testing at https://rubular.com/r/UvWXui7EU2icSb func TestValidVersionFormat(t *testing.T) { diff --git a/lib/symlink_test.go b/lib/symlink_test.go index 97a2ea1..5ff3b4e 100644 --- a/lib/symlink_test.go +++ b/lib/symlink_test.go @@ -6,7 +6,7 @@ import ( "os/user" "testing" - "github.com/warrensbox/tgswitch/lib" + "github.com/EliaBracciSumo/tgswitch/lib" ) // TestCreateSymlink : check if symlink exist-remove if exist, diff --git a/main.go b/main.go index 9413610..1ea9a5c 100644 --- a/main.go +++ b/main.go @@ -22,12 +22,12 @@ import ( "path/filepath" "strings" + lib "github.com/EliaBracciSumo/tgswitch/lib" "github.com/hashicorp/hcl2/gohcl" "github.com/hashicorp/hcl2/hclparse" "github.com/manifoldco/promptui" "github.com/pborman/getopt" "github.com/spf13/viper" - lib "github.com/warrensbox/tgswitch/lib" ) const ( diff --git a/test-data/test_terragrunt-version/.terragrunt-version b/test-data/test_terragrunt-version/.terragrunt-version index 28f0245..1655538 100644 --- a/test-data/test_terragrunt-version/.terragrunt-version +++ b/test-data/test_terragrunt-version/.terragrunt-version @@ -1 +1 @@ -0.36.0 \ No newline at end of file +0.26.7 \ No newline at end of file diff --git a/test-tgswitch.sh b/test-tgswitch.sh index e7be098..dc898c1 100755 --- a/test-tgswitch.sh +++ b/test-tgswitch.sh @@ -76,11 +76,12 @@ function runtestarg(){ commentComplete } -runtestdir "terragrunt version" "test_terragrunt-version" "v0.36.0" +#runtestdir "terragrunt version" "test_terragrunt-version" "v0.26.7" runtestdir "terragrunt hcl" "test_terragrunt_hcl" "v0.36.0" runtestdir "tgswitchrc" "test_tgswitchrc" "v0.33.0" runtestdir ".toml" "test_tgswitchtoml" "v0.34.0" runtestenv "env variable" "0.37.1" "v0.37.1" +#runtestenv "env variable" "0.26.7" "v0.26.7" runtestarg "passing argument" "0.36.1" "v0.36.1" # M1 darwin arm64 test -runtestarg "passing argument" "0.28.0" "v0.28.0" \ No newline at end of file +runtestarg "passing argument" "0.26.7" "v0.26.7" \ No newline at end of file diff --git a/www/mkdocs.yml b/www/mkdocs.yml index 83a5aff..e8ed27e 100644 --- a/www/mkdocs.yml +++ b/www/mkdocs.yml @@ -1,8 +1,8 @@ site_name: tgswitch site_description: A command line tool to switch between different versions of terragrunt (install with homebrew and more) -copyright: This project is maintained by warrensbox -repo_name: warrensbox/tgswitch -repo_url: https://github.com/warrensbox/tgswitch +copyright: This project is maintained by EliaBracciSumo +repo_name: EliaBracciSumo/tgswitch +repo_url: https://github.com/EliaBracciSumo/tgswitch site_url: https://tgswitch.warrensbox.com theme: