Skip to content

Instantly share code, notes, and snippets.

@cnsoft
Forked from MattiSG/brewv
Created January 17, 2014 06:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cnsoft/8469067 to your computer and use it in GitHub Desktop.
Save cnsoft/8469067 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# Installs the previous version of a Homebrew formula
#
# Usage: brewv formula_name desired_version
#
# Based on http://stackoverflow.com/questions/3987683/homebrew-install-specific-version-of-formula#9832084
#
# Author: Matti Schneider <hi@mattischneider.fr> (http://mattischneider.fr)
versions=$(brew versions $1)
result=$(echo "$versions" | grep -m 1 $2) #-m 1 to stop as soon as possible
if [[ $? = 0 ]]
then
commit=$(echo $result | cut -d ' ' -f 4)
formula=$(echo $result | cut -d ' ' -f 5)
cd /usr/local
if [[ -e $formula ]]
then brew unlink $1 # will fail if not already installed, hence the check above
fi
git checkout $commit $formula &&
brew install $1 &&
git reset HEAD $formula &&
git checkout -- $formula
cd - > /dev/null
echo "$1 $2 installed."
echo "You can now switch versions with 'brew switch $1 <version>'"
else
echo "$versions"
echo
echo "No version matching '$2' for '$1'"
echo "Available versions have been printed above"
exit 1
fi
@cnsoft
Copy link
Author

cnsoft commented Jan 17, 2014

Solution

Download this gist by Matti Schneider and check it into your repository.
(Note: you might need to make it executable: chmod +x brewv.)

In .travis.yml, include:
script:

  • ./brewv xctool 0.1.7
  • brew switch xctool 0.1.7
  • xctool test -workspace YourWorkspace.xcworkspace -scheme YourTestScheme -sdk iphonesimulator7.0
    This will switch to an older version of xctool that is capable of running your test suite.

Keep on testing!
from https://coderwall.com/p/0gnk1a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment