fix: soft-fail brew bundle install; update .gitignore
lib/brew.sh: brew bundle exits non-zero when any single package fails (network error, cask version mismatch, missing tap, etc.). Previously this killed the entire ssr restore via set -euo pipefail before mackup / defaults / prefs had a chance to run. Capture the exit code, emit a clear warning, and continue. The user can rerun the manual command shown in the warning. .gitignore: Replace minimal gitignore with the comprehensive macOS + Cursor + VSCode template generated by toptal gitignore.io. Preserve the original ssr- specific custom rules (.local/, .config/, *.log, *.plist.local) in the custom section at the bottom. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -60,3 +60,11 @@ Temporary Items
|
|||||||
|
|
||||||
# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)
|
# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)
|
||||||
|
|
||||||
|
# ssr — user-local state and config (never commit)
|
||||||
|
.local/
|
||||||
|
.config/
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# User-rendered launchd plist (template lives in launchd/)
|
||||||
|
*.plist.local
|
||||||
|
|
||||||
|
|||||||
+12
-1
@@ -66,5 +66,16 @@ ssr::brew::restore() {
|
|||||||
local brewfile="$1"
|
local brewfile="$1"
|
||||||
[[ -f "$brewfile" ]] || ssr::die "Brewfile not found: $brewfile"
|
[[ -f "$brewfile" ]] || ssr::die "Brewfile not found: $brewfile"
|
||||||
ssr::log "brew bundle install ← $brewfile"
|
ssr::log "brew bundle install ← $brewfile"
|
||||||
brew bundle install --file="$brewfile" --verbose
|
# brew bundle exits non-zero when individual packages fail (network errors,
|
||||||
|
# missing tap, cask version mismatch, etc.). We soft-fail here so the rest
|
||||||
|
# of ssr restore (mackup, defaults, prefs) still runs. The user can rerun
|
||||||
|
# `brew bundle install --file="$brewfile"` manually for failed entries.
|
||||||
|
local rc=0
|
||||||
|
brew bundle install --file="$brewfile" --verbose || rc=$?
|
||||||
|
if [[ $rc -ne 0 ]]; then
|
||||||
|
ssr::warn "brew bundle install finished with errors (rc=$rc) — some packages were not installed."
|
||||||
|
ssr::warn "Rerun manually: brew bundle install --file=\"$brewfile\""
|
||||||
|
else
|
||||||
|
ssr::ok "brew bundle install completed successfully."
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user