Skip to content

Commit

Permalink
windoz testing
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewlunde committed Sep 25, 2020
1 parent ec1f0a7 commit 2a9e47c
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.DS_Store
ServiceManagement.osx
ServiceManagement.linux64
ServiceManagement.linux32
ServiceManagement.win64
ServiceManagement.win32
mod_settings
31 changes: 28 additions & 3 deletions COMMANDS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 [email protected] -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"
Expand Down Expand Up @@ -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
```
31 changes: 23 additions & 8 deletions ServiceManagement_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,13 @@ func (c *ServiceManagementPlugin) Run(cliConnection plugin.CliConnection, args [

addConn += `}`

// =====================================================================
// =====================================================================
// =====================================================================
// modifySettings = mod_settings.go
// =====================================================================
// =====================================================================
// =====================================================================

if *modifySettings {
fmt.Println("")
Expand Down Expand Up @@ -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

}

Expand All @@ -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("")
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 2a9e47c

Please sign in to comment.