Skip to content

Commit b7d3694

Browse files
committed
Check for correct version of ruby
1 parent 462d014 commit b7d3694

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/multilspy/language_servers/solargraph/solargraph.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,13 @@ def setup_runtime_dependencies(self, logger: MultilspyLogger, config: MultilspyC
5757

5858
# Check if Ruby is installed
5959
try:
60+
result = subprocess.run(["cat", ".ruby-version"], capture_output=True, cwd=repository_root_path)
61+
expected_ruby_version = result.stdout.strip()
6062
result = subprocess.run(["ruby", "--version"], check=True, capture_output=True, cwd=repository_root_path)
61-
logger.log(f"Ruby version: {result.stdout.strip()}", logging.INFO)
63+
actual_ruby_version = result.stdout.strip()
64+
if expected_ruby_version not in actual_ruby_version:
65+
raise RuntimeError(f"Expected Ruby version {expected_ruby_version} but found {actual_ruby_version}")
66+
logger.log(f"Ruby version: {actual_ruby_version}", logging.INFO)
6267
except subprocess.CalledProcessError:
6368
raise RuntimeError("Ruby is not installed. Please install Ruby before continuing.")
6469
except FileNotFoundError:

0 commit comments

Comments
 (0)