Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor CLI Fix for Formatting Tests #321

Merged
merged 7 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cli/commands/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func BackendCommand() *cli.Command {

func RunBackend() error {
cmd := exec.Command("go", "run", "main.go")
cmd.Dir = BACKEND_DIR
cmd.Dir = BACKEND_SRC_DIR
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err := cmd.Run()
Expand Down
11 changes: 6 additions & 5 deletions cli/commands/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ import (
)

var (
ROOT_DIR, _ = utils.GetRootDir()
FRONTEND_DIR = filepath.Join(ROOT_DIR, "/frontend")
BACKEND_DIR = filepath.Join(ROOT_DIR, "/backend/src")
CONFIG, _ = config.GetConfiguration(filepath.Join(ROOT_DIR, "/config"), false)
MIGRATION_FILE = filepath.Join(BACKEND_DIR, "/migrations/data.sql")
ROOT_DIR, _ = utils.GetRootDir()
FRONTEND_DIR = filepath.Join(ROOT_DIR, "/frontend")
BACKEND_DIR = filepath.Join(ROOT_DIR, "/backend/")
garrettladley marked this conversation as resolved.
Show resolved Hide resolved
BACKEND_SRC_DIR = filepath.Join(ROOT_DIR, "/backend/src")
garrettladley marked this conversation as resolved.
Show resolved Hide resolved
CONFIG, _ = config.GetConfiguration(filepath.Join(ROOT_DIR, "/config"), false)
MIGRATION_FILE = filepath.Join(BACKEND_SRC_DIR, "/migrations/data.sql")
)
2 changes: 1 addition & 1 deletion cli/commands/insert.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func InsertDB() error {

migrateCmd := exec.Command("go", "run", "main.go", "--only-migrate")

migrateCmd.Dir = BACKEND_DIR
migrateCmd.Dir = BACKEND_SRC_DIR

if err := migrateCmd.Run(); err != nil {
return fmt.Errorf("error running migration: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion cli/commands/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func Migrate() error {
fmt.Println("Migrating database")

goCmd := exec.Command("go", "run", "main.go", "--only-migrate")
goCmd.Dir = BACKEND_DIR
goCmd.Dir = BACKEND_SRC_DIR

output, err := goCmd.CombinedOutput()
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions cli/commands/reset.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func ResetData() error {
}

cmd := exec.Command("sleep", "1")
cmd.Dir = BACKEND_DIR
cmd.Dir = BACKEND_SRC_DIR

err = cmd.Run()
if err != nil {
Expand All @@ -65,7 +65,7 @@ func ResetData() error {
}

cmd = exec.Command("sleep", "1")
cmd.Dir = BACKEND_DIR
cmd.Dir = BACKEND_SRC_DIR

err = cmd.Run()
if err != nil {
Expand All @@ -91,7 +91,7 @@ func ResetMigration() error {
}

cmd := exec.Command("sleep", "1")
cmd.Dir = BACKEND_DIR
cmd.Dir = BACKEND_SRC_DIR

err = cmd.Run()
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions cli/commands/swagger.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func SwaggerCommand() *cli.Command {
Usage: "Runs `swag init` to update Swagger documentation for the backend API",
Action: func(c *cli.Context) error {
cmd := exec.Command("swag", "init")
cmd.Dir = BACKEND_DIR
cmd.Dir = BACKEND_SRC_DIR
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err := cmd.Run()
Expand All @@ -31,7 +31,7 @@ func SwaggerCommand() *cli.Command {

func Swagger() error {
cmd := exec.Command("swag", "init")
cmd.Dir = BACKEND_DIR
cmd.Dir = BACKEND_SRC_DIR

out, err := cmd.CombinedOutput()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cli/commands/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func Test(folder string, runFrontend bool, runBackend bool) error {

func BackendTest() error {
cmd := exec.Command("go", "test", "./...")
cmd.Dir = BACKEND_DIR
cmd.Dir = BACKEND_SRC_DIR

out, err := cmd.CombinedOutput()
if err != nil {
Expand Down
104 changes: 1 addition & 103 deletions go.work.sum

Large diffs are not rendered by default.

Loading