Merge pull request #16263 from jawshooah/travis-brew-install

Travis: add helpers for brew install and upgrade
This commit is contained in:
Josh Hagins 2016-01-01 17:36:30 -05:00
commit 23c2e092a5
2 changed files with 20 additions and 2 deletions

View File

@ -29,6 +29,24 @@ header () {
echo
}
brew_install () {
local pkg=$1
# if pkg is already installed, upgrade it
if brew list -1 | grep -q "^${pkg}\$"; then
brew_upgrade "$pkg"
else
run brew install "$pkg"
fi
}
brew_upgrade () {
local pkg=$1
if ! brew outdated "$pkg"; then
# allow upgrade to fail since we don't strictly need it
run brew upgrade "$pkg" || true
fi
}
# disallow unbound variables during build step
enter_build_step () {
set -o nounset

View File

@ -13,8 +13,8 @@ enter_build_step
header 'Running install.sh...'
# install Formulae and Casks without which some tests would be skipped
run brew install cabextract
run brew install unar
brew_install cabextract
brew_install unar
run brew cask install Casks/adobe-air.rb
# install bundler and project dependencies in $GEM_HOME