This repository has been archived by the owner on Jul 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 60
/
converter.sh
69 lines (52 loc) · 1.91 KB
/
converter.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env bash
echo -e "\nConverting X-platform to generic Calabash folder"
FILE_PATH=$PWD
mkdir $PWD/../calabash-generic 2>/dev/null
cd $PWD/../calabash-generic || { echo 'Could not CD to generic path' ; exit 1; }
GENERIC_PATH=$PWD
cd ${FILE_PATH}
rm -rf ${GENERIC_PATH}/* 2>/dev/null
INCLUDE=('features')
# INCLUDE=('features' 'Gemfile' 'debug.keystore')
EXC_FILES=${#INCLUDE[@]}
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
delete=true
for (( i=0;i<$EXC_FILES;i++)); do
f_exc="${GENERIC_PATH}/$platform/"${INCLUDE[${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/support/
rm -rf ${GENERIC_PATH}/$platform/features/$platform/support
mv ${GENERIC_PATH}/$platform/features/$platform/* ${GENERIC_PATH}/$platform/features
rm -rf ${GENERIC_PATH}/$platform/features/$platform
}
convert "android"
convert "ios"
echo -e "\n\n - Generic project created, now creating .zip files.\n"
cd ${GENERIC_PATH}/android
ditto -c -k --rsrc --sequesterRsrc . ${GENERIC_PATH}/android.zip
cd ${GENERIC_PATH}/ios
ditto -c -k --rsrc --sequesterRsrc . ${GENERIC_PATH}/ios.zip
tput setaf 2; echo -e "\n\n - - - FINISHED - - -\nTo submit to the project to Device Farm go to LINK and submit one of the .zip file:"
tput setaf 1; echo -e "\nLINK: https://signin.aws.amazon.com/console"
tput setaf 4; echo -e " - ${GENERIC_PATH}/ios.zip\n - ${GENERIC_PATH}/android.zip\n\n"