From f2b237dacb3c38c96e461dde79e3e9ed87233b1a Mon Sep 17 00:00:00 2001 From: Bartolomej Kozorog Date: Fri, 18 Nov 2022 22:37:04 +0100 Subject: [PATCH 1/2] update main program --- pkg/main/main.go | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/pkg/main/main.go b/pkg/main/main.go index 8820e943..07335c6d 100644 --- a/pkg/main/main.go +++ b/pkg/main/main.go @@ -3,15 +3,24 @@ package main import ( "fmt" "github.com/onflowser/flowser/pkg/flowser" + "os" + "path" ) func main() { app := flowser.New() + installDir := path.Join("..", "test-install") + + if !app.Installed(installDir) { + err := app.Install(installDir) + fmt.Println("Installing Flowser...") + if err != nil { + panic(err) + } - location, err := app.Install("") - if err != nil { - panic(err) } - fmt.Println("Flowser installed at:", location) + projectDir := os.Args[1] + fmt.Println("Running Flowser") + app.Run(installDir, projectDir) } From 3a4e77bd8e8544c2eeebbf34ec07cf4ef9ca00d9 Mon Sep 17 00:00:00 2001 From: Bartolomej Kozorog Date: Fri, 18 Nov 2022 22:42:46 +0100 Subject: [PATCH 2/2] remove outdated test --- pkg/flowser/app_test.go | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 pkg/flowser/app_test.go diff --git a/pkg/flowser/app_test.go b/pkg/flowser/app_test.go deleted file mode 100644 index 6eca904a..00000000 --- a/pkg/flowser/app_test.go +++ /dev/null @@ -1,32 +0,0 @@ -package flowser - -import ( - "testing" -) - -var app = &app{} - -func TestInstallAndRun(t *testing.T) { - installDir, err := app.Install("") - t.Logf("Installed to %s", installDir) - - if err != nil { - t.Fatalf("Installed with error %s", err) - } - isInstalled, err := app.Installed() - if err != nil { - t.Fatalf("Installed with error %s", err) - } - if !isInstalled { - t.Fatalf("Should return isInstalled = true") - } - err = app.Run("/invalid/path") - if err == nil { - t.Fatal("Didn't return error for invalid project path") - } - - err = app.Remove("") - if err != nil { - t.Fatalf("Failed to remove installed App: %s", err) - } -}