feat(rename): Rename in gouik

This commit is contained in:
Matthieu 'JP' DERASSE 2022-07-19 20:24:10 +00:00
parent 5b50b5409b
commit 94975d5f33
Signed by: mderasse
GPG Key ID: 55141C777B16A705
8 changed files with 23 additions and 37 deletions

View File

@ -1,4 +1,4 @@
# Goguik (name TBD) # Gouik (name TBD)
Only tested on Linux Only tested on Linux

View File

@ -55,45 +55,31 @@ func runInitAction(cmd *cobra.Command, args []string) {
log.Debugf("Working in directory: %s", currentPath) log.Debugf("Working in directory: %s", currentPath)
// Check if we are in goguik directory // Check if we are in gouik directory
log.Debug("Checking if we are in the same directory as Goguik") log.Debug("Checking if we are in the same directory as Gouik")
isGoguikDir, err := helpers.IsGoguikDirectory(currentPath) isGouikDir, err := helpers.IsGouikDirectory(currentPath)
if err != nil { if err != nil {
log.Errorf("Fail to check if we are in goguik directory. The following error happen: %s", err.Error()) log.Errorf("Fail to check if we are in gouik directory. The following error happen: %s", err.Error())
return return
} }
if isGoguikDir { if isGouikDir {
log.Error("You cannot initialize a new project in the same dir than goguik\nGoguik should be added to your path") log.Error("You cannot initialize a new project in the same dir than gouik\nGouik should be added to your path")
return return
} }
// Check if we are in a go project // Check if we are in a gouik project
log.Debug("Checking if we are in a golang project") log.Debug("Checking if we are in a gouik project")
isGoProject, err := helpers.IsGoProject(currentPath) isGouikProject, err := helpers.IsGouikProject(currentPath)
if err != nil { if err != nil {
log.Errorf("Fail to check if we are in a go project. The following error happen: %s", err.Error()) log.Errorf("Fail to check if we are in a gouik project. The following error happen: %s", err.Error())
return return
} }
if isGoProject { if isGouikProject {
log.Error("You cannot initialize a new project in an already golang project") log.Error("You cannot initialize a new project in an already gouik project")
return
}
// Check if we are in a goguik project
log.Debug("Checking if we are in a goguik project")
isGoguikProject, err := helpers.IsGoguikProject(currentPath)
if err != nil {
log.Errorf("Fail to check if we are in a goguik project. The following error happen: %s", err.Error())
return
}
if isGoguikProject {
log.Error("You cannot initialize a new project in an already goguik project")
return return
} }
@ -102,7 +88,7 @@ func runInitAction(cmd *cobra.Command, args []string) {
// Create directory // Create directory
// Move to dir // Move to dir
// git init // git init
// create .goguik // create .gouik
// move templated file // move templated file
// if isGoProject, err := helpers.IsGoProject(); err != nil { // if isGoProject, err := helpers.IsGoProject(); err != nil {

View File

@ -50,7 +50,7 @@ func runUpgradeAction(cmd *cobra.Command, args []string) {
log.Infof("Your %s is not supported.", dependency.GetName()) log.Infof("Your %s is not supported.", dependency.GetName())
if !dependency.CanBeInstalled() { if !dependency.CanBeInstalled() {
log.Warnf("%s cannot be installed by Goguik. Please install it by yourself !", dependency.GetName()) log.Warnf("%s cannot be installed by Gouik. Please install it by yourself !", dependency.GetName())
continue continue
} }

View File

@ -13,7 +13,7 @@ import (
// versionCmd represents the version command // versionCmd represents the version command
var versionCmd = &cobra.Command{ var versionCmd = &cobra.Command{
Use: "version", Use: "version",
Short: "Show goguik version", Short: "Show gouik version",
Run: runVersion, Run: runVersion,
} }

View File

@ -1,3 +1,3 @@
package helpers package helpers
const configFile = ".goguik.yaml" const configFile = ".gouik.yaml"

View File

@ -208,7 +208,7 @@ You will have to reopen a new terminal to apply the changes or execute the follo
func (g Golang) PostInstall(path string) error { func (g Golang) PostInstall(path string) error {
lineBashRc := []string{ lineBashRc := []string{
"# Golang - Added by goguik", "# Golang - Added by gouik",
} }
gopath := os.Getenv("GOPATH") gopath := os.Getenv("GOPATH")

View File

@ -204,7 +204,7 @@ You will have to reopen a new terminal to apply the changes or execute the follo
func (s Swagger) PostInstall(path string) error { func (s Swagger) PostInstall(path string) error {
lineBashRc := []string{ lineBashRc := []string{
"# Swagger - Added by goguik", "# Swagger - Added by gouik",
} }
// checking if swagger binary is found after installation // checking if swagger binary is found after installation

View File

@ -11,23 +11,23 @@ import (
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
) )
func IsGoguikDirectory(path string) (bool, error) { func IsGouikDirectory(path string) (bool, error) {
binPath, err := os.Executable() binPath, err := os.Executable()
if err != nil { if err != nil {
return false, errors.Trace(err) return false, errors.Trace(err)
} }
goguikPath := filepath.Dir(binPath) gouikPath := filepath.Dir(binPath)
if goguikPath != path { if gouikPath != path {
return false, nil return false, nil
} }
return true, nil return true, nil
} }
func IsGoguikProject(path string) (bool, error) { func IsGouikProject(path string) (bool, error) {
exist, err := fileExists(filepath.Join(path, configFile)) exist, err := fileExists(filepath.Join(path, configFile))
if err != nil { if err != nil {