export PLUGIN_DIR=$PWD
export BASE_DIR=$PWD/../..
echo "Plugin dir is " $PLUGIN_DIR
echo "Plugin dir is " $BASE_DIR

if [ -e  ../../ios/Podfile ]
then
   echo “Podfile already exists. ignore copying”
else
   echo "Podfile doesn't exist, creating one now."
 cp scripts/Podfile ../../ios/Podfile
fi

# echo "Installing Pods"
# cp scripts/Podfile ../../ios/Podfile
# cd $BASE_DIR/ios
# export TARGET=$(basename *.xcodeproj .xcodeproj)
# echo "Target is "
# echo $TARGET
# sed -i "" "s/<TARGET>/$TARGET/g" Podfile
# pod install 
# cd $PLUGIN_DIR

if grep "include ':react-native-jsonstorebridge'" $BASE_DIR/android/settings.gradle
then
  echo "Skipping copying of internal dependencies"
else
  echo "Adding internal dependencies"
  cat scripts/bridge.settings >> $BASE_DIR/android/settings.gradle
fi

echo "React-Native IBM MFP JSONStore post installation complete"