From 962f9350cadec3a6a7fe9abe9e4bb650c0b46a05 Mon Sep 17 00:00:00 2001 From: Hemanth Krishna Date: Wed, 15 Jun 2022 07:55:10 +0530 Subject: [PATCH] refactor: project name; pigil --- .gitignore | 1 + go.mod | 2 +- handlers.go | 8 ++++---- internal/database/bolt.go | 4 ++-- internal/database/configuration_database.go | 2 +- internal/database/local_database.go | 2 +- internal/service/emailer.go | 4 ++-- internal/service/oauth2.go | 6 +++--- internal/utils/constants.go | 6 +++--- internal/utils/printer.go | 2 +- main.go | 8 ++++---- 11 files changed, 23 insertions(+), 22 deletions(-) diff --git a/.gitignore b/.gitignore index 97e2322..e2666a8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .idea/ *.database .env +pigil diff --git a/go.mod b/go.mod index fcc6a86..b0d7243 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module gnoty +module pigil go 1.17 diff --git a/handlers.go b/handlers.go index c62cdf5..2266d55 100644 --- a/handlers.go +++ b/handlers.go @@ -3,12 +3,12 @@ package main import ( "context" "fmt" - "gnoty/internal/database" - service2 "gnoty/internal/service" - "gnoty/internal/types" - "gnoty/internal/utils" "golang.org/x/oauth2" "log" + "pigil/internal/database" + service2 "pigil/internal/service" + "pigil/internal/types" + "pigil/internal/utils" ) func InsertCommand(service database.Service, diff --git a/internal/database/bolt.go b/internal/database/bolt.go index 856fd3a..2da239d 100644 --- a/internal/database/bolt.go +++ b/internal/database/bolt.go @@ -2,9 +2,9 @@ package database import ( "encoding/json" - "gnoty/internal/types" - "gnoty/internal/utils" bolt "go.etcd.io/bbolt" + "pigil/internal/types" + "pigil/internal/utils" "strconv" ) diff --git a/internal/database/configuration_database.go b/internal/database/configuration_database.go index ae3a74e..e9a972c 100644 --- a/internal/database/configuration_database.go +++ b/internal/database/configuration_database.go @@ -1,6 +1,6 @@ package database -import "gnoty/internal/types" +import "pigil/internal/types" type configurationDatabase interface { InsertConfig(information types.ConfigurationInformation) error diff --git a/internal/database/local_database.go b/internal/database/local_database.go index 5d678bf..05dbe05 100644 --- a/internal/database/local_database.go +++ b/internal/database/local_database.go @@ -1,6 +1,6 @@ package database -import "gnoty/internal/types" +import "pigil/internal/types" type localDatabase interface { Insert(information types.CommandInformation) error diff --git a/internal/service/emailer.go b/internal/service/emailer.go index ad2327b..a545f34 100644 --- a/internal/service/emailer.go +++ b/internal/service/emailer.go @@ -15,7 +15,7 @@ func SendEmail(client *http.Client, email string) { if err != nil { log.Fatal(err.Error()) } - emailBody := "This is an test email from gnoty!" + emailBody := "This is an test email from pigil!" if err != nil { log.Fatal(err.Error()) } @@ -23,7 +23,7 @@ func SendEmail(client *http.Client, email string) { var message gmail.Message emailTo := "To: " + email + "\r\n" - subject := "Subject: " + "Gnoty sends regards!" + "\n" + subject := "Subject: " + "Pigil sends regards!" + "\n" mime := "MIME-version: 1.0;\nContent-Type: text/plain; charset=\"UTF-8\";\n\n" msg := []byte(emailTo + subject + mime + "\n" + emailBody) diff --git a/internal/service/oauth2.go b/internal/service/oauth2.go index f83d32c..045b4c1 100644 --- a/internal/service/oauth2.go +++ b/internal/service/oauth2.go @@ -4,12 +4,12 @@ import ( "context" "encoding/json" "fmt" - "gnoty/internal/types" "golang.org/x/oauth2" "golang.org/x/oauth2/google" "log" "net/http" "os" + "pigil/internal/types" ) func OAuthGoogleConfig() *oauth2.Config { @@ -26,7 +26,7 @@ func OAuthGoogleConfig() *oauth2.Config { func GoogleLogin(config *oauth2.Config) *oauth2.Config { //TODO: state generation url := config.AuthCodeURL("", oauth2.AccessTypeOffline) - fmt.Printf("Click on this link to authenticate yourself with gnoty! \n%s"+ + fmt.Printf("Click on this link to authenticate yourself with pigil! \n%s"+ "\n", url) return config } @@ -49,7 +49,7 @@ func GoogleCallback(config *oauth2.Config) types.UserInformation { fmt.Println(token.AccessToken) w.WriteHeader(http.StatusCreated) _, err = fmt.Fprintf(w, - "Your email has been linked via gnoty! You can close this webpage"+ + "Your email has been linked via pigil! You can close this webpage"+ " now!") if err != nil { log.Fatal(err.Error()) diff --git a/internal/utils/constants.go b/internal/utils/constants.go index bbf9dc4..4b083ea 100644 --- a/internal/utils/constants.go +++ b/internal/utils/constants.go @@ -1,8 +1,8 @@ package utils const ( - LocalBucket = "gnoty_storage" - ConfigBucket = "gnoty_config" + LocalBucket = "pigil_storage" + ConfigBucket = "pigil_config" CliDb = "db" CliAuth = "auth" CliStatus = "status" @@ -10,5 +10,5 @@ const ( UserEmail = "email" UserAT = "access_token" UserRT = "refresh_token" - DatabaseName = "gnoty.database" + DatabaseName = "pigil.database" ) diff --git a/internal/utils/printer.go b/internal/utils/printer.go index bdcfcea..7149669 100644 --- a/internal/utils/printer.go +++ b/internal/utils/printer.go @@ -2,8 +2,8 @@ package utils import ( "github.com/jedib0t/go-pretty/v6/table" - "gnoty/internal/types" "os" + "pigil/internal/types" "time" ) diff --git a/main.go b/main.go index 8c78c53..1463c3a 100644 --- a/main.go +++ b/main.go @@ -3,14 +3,14 @@ package main import ( "fmt" "github.com/joho/godotenv" - "gnoty/internal/database" - "gnoty/internal/types" - "gnoty/internal/utils" bolt "go.etcd.io/bbolt" "io" "log" "os" "os/exec" + "pigil/internal/database" + "pigil/internal/types" + "pigil/internal/utils" "time" ) @@ -61,7 +61,7 @@ func executor(args []string, service database.Service) { } start := time.Now() if err := cmd.Start(); err != nil { - log.Fatal("gnoty info:", err) + log.Fatal("pigil info:", err) } ci := types.CommandInformation{ CommandName: args[1],