Skip to content

Commit 2e32ad8

Browse files
committed
feat(version-detection): support version_command for tools without PATH binaries
Problem: - ruby-build fails with "version unchanged" after successful git update - Installed as rbenv plugin at ~/.rbenv/plugins/ruby-build (not in PATH) - Detection only works for binaries found via which/PATH - github_clone installer updates git repo but version detection fails Changes: - Add version_command field to ruby-build catalog - Extracts version from git commit message - Command: cd ~/.rbenv/plugins/ruby-build && git log -1 --format='%s' | grep -oP 'ruby-build \\K[0-9]+' - Modify cli_audit/detection.py audit_tool_installation() - Check version_command independently when no binary path found - Add fallback version detection for non-PATH tools - Mark path as "<version_command>" for install_method tracking Resolution: - ruby-build: installed 20251023 === latest 20251023 - Version detection working for plugin-based github_clone tools - Upgrade warnings no longer trigger incorrectly Technical details: - version_command executed via shell when binary not in PATH - Supports git-based versioning, file parsing, custom commands - Catalog-driven: works for any tool with version_command field
1 parent ac664b2 commit 2e32ad8

3 files changed

Lines changed: 23 additions & 1004 deletions

File tree

catalog/ruby-build.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
"github_repo": "rbenv/ruby-build",
77
"binary_name": "ruby-build",
88
"clone_path": "~/.rbenv/plugins/ruby-build",
9-
"notes": "Installs as rbenv plugin. Requires rbenv to be installed first."
10-
,"guide": {
9+
"version_command": "cd ~/.rbenv/plugins/ruby-build && git log -1 --format='%s' | grep -oP 'ruby-build \\K[0-9]+'",
10+
"notes": "Installs as rbenv plugin. Requires rbenv to be installed first.",
11+
"guide": {
1112
"display_name": "ruby-build",
1213
"install_action": "install",
1314
"order": 31

cli_audit/detection.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,13 @@ def audit_tool_installation(
315315
num = extract_version_number(line)
316316
tuples.append((num, line, path))
317317

318+
# If no paths found but version_command exists, try standalone version detection
319+
if not tuples and version_command:
320+
line = get_version_line("", tool_name, version_flag, version_command)
321+
if line:
322+
num = extract_version_number(line)
323+
tuples.append((num, line, "<version_command>"))
324+
318325
if not tuples:
319326
return ("", "X", "", "")
320327

@@ -323,6 +330,11 @@ def audit_tool_installation(
323330
return ("", "X", "", "")
324331

325332
version_num, version_line, path = chosen
326-
install_method = detect_install_method(path, tool_name)
333+
334+
# Handle version_command detection (no physical path)
335+
if path == "<version_command>":
336+
install_method = "version_command"
337+
else:
338+
install_method = detect_install_method(path, tool_name)
327339

328340
return (version_num, version_line, path, install_method)

0 commit comments

Comments
 (0)