Created
August 7, 2019 03:24
-
-
Save levantAJ/e6b9b6cd40dad6f58f372b6d55cf2ab0 to your computer and use it in GitHub Desktop.
Run test coverage for iOS project by using slather
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if ! gem spec slather > /dev/null 2>&1; then | |
echo "Installing slather..." | |
sudo gem install slather | |
fi | |
if [ -e ~/.bashrc ] | |
then | |
string=$(<~/.bashrc) | |
if ! [[ $string == *"alias sbtest=\"bash scripts/test-coverage.sh\""* ]]; then | |
echo "Setting sbtest..." | |
echo "alias sbtest=\"bash scripts/test-coverage.sh\"" >> ~/.bashrc | |
cat ~/.bashrc | |
fi | |
else | |
echo "Setting sbtest..." | |
echo "alias sbtest=\"bash scripts/test-coverage.sh\"" > ~/.bashrc | |
cat ~/.bashrc | |
fi | |
source ~/.bashrc | |
echo "Clean DerivedData..." | |
rm -rf ~/Library/Developer/Xcode/DerivedData | |
echo "Testing..." | |
fastlane testciwildfire | |
echo "Generating test coverage..." | |
slather coverage --ignore Pods/\* --scheme ShopBack --workspace ShopBack.xcworkspace --html ShopBack.xcodeproj | |
# Open in browser | |
GREEN=`tput setaf 2` | |
if system_profiler SPApplicationsDataType | grep "Google Chrome" &>/dev/null; then | |
open -a "Google Chrome" './html/index.html' | |
echo "${GREEN}Opened result in Google Chrome!!!" | |
else | |
open -a "Safari" './html/index.html' | |
echo "Opened results in Safari!!!" | |
fi | |
bold=$(tput bold) | |
normal=$(tput sgr0) | |
echo "${GREEN}Now you can use ${bold}sbtest" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment