From 2a9e47ce7b865d71199c49056dccbb9e45229dec Mon Sep 17 00:00:00 2001 From: Andrew Lunde Date: Fri, 25 Sep 2020 16:29:54 -0400 Subject: [PATCH] windoz testing --- .gitignore | 2 ++ COMMANDS.md | 31 ++++++++++++++++++++++++++++--- ServiceManagement_plugin.go | 31 +++++++++++++++++++++++-------- 3 files changed, 53 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 3ebf441..3d0345f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ .DS_Store ServiceManagement.osx ServiceManagement.linux64 +ServiceManagement.linux32 ServiceManagement.win64 +ServiceManagement.win32 mod_settings diff --git a/COMMANDS.md b/COMMANDS.md index b443c0e..d2b6911 100644 --- a/COMMANDS.md +++ b/COMMANDS.md @@ -12,15 +12,30 @@ cf plugins | grep ServiceManage GOOS=darwin GOARCH=amd64 go build -o ServiceManagement.osx ServiceManagement_plugin.go ; chmod 755 ServiceManagement.osx ; cf uninstall-plugin ServiceManagement ; cf install-plugin ServiceManagement.osx -f ; cf plugins | grep ServiceManage +GOOS=linux GOARCH=amd64 go build -o ServiceManagement.linux64 ServiceManagement_plugin.go ; scp ServiceManagement.linux64 thedrop:/home/ec2-user/files + +GOOS=windows GOARCH=amd64 go build -o ServiceManagement.win64 ServiceManagement_plugin.go ; scp ServiceManagement.win64 thedrop:/home/ec2-user/files + ``` In BAS ``` cd ~ -curl -LJO http://thedrop.sap-partner-eng.com/files/ServiceManagement_1_0_10.linux64 -chmod 755 ServiceManagement_1_0_10.linux64 -cf uninstall-plugin ServiceManagement ; cf install-plugin ServiceManagement_1_0_10.linux64 -f + +cf api https://api.cf.us10.hana.ondemand.com ; cf login -u andrew.lunde@sap.com -o ae67provider -s dev + +curl -LJO https://github.com/andrewlunde/ServiceManagement/releases/download/latest/ServiceManagement.linux64 ; chmod +x ServiceManagement.linux64 ; f uninstall-plugin ServiceManagement ; cf install-plugin ServiceManagement.linux64 -f + +``` +For WIP Drops +``` +GOOS=linux GOARCH=amd64 go build -o ServiceManagement.linux64 ServiceManagement_plugin.go ; scp ServiceManagement.linux64 thedrop:/home/ec2-user/files + +GOOS=windows GOARCH=amd64 go build -o ServiceManagement.win64 ServiceManagement_plugin.go ; cf uninstall-plugin ServiceManagement ; cf install-plugin ServiceManagement.linux64 -f + +curl -LJO https://github.com/andrewlunde/ServiceManagement/releases/download/latest/ServiceManagement.win64 ; cf uninstall-plugin ServiceManagement ; cf install-plugin ServiceManagement.win64 -f + cf plugins | grep ServiceManage curl -LJO "Redirects" @@ -56,8 +71,18 @@ vim /home/user/.theia/settings.json smc.json ``` For Release: +The CF cli supports 5 combinations: + +linux/386 (known as linux32) +linux/amd64 (known as linux64) +windows/386 (known as win32) +windows/amd64 (known as win64) +darwin /amd64 (known as osx) + ``` GOOS=darwin GOARCH=amd64 go build -o ServiceManagement.osx ServiceManagement_plugin.go GOOS=linux GOARCH=amd64 go build -o ServiceManagement.linux64 ServiceManagement_plugin.go +GOOS=linux GOARCH=386 go build -o ServiceManagement.linux32 ServiceManagement_plugin.go GOOS=windows GOARCH=amd64 go build -o ServiceManagement.win64 ServiceManagement_plugin.go +GOOS=windows GOARCH=386 go build -o ServiceManagement.win32 ServiceManagement_plugin.go ``` \ No newline at end of file diff --git a/ServiceManagement_plugin.go b/ServiceManagement_plugin.go index 052d2aa..31c1b49 100644 --- a/ServiceManagement_plugin.go +++ b/ServiceManagement_plugin.go @@ -464,7 +464,13 @@ func (c *ServiceManagementPlugin) Run(cliConnection plugin.CliConnection, args [ addConn += `}` + // ===================================================================== + // ===================================================================== + // ===================================================================== // modifySettings = mod_settings.go + // ===================================================================== + // ===================================================================== + // ===================================================================== if *modifySettings { fmt.Println("") @@ -545,11 +551,20 @@ func (c *ServiceManagementPlugin) Run(cliConnection plugin.CliConnection, args [ case "windows": fmt.Println("On Windoz:") - if inSettings { - settingsFile = "~/Code/User/" - } else { //User(Global) Settings - settingsFile = homeDirectory + "%APPDATA%\\Code\\User\\settings.json" - } + //APPDATA=C:\Users\I830671\AppData\Roaming + // defaultsFile = "\"" + homeDirectory + "\\AppData\\Roaming\\Code\\storage.json" + "\"" + // fmt.Println("defaultsFile: " + defaultsFile) + // byteValue, err := ioutil.ReadFile(defaultsFile) + // if err == nil { + // configURIPath, err := jsonparser.GetString(byteValue, "windowsState", "lastActiveWindow", "workspaceIdentifier", "configURIPath") + // if err == nil { + // fmt.Println("configURIPath: " + configURIPath) + // settingsFile = "/" + strings.TrimLeft(configURIPath, "file:/") + // inSettings = true // File has sqltools.connections at the top-level + // } + // } + settingsFile = "\"" + homeDirectory + "\\AppData\\Roaming\\Code\\User\\settings.json" + "\"" + inSettings = false // File has sqltools.connections at the top-level } @@ -574,7 +589,7 @@ func (c *ServiceManagementPlugin) Run(cliConnection plugin.CliConnection, args [ // Therefore, do *NOT* use !os.IsNotExist(err) to test for file existence fmt.Println("settingsFile: " + settingsFile + " Existence Unknown!") - + settingsExists = true } fmt.Println("") @@ -703,7 +718,7 @@ func (c *ServiceManagementPlugin) Run(cliConnection plugin.CliConnection, args [ // https://github.com/buger/jsonparser#set if !skipping { - fmt.Println("Adding connection with name " + connName + ".") + fmt.Println("adding: " + connName + "") var newSQLToolsConn string @@ -815,7 +830,7 @@ func (c *ServiceManagementPlugin) GetMetadata() plugin.PluginMetadata { Version: plugin.VersionType{ Major: 1, Minor: 0, - Build: 10, + Build: 11, }, MinCliVersion: plugin.VersionType{ Major: 6,