-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Maintain idempotency in ~/.laptop.local when using Homebrew #279
Comments
To the more osx-y questions, I'll let others help you out. |
@AlJohri There's not a lot of great, built-in support for Homebrew/homebrew-cask#4678 I've subscribed to those issues. If they get merged, I'll try to add a |
Thanks for the responses! I didn't realize I could use the functions in @croaky, it seems The regular output of "Cask is already installed" is quite jarring. |
This is kind of what I meant: https://github.com/AlJohri/dotfiles/blob/master/setup-homebrew.sh#L12 brew_cask_expand_alias() {
brew cask info "$1" 2>/dev/null | head -1 | awk '{gsub(/:/, ""); print $1}'
}
brew_cask_is_installed() {
local NAME=$(brew_cask_expand_alias "$1")
brew cask list -1 | grep -Fqx "$NAME"
}
brew_cask_install_or_upgrade() {
if brew_cask_is_installed "$1"; then
echo "$1 is already installed, brew cask upgrade is not yet implemented"
else
brew cask install "$@"
fi
} I know you currently don't |
Thanks for the code, @AlJohri. Others have been circling around similar ideas in other pull requests. We just created a wiki page that contains a few community extensions: https://github.com/thoughtbot/laptop/wiki Feel free to add further customizations you think might be valuable to others. |
I understand a lot of emphasis has been given to keep laptop idempotent (https://github.com/thoughtbot/laptop/search?q=idempotency&type=Issues). I was wondering if you have any ideas on how to maintain idempotency in one's personal ~/.laptop.local script.
Particularly, I would like to be able to use the functions written here, https://github.com/thoughtbot/laptop/blob/master/mac-components/mac-functions, within my local script.
My main issue is that when my script attempts to install homebrew packages I get warnings that they are already installed as opposed to simply upgrading them.
In addition, it would lovely if brew_install_or_upgrade could be accompanied with a brew_cask_install_or_upgrade. I understand considerable thought has been given to the implications of supporting brew cask:
but at the very least, supporting it as a function usable via ~/.laptop.local would allow for an extremely clean and readable configuration file.
Do you know any easy ways of accessing the mac-functions within ~/.laptop.local?
What are your thoughts on supporting brew-cask in this non-invasive / easy-to-maintain manner?
The text was updated successfully, but these errors were encountered: