From 12853a8555ff5f291541c2b62bf98514b5b33af9 Mon Sep 17 00:00:00 2001 From: Bart Date: Wed, 15 Nov 2023 11:05:24 +0100 Subject: [PATCH 1/7] bump flowser version --- go.mod | 2 +- go.sum | 2 ++ internal/tools/flowser.go | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index cbe85bbe7..a7a71444a 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/onflow/flow-core-contracts/lib/go/templates v1.2.4-0.20231016154253-a00dbf7c061f github.com/onflow/flow-emulator v0.57.3 github.com/onflow/flow-go-sdk v0.41.16 - github.com/onflowser/flowser/v2 v2.0.14-beta + github.com/onflowser/flowser/v3 v3.1.2 github.com/pkg/errors v0.9.1 github.com/psiemens/sconfig v0.1.0 github.com/radovskyb/watcher v1.0.7 diff --git a/go.sum b/go.sum index 8be646231..c28a6f1e4 100644 --- a/go.sum +++ b/go.sum @@ -929,6 +929,8 @@ github.com/onflow/wal v0.0.0-20230529184820-bc9f8244608d h1:gAEqYPn3DS83rHIKEpsa github.com/onflow/wal v0.0.0-20230529184820-bc9f8244608d/go.mod h1:iMC8gkLqu4nkbkAla5HkSBb+FGyQOZiWz3DYm2wSXCk= github.com/onflowser/flowser/v2 v2.0.14-beta h1:yvmXyGUkR7e0+Z1t7Gyn+p2Q+CpUmgsqF01M7EtNr3k= github.com/onflowser/flowser/v2 v2.0.14-beta/go.mod h1:g/nfelBOx0A4j60Twsr7GsmKapr2oxtRZQS0lwPHgZY= +github.com/onflowser/flowser/v3 v3.1.2 h1:ctMBVES3o2wG5b/tuYTYtYoxzeH4M6nsmbPoHkUOOEI= +github.com/onflowser/flowser/v3 v3.1.2/go.mod h1:3UZqdIyKVh+wXOhz9p2YrVl+ZvxohxhAmdM68dDKYPE= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= diff --git a/internal/tools/flowser.go b/internal/tools/flowser.go index f4e49c47a..65f3ab3b8 100644 --- a/internal/tools/flowser.go +++ b/internal/tools/flowser.go @@ -24,7 +24,7 @@ import ( "os" "runtime" - "github.com/onflowser/flowser/v2/pkg/flowser" + "github.com/onflowser/flowser/v3/pkg/flowser" "github.com/spf13/cobra" "github.com/onflow/flow-cli/flowkit" From d5d0b4fb39728979ccf175f44da34feb5130ae81 Mon Sep 17 00:00:00 2001 From: Bart Date: Wed, 15 Nov 2023 11:08:20 +0100 Subject: [PATCH 2/7] remove linux support check --- internal/tools/flowser.go | 6 ------ 1 file changed, 6 deletions(-) diff --git a/internal/tools/flowser.go b/internal/tools/flowser.go index 65f3ab3b8..d23067363 100644 --- a/internal/tools/flowser.go +++ b/internal/tools/flowser.go @@ -19,7 +19,6 @@ package tools import ( - "errors" "fmt" "os" "runtime" @@ -58,11 +57,6 @@ func runFlowser( reader flowkit.ReaderWriter, _ flowkit.Services, ) (command.Result, error) { - if runtime.GOOS != settings.Windows && runtime.GOOS != settings.Darwin { - fmt.Println("If you want Flowser to be supported on Linux please vote here: https://github.com/onflowser/flowser/discussions/142") - return nil, errors.New("OS not supported, only supporting Windows and Mac OS") - } - flowser := flowser.New() installPath, err := settings.GetFlowserPath() From ab66d7166d364dffdb6c75bb82400d7ade14cb9e Mon Sep 17 00:00:00 2001 From: Bart Date: Wed, 15 Nov 2023 11:32:35 +0100 Subject: [PATCH 3/7] add default linux intall path --- internal/settings/defaults.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/settings/defaults.go b/internal/settings/defaults.go index 151b528f7..5f32af232 100644 --- a/internal/settings/defaults.go +++ b/internal/settings/defaults.go @@ -38,6 +38,7 @@ var defaults = map[string]any{ const ( Darwin = "darwin" Windows = "windows" + Linux = "linux" ) // getDefaultInstallDir returns default installation directory based on the OS. @@ -49,6 +50,8 @@ func getDefaultInstallDir() string { // https://superuser.com/questions/1327037/what-choices-do-i-have-about-where-to-install-software-on-windows-10 usr, _ := user.Current() // safe to ignore cache errors return fmt.Sprintf(`%s\AppData\Local\Programs`, usr.HomeDir) + case Linux: + return "/usr/bin" default: return "" } From 8af720e1eb6c518e1d6e22a34c612d69569568e7 Mon Sep 17 00:00:00 2001 From: Bart Date: Wed, 15 Nov 2023 11:42:28 +0100 Subject: [PATCH 4/7] customize path on linux --- internal/tools/flowser.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/tools/flowser.go b/internal/tools/flowser.go index d23067363..5257bb8d6 100644 --- a/internal/tools/flowser.go +++ b/internal/tools/flowser.go @@ -105,8 +105,8 @@ func installFlowser(flowser *flowser.App, installPath string) (string, error) { return installPath, nil } - // we only allow custom paths on Windows since on MacOS apps needs to be installed inside Application folder - if runtime.GOOS == settings.Windows { + // MacOS apps must always be installed inside Application folder + if runtime.GOOS != settings.Darwin { installPath = util.InstallPathPrompt(installPath) _ = settings.SetFlowserPath(installPath) } From b9b56fdf1c3cc6a4582323eda2a59547c1f00cc4 Mon Sep 17 00:00:00 2001 From: Bart Date: Wed, 15 Nov 2023 12:21:16 +0100 Subject: [PATCH 5/7] update default path --- internal/settings/defaults.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/settings/defaults.go b/internal/settings/defaults.go index 5f32af232..fafbea1c5 100644 --- a/internal/settings/defaults.go +++ b/internal/settings/defaults.go @@ -51,7 +51,8 @@ func getDefaultInstallDir() string { usr, _ := user.Current() // safe to ignore cache errors return fmt.Sprintf(`%s\AppData\Local\Programs`, usr.HomeDir) case Linux: - return "/usr/bin" + // Use path in users home folder to not require sudo permissions for installation + return "~/.local/bin" default: return "" } From 6ebc0e54ae67caba279496e15ba902cb7d3882af Mon Sep 17 00:00:00 2001 From: Bart Date: Wed, 15 Nov 2023 12:22:03 +0100 Subject: [PATCH 6/7] bump flowser version --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index a7a71444a..22342197a 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/onflow/flow-core-contracts/lib/go/templates v1.2.4-0.20231016154253-a00dbf7c061f github.com/onflow/flow-emulator v0.57.3 github.com/onflow/flow-go-sdk v0.41.16 - github.com/onflowser/flowser/v3 v3.1.2 + github.com/onflowser/flowser/v3 v3.1.3 github.com/pkg/errors v0.9.1 github.com/psiemens/sconfig v0.1.0 github.com/radovskyb/watcher v1.0.7 diff --git a/go.sum b/go.sum index c28a6f1e4..269076bf7 100644 --- a/go.sum +++ b/go.sum @@ -931,6 +931,8 @@ github.com/onflowser/flowser/v2 v2.0.14-beta h1:yvmXyGUkR7e0+Z1t7Gyn+p2Q+CpUmgsq github.com/onflowser/flowser/v2 v2.0.14-beta/go.mod h1:g/nfelBOx0A4j60Twsr7GsmKapr2oxtRZQS0lwPHgZY= github.com/onflowser/flowser/v3 v3.1.2 h1:ctMBVES3o2wG5b/tuYTYtYoxzeH4M6nsmbPoHkUOOEI= github.com/onflowser/flowser/v3 v3.1.2/go.mod h1:3UZqdIyKVh+wXOhz9p2YrVl+ZvxohxhAmdM68dDKYPE= +github.com/onflowser/flowser/v3 v3.1.3 h1:Y8HyQRwhroCWGcV2UPBD+GZDLHTzu2GjdaBoIEn6YAU= +github.com/onflowser/flowser/v3 v3.1.3/go.mod h1:3UZqdIyKVh+wXOhz9p2YrVl+ZvxohxhAmdM68dDKYPE= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= From 0fedaa5f8167c2437aa7a7540eeb0188ee4ad5ff Mon Sep 17 00:00:00 2001 From: Bart Date: Wed, 15 Nov 2023 12:38:44 +0100 Subject: [PATCH 7/7] expand home path --- internal/settings/defaults.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/settings/defaults.go b/internal/settings/defaults.go index fafbea1c5..d361e66ae 100644 --- a/internal/settings/defaults.go +++ b/internal/settings/defaults.go @@ -51,8 +51,10 @@ func getDefaultInstallDir() string { usr, _ := user.Current() // safe to ignore cache errors return fmt.Sprintf(`%s\AppData\Local\Programs`, usr.HomeDir) case Linux: + // https://unix.stackexchange.com/questions/127076/into-which-directory-should-i-install-programs-in-linux + usr, _ := user.Current() // safe to ignore cache errors // Use path in users home folder to not require sudo permissions for installation - return "~/.local/bin" + return fmt.Sprintf(`%s/.local/bin`, usr.HomeDir) default: return "" }