-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Home
croaky edited this page Oct 31, 2014
·
4 revisions
Put your personal customizations in ~/.laptop.local
.
Write your customizations such that they can be run safely more than once.
brew_install_or_upgrade
, fancy_echo
and other functions from
mac
are available for use in ~/.laptop.local.
Below are some example functions written by the community.
git_clone_or_pull() {
local REPOSRC=$1
local LOCALREPO=$2
local LOCALREPO_VC_DIR=$LOCALREPO/.git
if [[ ! -d "$LOCALREPO_VC_DIR" ]]; then
git clone --recursive $REPOSRC $LOCALREPO
else
pushd $LOCALREPO
git pull $REPOSRC && git submodule update --init --recursive
popd
fi
}
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() {
if ! brew_cask_is_installed "$1"; then
brew cask install "$@"
fi
}
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
}
brew tap caskroom/cask
brew_install_or_upgrade 'brew-cask'
brew_cask_install_or_upgrade 'dropbox'
brew_cask_install 'google-chrome'
brew_cask_install_or_upgrade 'rdio'