Skip to content

Commit 6433c7c

Browse files
authored
Add environment variables support to Bundler (#91)
Pass shell environment variables from `worktree` to Bundler. This is requires to support various Ruby version managers properly.
1 parent b22ef1a commit 6433c7c

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/bundler.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ use zed_extension_api::{Command, Result};
44
/// A simple wrapper around the `bundle` command.
55
pub struct Bundler {
66
pub working_dir: String,
7+
envs: Vec<(String, String)>,
78
}
89

910
impl Bundler {
10-
pub fn new(working_dir: String) -> Self {
11-
Bundler { working_dir }
11+
pub fn new(working_dir: String, envs: Vec<(String, String)>) -> Self {
12+
Bundler { working_dir, envs }
1213
}
1314

1415
pub fn installed_gem_version(&self, name: &str) -> Result<String> {
@@ -26,6 +27,7 @@ impl Bundler {
2627
Command::new("bundle")
2728
.arg(cmd)
2829
.args(args)
30+
.envs(self.envs.clone())
2931
.env("BUNDLE_GEMFILE", bundle_gemfile)
3032
.output()
3133
.and_then(|output| match output.status {

src/language_servers/language_server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ pub trait LanguageServer {
6767
return self.try_find_on_path_or_extension_gemset(language_server_id, worktree);
6868
}
6969

70-
let bundler = Bundler::new(worktree.root_path());
70+
let bundler = Bundler::new(worktree.root_path(), worktree.shell_env());
7171
match bundler.installed_gem_version(Self::GEM_NAME) {
7272
Ok(_version) => {
7373
let bundle_path = worktree

0 commit comments

Comments
 (0)