#!/bin/bash
installRxSwift() {
isExist=false
read -r -d '' replaceString <<- EOM
\n pod 'RxSwift', '~> 4.0'\n pod 'RxCocoa', '~> 4.0'
EOM
fileRead () {
while IFS='' read -r line || [[ -n "$line" ]]; do
if [[ $line == *"RxSwift"* ]]; then
isExist=true
fi
done < "Podfile"
}
fileWrite () {
# sed -i 'a some text here' -e 's/pattern/g' Podfile
awk '1;/use_frameworks!/{ print var }' var="$replaceString" Podfile > testfile.tmp && mv testfile.tmp Podfile
}
fileRead
if $isExist ; then
echo "ERROR: it's exist"
else
fileWrite
echo 'Success'
fi
}
show_menu(){
NORMAL=`echo "\033[m"`
MENU=`echo "\033[36m"` #Blue
NUMBER=`echo "\033[33m"` #yellow
FGRED=`echo "\033[41m"`
RED_TEXT=`echo "\033[31m"`
ENTER_LINE=`echo "\033[33m"`
echo -e "${MENU}*********************************************${NORMAL}"
echo -e "${MENU}**${NUMBER} 1)${MENU} install pod ${NORMAL}"
echo -e "${MENU}**${NUMBER} 2)${MENU} install RxSwift in Podfile ${NORMAL}"
echo -e "${MENU}**${NUMBER} 3)${MENU} install Firebase/cor in Podfile ${NORMAL}"
# echo -e "${MENU}**${NUMBER} 4)${MENU} ssh Frost TomCat Server ${NORMAL}"
# echo -e "${MENU}**${NUMBER} 5)${MENU} ${NORMAL}"
echo -e "${MENU}*********************************************${NORMAL}"
echo -e "${ENTER_LINE}Please enter a menu option and enter or ${RED_TEXT}enter to exit. ${NORMAL}"
read opt
}
function option_picked() {
COLOR='\033[01;31m' # bold red
RESET='\033[00;00m' # normal white
MESSAGE=${@:-"${RESET}Error: No message passed"}
echo -e "${COLOR}${MESSAGE}${RESET}"
}
clear
show_menu
while [ opt != '' ]
do
if [[ $opt = "" ]]; then
exit;
else
case $opt in
1) clear;
option_picked "Option 1 Picked";
pod init
exit;
;;
2) clear;
option_picked "Option 2 Picked";
installRxSwift
exit;
;;
3) clear;
option_picked "Option 3 Picked";
# sudo service apache2 restart;
show_menu;
;;
4) clear;
option_picked "Option 4 Picked";
# ssh lmesser@ -p 2010;
show_menu;
;;
x)exit;
;;
\n)exit;
;;
*)clear;
option_picked "Pick an option from the menu";
show_menu;
;;
esac
fi
done
'Mobile App > iOS' 카테고리의 다른 글
Swift 4 - NSMutableAttributedString을 이용하여 Outline text 만들기 (0) | 2019.03.09 |
---|---|
Swift 4 - 폰트 체크하기, 폰트 적용하기 (0) | 2019.03.09 |
xcode 정리해서 용량 늘리기 (mac 용량 관리) (0) | 2019.02.27 |
RxSwift 정리 (0) | 2018.12.31 |
[RxSwift] 이메일 검사 기능 만들기 (0) | 2018.12.29 |