Last active
October 5, 2018 13:19
-
-
Save gunesmes/767c89ceaa7fcfdcbdc00eb936addb0d to your computer and use it in GitHub Desktop.
convert calabash x-platform to generic calabash-android and calabash-ios project
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/bash | |
echo -e "\nConverting X-platform to generic Calabash folder" | |
FILE_PATH=$PWD | |
GENERIC_PATH=$PWD/../calabash-generic | |
if [[ -d $FILE_PATH/calabash-generic ]]; then | |
rm -rf $FILE_PATH/calabash-generic | |
fi | |
rm -rf $GENERIC_PATH 2>/dev/null | |
mkdir $GENERIC_PATH 2>/dev/null | |
EXCLUDE=('features' 'debug.keystore') | |
# EXCLUDE=('features' 'Gemfile' 'debug.keystore') | |
EXC_FILES=${#EXCLUDE[@]} | |
# rm -rf $FILE_PATH/calabash-generic/android/* 2>/dev/null | |
# rm -rf $FILE_PATH/calabash-generic/ios/* 2>/dev/null | |
function convert { | |
platform=$1 | |
echo -e "\n\n. . . working on $platform:\n" | |
mkdir $GENERIC_PATH/$platform 2>/dev/null | |
cp -r $FILE_PATH/* $GENERIC_PATH/$platform | |
FILES=$GENERIC_PATH/$platform/* | |
for f in $FILES; do | |
echo $f | |
delete=true | |
for (( i=0;i<$EXC_FILES;i++)); do | |
f_exc="$GENERIC_PATH/$platform/"${EXCLUDE[${i}]} | |
if [ $f == $f_exc ]; then | |
delete=false | |
break | |
fi | |
done | |
if [ "$delete" == true ]; then | |
echo -e "Removing unrelated files: $f" | |
rm -rf $f | |
fi | |
done | |
# remove other platform | |
if [ "$platform" == "android" ]; then | |
rm -rf $GENERIC_PATH/android/features/ios | |
else | |
rm -rf $GENERIC_PATH/ios/features/android | |
fi | |
mv $GENERIC_PATH/$platform/features/$platform/support $GENERIC_PATH/$platform/features/$platform/support_$platform | |
mv $GENERIC_PATH/$platform/features/$platform/* $GENERIC_PATH/$platform/features | |
rm -rf $GENERIC_PATH/$platform/features/$platform | |
echo -e "\n\n - Generic project created, now creating .zip files.\n" | |
} | |
convert "android" | |
convert "ios" | |
cd $GENERIC_PATH/android/features | |
zip -r $GENERIC_PATH/android.zip * | |
cd $GENERIC_PATH/ios/features | |
zip -r $GENERIC_PATH/ios.zip * | |
echo -e "\n\n- - - FINISHED - - -\nTo submit to calabash-generic go to following folders and run 'test-cloud submit prebuilt/Mor...' command\n - $GENERIC_PATH/ios\n - $GENERIC_PATH/android\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment