#!/bin/bash
pub_env=$1
dev_account=root
pro_account=houfeng

function pub_to_development() {
     git pull
     npm run build
     host=192.168.6.141
     ssh -p22 ${dev_account}@$host 'sudo su - root -c "cd /home/sinoservices/data/chainwork/wms-new-web/wms/;rm -rf *;"'
     scp -r `pwd`/dist/* ${dev_account}@$host:/home/sinoservices/data/chainwork/wms-new-web/wms/
 }

 function pub_to_uatdevelopment() {
      git pull
      npm run build
      host=192.168.7.226
      ssh -p22 ${dev_account}@$host 'sudo su - root -c "cd /home/sinoservices/data/chainwork/wms-new-web/wms/;rm -rf *;"'
      scp -r `pwd`/dist/* ${dev_account}@$host:/home/sinoservices/data/chainwork/netbee-web/wms/
  }

case $pub_env in
development)
    pub_to_development
    ;;
uatdevelopment)
    pub_to_uatdevelopment
    ;;
*)
    pub_to_development
    ;;
esac
