Skip to content

Commit a0074e8

Browse files
committed
get macos setup/doctor to work
1 parent 0891118 commit a0074e8

File tree

2 files changed

+47
-4
lines changed

2 files changed

+47
-4
lines changed

lib/mise_doctor.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ fi
2424
fmt_header "Ruby (via mise)"
2525

2626
if cmd_exists mise; then
27-
if mise which ruby > /dev/null 2>&1; then
27+
ruby_path="$(mise which ruby 2>/dev/null)"
28+
if [[ -n "$ruby_path" && -x "$ruby_path" ]]; then
2829
check_pass "Ruby is available via mise"
29-
ruby_version="$(mise exec -- ruby --version 2>&1)"
30+
ruby_version="$("$ruby_path" --version 2>&1)"
3031
if [[ "$ruby_version" == *"ruby"* ]]; then
3132
check_pass "Ruby executes and reports version: $ruby_version"
3233
else
@@ -46,9 +47,10 @@ fi
4647
fmt_header "Node.js (via mise)"
4748

4849
if cmd_exists mise; then
49-
if mise which node > /dev/null 2>&1; then
50+
node_path="$(mise which node 2>/dev/null)"
51+
if [[ -n "$node_path" && -x "$node_path" ]]; then
5052
check_pass "Node.js is available via mise"
51-
node_version="$(mise exec -- node --version 2>&1)"
53+
node_version="$("$node_path" --version 2>&1)"
5254
if [[ "$node_version" == v* ]]; then
5355
check_pass "Node.js executes and reports version: $node_version"
5456
else
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
#
3+
# Clean up legacy full-URL bundler credential keys.
4+
#
5+
# Older setups (or manual configuration) stored GitHub Packages credentials
6+
# using the full-URL format:
7+
# BUNDLE_HTTPS://RUBYGEMS__PKG__GITHUB__COM/TRUSTED/
8+
#
9+
# setup.sh now uses the host-only format (rubygems.pkg.github.com), which is
10+
# broader in scope and matches Bundler's documented convention. Both formats
11+
# work, but having the legacy key lingering causes inconsistency across
12+
# machines and confuses doctor.sh checks.
13+
#
14+
# This migration removes legacy full-URL keys. The correct host-only keys
15+
# are set by registries_setup.sh, which runs before migrations.
16+
17+
BUNDLE_CONFIG="$HOME/.bundle/config"
18+
19+
if [ ! -f "$BUNDLE_CONFIG" ]; then
20+
echo " No ~/.bundle/config found — nothing to clean up."
21+
exit 0
22+
fi
23+
24+
# Remove legacy full-URL GitHub Packages credential
25+
if grep -q 'BUNDLE_HTTPS://RUBYGEMS__PKG__GITHUB__COM' "$BUNDLE_CONFIG" 2>/dev/null; then
26+
bundle config unset --global "https://rubygems.pkg.github.com/trusted/" > /dev/null 2>&1
27+
echo " Removed legacy key: https://rubygems.pkg.github.com/trusted/"
28+
else
29+
echo " No legacy GitHub Packages key found — skipping."
30+
fi
31+
32+
# Remove stray BUNDLE_GET entry (likely a misconfigured credential)
33+
if grep -q '^BUNDLE_GET:' "$BUNDLE_CONFIG" 2>/dev/null; then
34+
# bundle config doesn't support unsetting arbitrary keys cleanly,
35+
# so we remove the line directly.
36+
sed -i.bak '/^BUNDLE_GET:/d' "$BUNDLE_CONFIG"
37+
rm -f "${BUNDLE_CONFIG}.bak"
38+
echo " Removed stray BUNDLE_GET entry."
39+
else
40+
echo " No stray BUNDLE_GET entry — skipping."
41+
fi

0 commit comments

Comments
 (0)