Skip to content

Commit

Permalink
Replaced warrensbox with EliaBracciSumo
Browse files Browse the repository at this point in the history
  • Loading branch information
Elia Bracci committed Dec 20, 2022
1 parent 2b21bd8 commit a29103a
Show file tree
Hide file tree
Showing 15 changed files with 81 additions and 78 deletions.
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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 "[email protected]"
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
Expand Down
94 changes: 47 additions & 47 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: [email protected]
# # Git author used to commit to the repository.
# # Defaults are shown.
# commit_author:
# name: Warren Veerasingam
# email: [email protected]

# 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"
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
EXE := tgswitch
PKG := github.com/warrensbox/tgswitch
VER := $(shell { git ls-remote --tags . 2>/dev/null || git ls-remote --tags [email protected]: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 [email protected]: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)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/warrensbox/tgswitch
module github.com/EliaBracciSumo/tgswitch

go 1.16

Expand Down
2 changes: 1 addition & 1 deletion lib/command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/download_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 9 additions & 9 deletions lib/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/files_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"testing"
"time"

"github.com/warrensbox/tgswitch/lib"
"github.com/EliaBracciSumo/tgswitch/lib"
)

// TestRenameFile : Create a file, check filename exist,
Expand Down Expand Up @@ -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/"
Expand Down
2 changes: 2 additions & 0 deletions lib/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
6 changes: 3 additions & 3 deletions lib/list_versions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand All @@ -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) {

Expand Down
2 changes: 1 addition & 1 deletion lib/symlink_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
2 changes: 1 addition & 1 deletion test-data/test_terragrunt-version/.terragrunt-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.36.0
0.26.7
5 changes: 3 additions & 2 deletions test-tgswitch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
runtestarg "passing argument" "0.26.7" "v0.26.7"
6 changes: 3 additions & 3 deletions www/mkdocs.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down

0 comments on commit a29103a

Please sign in to comment.