Skip to content

Commit

Permalink
feat(ide): add RustRover support
Browse files Browse the repository at this point in the history
Signed-off-by: Luca Di Maio <[email protected]>
  • Loading branch information
89luca89 committed May 29, 2024
1 parent 8a32df3 commit 25ec374
Show file tree
Hide file tree
Showing 8 changed files with 189 additions and 5 deletions.
8 changes: 6 additions & 2 deletions cmd/agent/container/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,8 @@ func (cmd *SetupContainerCmd) installIDE(setupInfo *config.Result, ide *provider
return cmd.setupOpenVSCode(setupInfo, ide.Options, log)
case string(config2.IDEGoland):
return jetbrains.NewGolandServer(config.GetRemoteUser(setupInfo), ide.Options, log).Install()
case string(config2.IDERustRover):
return jetbrains.NewRustRoverServer(config.GetRemoteUser(setupInfo), ide.Options, log).Install()
case string(config2.IDEPyCharm):
return jetbrains.NewPyCharmServer(config.GetRemoteUser(setupInfo), ide.Options, log).Install()
case string(config2.IDEPhpStorm):
Expand Down Expand Up @@ -443,9 +445,11 @@ func (cmd *SetupContainerCmd) setupVSCode(setupInfo *config.Result, ideOptions m
return nil, err
}

args := []string{"agent", "container", "vscode-async",
args := []string{
"agent", "container", "vscode-async",
"--setup-info", cmd.SetupInfo,
"--release-channel", string(releaseChannel)}
"--release-channel", string(releaseChannel),
}

return exec.Command(binaryPath, args...), nil
})
Expand Down
2 changes: 2 additions & 0 deletions cmd/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ func (cmd *UpCmd) Run(
cmd.GitToken,
log,
)
case string(config.IDERustRover):
return jetbrains.NewRustRoverServer(config2.GetRemoteUser(result), ideConfig.Options, log).OpenGateway(result.SubstitutionContext.ContainerWorkspaceFolder, client.Workspace())
case string(config.IDEGoland):
return jetbrains.NewGolandServer(config2.GetRemoteUser(result), ideConfig.Options, log).OpenGateway(result.SubstitutionContext.ContainerWorkspaceFolder, client.Workspace())
case string(config.IDEPyCharm):
Expand Down
132 changes: 132 additions & 0 deletions desktop/src/images/rustrover.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 1 addition & 3 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package main

import (
"github.com/loft-sh/devpod/cmd"
)
import "github.com/loft-sh/devpod/cmd"

func main() {
cmd.Execute()
Expand Down
1 change: 1 addition & 0 deletions pkg/config/ide.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const (
IDEOpenVSCode IDE = "openvscode"
IDEIntellij IDE = "intellij"
IDEGoland IDE = "goland"
IDERustRover IDE = "rustrover"

Check failure on line 12 in pkg/config/ide.go

View workflow job for this annotation

GitHub Actions / lint

File is not `goimports`-ed (goimports)
IDEPyCharm IDE = "pycharm"
IDEPhpStorm IDE = "phpstorm"
IDECLion IDE = "clion"
Expand Down
2 changes: 2 additions & 0 deletions pkg/driver/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@ func (d *dockerDriver) RunDockerDevContainer(
switch ide {
case string(config2.IDEGoland):
args = append(args, "--mount", jetbrains.NewGolandServer("", ideOptions, d.Log).GetVolume())
case string(config2.IDERustRover):
args = append(args, "--mount", jetbrains.NewRustRoverServer("", ideOptions, d.Log).GetVolume())
case string(config2.IDEPyCharm):
args = append(args, "--mount", jetbrains.NewPyCharmServer("", ideOptions, d.Log).GetVolume())
case string(config2.IDEPhpStorm):
Expand Down
6 changes: 6 additions & 0 deletions pkg/ide/ideparse/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ var AllowedIDEs = []AllowedIDE{
Options: jetbrains.GolandOptions,
Icon: "https://devpod.sh/assets/goland.svg",
},
{
Name: config.IDERustRover,
DisplayName: "RustRover",
Options: jetbrains.RustRoverOptions,
Icon: "https://devpod.sh/assets/rustrover.svg",
},
{
Name: config.IDEPyCharm,
DisplayName: "PyCharm",
Expand Down
39 changes: 39 additions & 0 deletions pkg/ide/jetbrains/rustrover.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package jetbrains

import (
"github.com/loft-sh/devpod/pkg/config"
"github.com/loft-sh/devpod/pkg/ide"
"github.com/loft-sh/log"
)

const (
RustRoverProductCode = "RR"
RustRoverDownloadAmd64Template = "https://download.jetbrains.com/rust/rustrover-%s.tar.gz"
RustRoverDownloadArm64Template = "https://download.jetbrains.com/rust/rustrover-%s-aarch64.tar.gz"
)

var RustRoverOptions = ide.Options{
VersionOption: {
Name: VersionOption,
Description: "The version for the binary",
Default: "latest",
},
DownloadArm64Option: {
Name: DownloadArm64Option,
Description: "The download url for the arm64 server binary",
},
DownloadAmd64Option: {
Name: DownloadAmd64Option,
Description: "The download url for the amd64 server binary",
},
}

func NewRustRoverServer(userName string, values map[string]config.OptionValue, log log.Logger) *GenericJetBrainsServer {
amd64Download, arm64Download := getDownloadURLs(RustRoverOptions, values, RustRoverProductCode, RustRoverDownloadAmd64Template, RustRoverDownloadArm64Template)
return newGenericServer(userName, &GenericOptions{
ID: "rustrover",
DisplayName: "RustRover",
DownloadAmd64: amd64Download,
DownloadArm64: arm64Download,
}, log)
}

0 comments on commit 25ec374

Please sign in to comment.