Skip to content

Instantly share code, notes, and snippets.

@ushkinaz
Created April 5, 2012 16:04
Show Gist options
  • Save ushkinaz/2312184 to your computer and use it in GitHub Desktop.
Save ushkinaz/2312184 to your computer and use it in GitHub Desktop.
Как найти проперти, что отсутствуют в local, но есть в dev
#!/bin/bash
# usage:
# validate-properties [env1] [env2]
#
if [[ "$1" == "" ]]; then
env1="d"
else
env1=$1
fi
if [[ "$2" == "" ]]; then
env2="local"
else
env2=$2
fi
echo $env1 $env2
for app in abra gamayun krabby simurgh swinub watchdog yandex.ws zubat psyduck
do
for prop_file in ./${app}/src/main/config/${env1}/*.properties
do
# Ignore heartbeat since it's not mandatory
if [[ "${prop_file}" == *heartbeat* ]]
then
continue
fi
local_file=$(echo "${prop_file}" | sed s/\\/${env1}\\//\\/${env2}\\//)
count_dev=$(grep -v '^#' ${prop_file} | grep '=' | wc -l)
count_local=$(grep -v '^#' ${local_file} | grep '=' | wc -l)
if [ ${count_dev} -ne ${count_local} ]; then
echo
echo "Found differences"
echo " ${prop_file} : ${count_dev}"
echo " ${local_file} : ${count_local}"
# meld ${prop_file} ${local_file} &
fi
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment