alichtman / shallow-backup

Git-integrated backup tool for macOS and Linux devs.
MIT License
1.22k stars 248 forks source link

fix: dump all packages installed by brew #313

Closed nperez0111 closed 1 year ago

nperez0111 commented 2 years ago

By default, brew will only list brew taps, casks & bottles. This PR makes it so that anything that brew supports to install such as mas and whalebrew dependencies to be listed & installed too. This will now include MAS installed applications

alichtman commented 2 years ago

Hey Nick, thanks for the PR! Is it possible to test this with CI / pytest? Seems like a reasonable change at face value, but I don't know for sure if it works (haven't tested myself).

nperez0111 commented 2 years ago

Sorry @alichtman, I don't really have much experience with Python...

I don't see any tests for the integration with brew from my quick look about the repo. But to give you confidence about this change, you'll see in the docs for brew bundle here under a section titled brew bundle exec command

--file: Read the Brewfile from this location. Use --file=- to pipe to stdin/stdout. --global: Read the Brewfile from ~/.Brewfile. -v, --verbose: install prints output from commands as they are run. check lists all missing dependencies. --no-upgrade: install won’t run brew upgrade on outdated dependencies. Note they may still be upgraded by brew install if needed. -f, --force: dump overwrites an existing Brewfile. cleanup actually performs its cleanup operations. --cleanup: install performs cleanup operation, same as running cleanup --force. --no-lock: install won’t output a Brewfile.lock.json. --all: list all dependencies. --formula: list Homebrew dependencies. --cask: list Homebrew Cask dependencies. --tap: list tap dependencies. --mas: list Mac App Store dependencies. --whalebrew: list Whalebrew dependencies. --describe: dump adds a description comment above each line, unless the dependency does not have a description. --no-restart: dump does not add restart_service to formula lines. --zap: cleanup casks using the zap command instead of uninstall.

I've bolded the --all option that I've included in this PR.

In researching though it looks like this is supposed to be default behavior by brew but some users are reporting issues with it (I seem to be one of them) https://github.com/Homebrew/homebrew-bundle/issues/1112

So maybe on second thought this might just be resolved by homebrew themselves, let's hold off and I'll close this if they do end up resolving

alichtman commented 1 year ago

Seems like a homebrew change resolved this. Closing.