#!/bin/bash
#./module-local.sh backup users fileRevision filesync devices paraview report pms support myshare fileshare amazon ah migrationtool
echo " "
echo "Copy Modules to Application"
echo "#############################"
echo " "

echo " "
echo "---------------------"
echo "Fetching Modules : $*"
echo "---------------------"
echo " "

for m in $*
do
	if [[ "$m" == *backup* ]];then
		cp ./modules/backup/controllers/* ./application/controllers
		cp ./modules/backup/models/* ./application/models
		cp -r ./modules/backup/views/* ./application/views
		echo "$m - Module Added To Portal"
	fi

	if [[ "$m" == *users* ]];then
		cp ./modules/users/controllers/* ./application/controllers
		cp ./modules/users/models/* ./application/models
		cp -r ./modules/users/views/* ./application/views
		echo "$m - Module Added To Portal"
	fi

	if [[ "$m" == *fileRevision* ]];then
		cp ./modules/fileRevision/controllers/* ./application/controllers
		cp ./modules/fileRevision/models/* ./application/models
		cp -r ./modules/fileRevision/views/* ./application/views
		echo "$m - Module Added To Portal"
	fi

	if [[ "$m" == *filesync* ]];then
		cp ./modules/filesync/controllers/* ./application/controllers
		cp ./modules/filesync/models/* ./application/models
		cp -r ./modules/filesync/views/* ./application/views
		echo "$m - Module Added To Portal"
	fi

	if [[ "$m" == *devices* ]];then
		cp ./modules/devices/controllers/* ./application/controllers
		cp ./modules/devices/models/* ./application/models
		cp -r ./modules/devices/views/* ./application/views
		echo "$m - Module Added To Portal"
	fi

	if [[ "$m" == *paraview* ]];then
		cp ./modules/paraview/controllers/* ./application/controllers
		cp ./modules/paraview/models/* ./application/models
		cp -r ./modules/paraview/views/* ./application/views
		echo "$m - Module Added To Portal"
	fi
	if [[ "$m" == *report* ]];then
		cp ./modules/report/controllers/* ./application/controllers
		cp ./modules/report/models/* ./application/models
		cp -r ./modules/report/views/* ./application/views
		echo "$m - Module Added To Portal"
	fi

	if [[ "$m" == *pms* ]];then
		cp ./modules/pms/controllers/* ./application/controllers
		cp ./modules/pms/models/* ./application/models
		cp -r ./modules/pms/views/* ./application/views
		echo "$m - Module Added To Portal"
	fi

	if [[ "$m" == *support* ]];then
		cp ./modules/support/controllers/* ./application/controllers
		cp ./modules/support/models/* ./application/models
		cp -r ./modules/support/views/* ./application/views
		echo "$m - Module Added To Portal"
	fi

	if [[ "$m" == *myshare* ]];then
		cp ./modules/myshare/controllers/* ./application/controllers
		cp ./modules/myshare/models/* ./application/models
		cp -r ./modules/myshare/views/* ./application/views
		echo "$m - Module Added To Portal"
	fi

	if [[ "$m" == *fileshare* ]];then
		cp ./modules/fileshare/controllers/* ./application/controllers
		cp ./modules/fileshare/models/* ./application/models
		cp -r ./modules/fileshare/views/* ./application/views
		echo "$m - Module Added To Portal"
	fi

	if [[ "$m" == *amazon* ]];then
		cp ./modules/amazon/controllers/* ./application/controllers
		cp ./modules/amazon/models/* ./application/models
		cp -r ./modules/amazon/views/* ./application/views
		echo "$m - Module Added To Portal"
	fi

	if [[ "$m" == *ah* ]];then
		cp ./modules/ah/controllers/* ./application/controllers
		cp ./modules/ah/models/* ./application/models
		cp -r ./modules/ah/views/* ./application/views
		echo "$m - Module Added To Portal"
	fi

	if [[ "$m" == *migrationtool* ]];then
		cp ./modules/migrationtool/controllers/* ./application/controllers
		cp ./modules/migrationtool/models/* ./application/models
		cp -r ./modules/migrationtool/views/* ./application/views
		echo "$m - Module Added To Portal"
	fi

done

echo " "
echo "---------------------"
echo "Finished"
echo "---------------------"
echo " "
echo "Now you can delete this shell script"
echo " "