Skip to content

Commit 1b934d3

Browse files
committed
Make solargraph work gracefully across ruby versions
1 parent 2f2bdbc commit 1b934d3

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/multilspy/language_servers/solargraph/solargraph.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,8 @@ def setup_runtime_dependencies(self, logger: MultilspyLogger, config: MultilspyC
4848
Setup runtime dependencies for Solargraph.
4949
"""
5050
platform_id = PlatformUtils.get_platform_id()
51-
cat_cmd = "cat"
5251
which_cmd = "which"
5352
if platform_id in [PlatformId.WIN_x64, PlatformId.WIN_arm64, PlatformId.WIN_x86]:
54-
cat_cmd = "type"
5553
which_cmd = "where"
5654

5755
with open(os.path.join(os.path.dirname(__file__), "runtime_dependencies.json"), "r") as f:
@@ -62,15 +60,11 @@ def setup_runtime_dependencies(self, logger: MultilspyLogger, config: MultilspyC
6260

6361
# Check if Ruby is installed
6462
try:
65-
result = subprocess.run([cat_cmd, ".ruby-version"], capture_output=True, cwd=repository_root_path)
66-
expected_ruby_version = result.stdout.strip()
6763
result = subprocess.run(["ruby", "--version"], check=True, capture_output=True, cwd=repository_root_path)
68-
actual_ruby_version = result.stdout.strip()
69-
if expected_ruby_version not in actual_ruby_version:
70-
raise RuntimeError(f"Expected Ruby version {expected_ruby_version} but found {actual_ruby_version}")
71-
logger.log(f"Ruby version: {actual_ruby_version}", logging.INFO)
72-
except subprocess.CalledProcessError:
73-
raise RuntimeError("Ruby is not installed. Please install Ruby before continuing.")
64+
ruby_version = result.stdout.strip()
65+
logger.log(f"Ruby version: {ruby_version}", logging.INFO)
66+
except subprocess.CalledProcessError as e:
67+
raise RuntimeError(f"Error checking for Ruby installation: {e.stderr}")
7468
except FileNotFoundError:
7569
raise RuntimeError("Ruby is not installed. Please install Ruby before continuing.")
7670

0 commit comments

Comments
 (0)