Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

execute setup.sh -u if there is a need to #4870

Merged
merged 3 commits into from
Aug 29, 2016
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 18 additions & 17 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,39 @@ pokebotpath=$(cd "$(dirname "$0")"; pwd)
auth=""
config=""
if [ ! -z $1 ]; then
auth=$1
auth=$1
else
auth="./configs/auth.json"
auth="./configs/auth.json"
fi
if [ ! -z $2 ]; then
config=$2
config=$2
else
config="./configs/config.json"
config="./configs/config.json"
fi
cd $pokebotpath
source bin/activate
git fetch -a
if [ "1" == $(git branch -vv |grep -c "* dev") ] && [ $(git log --pretty=format:"%h" -1) != $(git log --pretty=format:"%h" -1 origin/dev) ]
if [ "1" == $(git branch -vv |grep -c "* dev") ] && [ $(git log --pretty=format:"%h" -1) != $(git log --pretty=format:"%h" -1 origin/dev) ] ||
[ "1" == $(git branch -vv |grep -c "* master") ] && [ $(git log --pretty=format:"%h" -1) != $(git log --pretty=format:"%h" -1 origin/master) ]
then
echo "Branch dev have an update. Run ./setup.sh -u to update."
sleep 2
elif [ "1" == $(git branch -vv |grep -c "* master") ] && [ $(git log --pretty=format:"%h" -1) != $(git log --pretty=format:"%h" -1 origin/master) ]
then
echo "Branch master have an update. Run ./setup.sh -u to update."
sleep 2
read -p "Branch have an update. Run ./setup.sh -u to update? y/n
Copy link
Contributor

@mjmadsen mjmadsen Aug 29, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

has* (know it was in original) but then yes!

or This branch has been updated.

I know this is nit picking, but as long as we spot it, might as well as make it better, right?

EDIT: You are running and out-dated version of your branch.

" do_setup
if [[ $do_setup = "y" || $do_setup = "Y" ]];
then
./setup.sh -u
fi
fi
if [ ! -f "$auth" ]; then
echo "There's no auth file. Please use ./setup.sh -a to create one"
echo "There's no auth file. Please use ./setup.sh -a to create one"
fi
if [ ! -f "$config" ]; then
echo "There's no config file. Please use ./setup.sh -c to create one."
echo "There's no config file. Please use ./setup.sh -c to create one."
fi
while true
do
python pokecli.py -af $auth -cf $config
echo `date`" Pokebot "$*" Stopped."
read -p "Press any button or wait 20 seconds to continue.
" -r -s -n1 -t 20
python pokecli.py -af $auth -cf $config
echo `date`" Pokebot "$*" Stopped."
read -p "Press any button or wait 20 seconds to continue.
" -r -s -n1 -t 20
done
exit 0