diff --git a/Makefile b/Makefile index dad0ed5..8034125 100644 --- a/Makefile +++ b/Makefile @@ -1,51 +1,170 @@ +BLEND = avatar_Hozana_wikiLibras.blend BLENDER = blender -PYTHON = python3 -DONE = [\33[30;32mOK\33[m]\n -FAIL = [\33[30;31mERRO\33[m]\n -MODULE = Wikilibras -CLEAR = @echo -n "\033c" -CACHE = __pycache__ -URL = git@git.lavid.ufpb.br:wikilibras-core -MAIN = libras.py +BLUE = \33[34;5m +CACHE = ./__pycache__ CONTROLLER = controller.py -AVATAR = avatar_Hozana_wikiLibras.blend -JSON = '{"userId": 2,"rightHand": ["circular", "plano", "horario", 1, 2, 0, 50, 20], "leftHand":[], "facialExp": [6], "signName":"teste_circular"}' +CORE = git@git.lavid.ufpb.br:wikilibras-core +DONE = [$(GREEN)Finalizado$(NONE)] +FAIL = [$(RED)Falhou$(NONE)] Codigo: $$? +GREEN = \33[32;5m +JSON = '{"userId": 2, "rightHand": ["circular", "plano", "horario", 1, 2, 0, 50, 20], "leftHand":[], "facialExp": [6], "signName":"teste_circular"}' +MAIN = libras.py +MODULE = Wikilibras +NONE = \33[m +PYTHON = python3 +RED = \33[31;5m +WHITE = \33[37;5m -default: py +__default__: py + +.clscr: + @echo -n "\033c" bpy: - $(CLEAR) - @echo Executando Blender ... - @$(BLENDER) -b $(AVATAR) -P $(MAIN) $(JSON) && echo "$(DONE)" || { echo "$(FAIL)"; exit 1; } - -clean: - $(CLEAR) - @echo -n "Limpando..." - @rm -rf $(CACHE) > /dev/null 2>&1 && echo " $(DONE)" || { echo " $(FAIL)"; exit 1; } - -gclone: - $(CLEAR) - @echo "Clonando repositorio @(URL) ..." - @exit - -gconf: - $(CLEAR) - @git --help - @echo "Configurando git ..." - @exit + @echo "[$(GREEN)Executando$(NONE)]$(BLUE) $(BLENDER) -b "$(BLEND)" -P "$(MAIN)" JSON ...$(NONE)";\ + $(BLENDER) -b "$(BLEND)" -P "$(MAIN)" $(JSON)\ + && echo "$(DONE)" || { echo "$(FAIL)"; exit $$?; } + +clean: .clscr + @echo -n "$(WHITE)Limpando... $(NONE) ";\ + rm -rf "$(CACHE)"\ + && echo "$(DONE)" || { echo "$(FAIL)"; exit $$?; } + +git-clone: + @input="";\ + while [ "$$input" != "s" ] && [ "$$input" != "n" ];\ + do\ + echo -n "$(GREEN)Clonar $(BLUE)$(CORE)?$(NONE) (s/n): ";\ + read input;\ + input="`echo $$input | tr [:upper:] [:lower:]`";\ + done;\ + if [ "$$input" = "s" ];\ + then\ + git clone $(CORE);\ + else\ + exit 0;\ + fi\ + && echo "$(DONE)" || { echo "$(FAIL)"; exit $$?; } + +git-config: + @echo -n "$(GREEN)Nome:$(BLUE) ";\ + git config --global user.name;\ + echo -n "$(GREEN)Email:$(BLUE) ";\ + git config --global user.email;\ + input="";\ + while [ "$$input" != "s" ] && [ "$$input" != "n" ];\ + do\ + echo -n "$(GREEN)Configurar Git?$(NONE) (s/n): ";\ + read input;\ + input="`echo $$input | tr [:upper:] [:lower:]`";\ + done;\ + if [ "$$input" = "s" ];\ + then\ + name="";\ + while [ -z "$$name" ];\ + do\ + echo -n "$(GREEN)Digite seu nome:$(NONE) ";\ + read name;\ + done;\ + email="";\ + while [ -z "$$email" ];\ + do\ + echo -n "$(GREEN)Digite seu email:$(NONE) ";\ + read email;\ + done;\ + input="";\ + while [ "$$input" != "s" ] && [ "$$input" != "n" ];\ + do\ + echo -n "$(GREEN)Confirma dados?$(NONE) (s/n): ";\ + read input;\ + input="`echo $$input | tr [:upper:] [:lower:]`";\ + done;\ + if [ "$$input" = "s" ];\ + then\ + git config --global user.name "$$name";\ + git config --global user.email "$$email";\ + git config --global color.diff auto;\ + git config --global color.status auto;\ + git config --global color.branch auto;\ + git config --global color.ui true;\ + git config --global push.default simple;\ + else\ + exit 0;\ + fi;\ + else\ + exit 0;\ + fi\ + && echo "$(DONE)" || { echo "$(FAIL)"; exit $$?; } + +help: + @echo "" + @echo " $(WHITE) Make $(NONE)" + @echo "" + @echo " $(GREEN) $(NONE) $(BLUE) $(NONE)" + @echo "" + @echo " $(GREEN) bpy $(NONE) $(BLUE) Executa: $(BLENDER) <$(MAIN)> com parametros JSON do Makefile $(NONE)" + @echo " $(GREEN) clean $(NONE) $(BLUE) Remove pasta(s) temporaria(s): $(CACHE) $(NONE)" + @echo " $(GREEN) git-clone $(NONE) $(BLUE) Clona repositorio: \"$(CORE)\" na pasta atual $(NONE)" + @echo " $(GREEN) git-config $(NONE) $(BLUE) Configura Git para o primeiro uso $(NONE)" + @echo " $(GREEN) help $(NONE) $(BLUE) Exibe ajuda $(NONE)" + @echo " $(GREEN) py $(NONE) $(BLUE) Executa: $(PYTHON) <$(CONTROLLER)> com parametros JSON do Makefile $(NONE)" + @echo " $(GREEN) recv $(NONE) $(BLUE) Recebe dados do repositorio: \"$(CORE)\" $(NONE)" + @echo " $(GREEN) send $(NONE) $(BLUE) Envia dados para o repositorio: \"$(CORE)\" $(NONE)" + @echo "" py: - $(CLEAR) - @echo Executando Python ... - @$(PYTHON) $(CONTROLLER) $(JSON) && echo "$(DONE)" || { echo "$(FAIL)"; exit 1; } + @echo "[$(GREEN)Executando$(NONE)]$(BLUE) $(PYTHON) "$(CONTROLLER)" JSON ...$(NONE)";\ + $(PYTHON) "$(CONTROLLER)" $(JSON)\ + && echo "$(DONE)" || { echo "$(FAIL)"; exit $$?; } recv: - $(CLEAR) - @echo "Baixando atualizacao de @(URL)..." - @exit + @input="";\ + while [ "$$input" != "s" ] && [ "$$input" != "n" ];\ + do\ + echo -n "$(GREEN)Receber dados alterados?$(NONE) (s/n): ";\ + read input;\ + input="`echo $$input | tr [:upper:] [:lower:]`";\ + done;\ + if [ "$$input" = "s" ];\ + then\ + git pull;\ + else\ + exit 0;\ + fi\ + && echo "$(DONE)" || { echo "$(FAIL)"; exit $$?; } send: - $(CLEAR) - @echo "Baixando atualizacao do repositorio @(URL)..." - @exit - @git pull "$(DONE)" || { echo " $(FAIL)"; exit 1; } + @input="";\ + while [ "$$input" != "s" ] && [ "$$input" != "n" ];\ + do\ + echo -n "$(GREEN)Enviar alteracoes realizadas?$(NONE) (s/n): ";\ + read input;\ + input="`echo $$input | tr [:upper:] [:lower:]`";\ + done;\ + if [ "$$input" = "s" ];\ + then\ + comment="";\ + while [ -z "$$comment" ];\ + do\ + echo -n "$(GREEN)Digite o comentario das alteracoes:$(NONE) ";\ + read comment;\ + done;\ + input="";\ + while [ "$$input" != "s" ] && [ "$$input" != "n" ];\ + do\ + echo -n "$(GREEN)Enviar dados?$(NONE) (s/n): ";\ + read input;\ + input="`echo $$input | tr [:upper:] [:lower:]`";\ + done;\ + if [ "$$input" = "s" ];\ + then\ + git add .;\ + git commit -m "$$comment";\ + git push;\ + else\ + exit 0;\ + fi;\ + else\ + exit 0;\ + fi\ + && echo "$(DONE)" || { echo "$(FAIL)"; exit $$?; } -- libgit2 0.21.2