Commit af39d387242d9e6bdf80041665fee9cd8c794800

Authored by André Araújo
1 parent bc03b22e
Exists in master

Adiciona funcões no Makefile

Showing 1 changed file with 159 additions and 40 deletions   Show diff stats
Makefile
  1 +BLEND = avatar_Hozana_wikiLibras.blend
1 2 BLENDER = blender
2   -PYTHON = python3
3   -DONE = [\33[30;32mOK\33[m]\n
4   -FAIL = [\33[30;31mERRO\33[m]\n
5   -MODULE = Wikilibras
6   -CLEAR = @echo -n "\033c"
7   -CACHE = __pycache__
8   -URL = git@git.lavid.ufpb.br:wikilibras-core
9   -MAIN = libras.py
  3 +BLUE = \33[34;5m
  4 +CACHE = ./__pycache__
10 5 CONTROLLER = controller.py
11   -AVATAR = avatar_Hozana_wikiLibras.blend
12   -JSON = '{"userId": 2,"rightHand": ["circular", "plano", "horario", 1, 2, 0, 50, 20], "leftHand":[], "facialExp": [6], "signName":"teste_circular"}'
  6 +CORE = git@git.lavid.ufpb.br:wikilibras-core
  7 +DONE = [$(GREEN)Finalizado$(NONE)]
  8 +FAIL = [$(RED)Falhou$(NONE)] Codigo: $$?
  9 +GREEN = \33[32;5m
  10 +JSON = '{"userId": 2, "rightHand": ["circular", "plano", "horario", 1, 2, 0, 50, 20], "leftHand":[], "facialExp": [6], "signName":"teste_circular"}'
  11 +MAIN = libras.py
  12 +MODULE = Wikilibras
  13 +NONE = \33[m
  14 +PYTHON = python3
  15 +RED = \33[31;5m
  16 +WHITE = \33[37;5m
13 17  
14   -default: py
  18 +__default__: py
  19 +
  20 +.clscr:
  21 + @echo -n "\033c"
15 22  
16 23 bpy:
17   - $(CLEAR)
18   - @echo Executando Blender ...
19   - @$(BLENDER) -b $(AVATAR) -P $(MAIN) $(JSON) && echo "$(DONE)" || { echo "$(FAIL)"; exit 1; }
20   -
21   -clean:
22   - $(CLEAR)
23   - @echo -n "Limpando..."
24   - @rm -rf $(CACHE) > /dev/null 2>&1 && echo " $(DONE)" || { echo " $(FAIL)"; exit 1; }
25   -
26   -gclone:
27   - $(CLEAR)
28   - @echo "Clonando repositorio @(URL) ..."
29   - @exit
30   -
31   -gconf:
32   - $(CLEAR)
33   - @git --help
34   - @echo "Configurando git ..."
35   - @exit
  24 + @echo "[$(GREEN)Executando$(NONE)]$(BLUE) $(BLENDER) -b "$(BLEND)" -P "$(MAIN)" JSON ...$(NONE)";\
  25 + $(BLENDER) -b "$(BLEND)" -P "$(MAIN)" $(JSON)\
  26 + && echo "$(DONE)" || { echo "$(FAIL)"; exit $$?; }
  27 +
  28 +clean: .clscr
  29 + @echo -n "$(WHITE)Limpando... $(NONE) ";\
  30 + rm -rf "$(CACHE)"\
  31 + && echo "$(DONE)" || { echo "$(FAIL)"; exit $$?; }
  32 +
  33 +git-clone:
  34 + @input="";\
  35 + while [ "$$input" != "s" ] && [ "$$input" != "n" ];\
  36 + do\
  37 + echo -n "$(GREEN)Clonar $(BLUE)$(CORE)?$(NONE) (s/n): ";\
  38 + read input;\
  39 + input="`echo $$input | tr [:upper:] [:lower:]`";\
  40 + done;\
  41 + if [ "$$input" = "s" ];\
  42 + then\
  43 + git clone $(CORE);\
  44 + else\
  45 + exit 0;\
  46 + fi\
  47 + && echo "$(DONE)" || { echo "$(FAIL)"; exit $$?; }
  48 +
  49 +git-config:
  50 + @echo -n "$(GREEN)Nome:$(BLUE) ";\
  51 + git config --global user.name;\
  52 + echo -n "$(GREEN)Email:$(BLUE) ";\
  53 + git config --global user.email;\
  54 + input="";\
  55 + while [ "$$input" != "s" ] && [ "$$input" != "n" ];\
  56 + do\
  57 + echo -n "$(GREEN)Configurar Git?$(NONE) (s/n): ";\
  58 + read input;\
  59 + input="`echo $$input | tr [:upper:] [:lower:]`";\
  60 + done;\
  61 + if [ "$$input" = "s" ];\
  62 + then\
  63 + name="";\
  64 + while [ -z "$$name" ];\
  65 + do\
  66 + echo -n "$(GREEN)Digite seu nome:$(NONE) ";\
  67 + read name;\
  68 + done;\
  69 + email="";\
  70 + while [ -z "$$email" ];\
  71 + do\
  72 + echo -n "$(GREEN)Digite seu email:$(NONE) ";\
  73 + read email;\
  74 + done;\
  75 + input="";\
  76 + while [ "$$input" != "s" ] && [ "$$input" != "n" ];\
  77 + do\
  78 + echo -n "$(GREEN)Confirma dados?$(NONE) (s/n): ";\
  79 + read input;\
  80 + input="`echo $$input | tr [:upper:] [:lower:]`";\
  81 + done;\
  82 + if [ "$$input" = "s" ];\
  83 + then\
  84 + git config --global user.name "$$name";\
  85 + git config --global user.email "$$email";\
  86 + git config --global color.diff auto;\
  87 + git config --global color.status auto;\
  88 + git config --global color.branch auto;\
  89 + git config --global color.ui true;\
  90 + git config --global push.default simple;\
  91 + else\
  92 + exit 0;\
  93 + fi;\
  94 + else\
  95 + exit 0;\
  96 + fi\
  97 + && echo "$(DONE)" || { echo "$(FAIL)"; exit $$?; }
  98 +
  99 +help:
  100 + @echo ""
  101 + @echo " $(WHITE) Make <args> $(NONE)"
  102 + @echo ""
  103 + @echo " $(GREEN) <args> $(NONE) $(BLUE) <funcao> $(NONE)"
  104 + @echo ""
  105 + @echo " $(GREEN) bpy $(NONE) $(BLUE) Executa: $(BLENDER) <$(MAIN)> com parametros JSON do Makefile $(NONE)"
  106 + @echo " $(GREEN) clean $(NONE) $(BLUE) Remove pasta(s) temporaria(s): $(CACHE) $(NONE)"
  107 + @echo " $(GREEN) git-clone $(NONE) $(BLUE) Clona repositorio: \"$(CORE)\" na pasta atual $(NONE)"
  108 + @echo " $(GREEN) git-config $(NONE) $(BLUE) Configura Git para o primeiro uso $(NONE)"
  109 + @echo " $(GREEN) help $(NONE) $(BLUE) Exibe ajuda $(NONE)"
  110 + @echo " $(GREEN) py $(NONE) $(BLUE) Executa: $(PYTHON) <$(CONTROLLER)> com parametros JSON do Makefile $(NONE)"
  111 + @echo " $(GREEN) recv $(NONE) $(BLUE) Recebe dados do repositorio: \"$(CORE)\" $(NONE)"
  112 + @echo " $(GREEN) send $(NONE) $(BLUE) Envia dados para o repositorio: \"$(CORE)\" $(NONE)"
  113 + @echo ""
36 114  
37 115 py:
38   - $(CLEAR)
39   - @echo Executando Python ...
40   - @$(PYTHON) $(CONTROLLER) $(JSON) && echo "$(DONE)" || { echo "$(FAIL)"; exit 1; }
  116 + @echo "[$(GREEN)Executando$(NONE)]$(BLUE) $(PYTHON) "$(CONTROLLER)" JSON ...$(NONE)";\
  117 + $(PYTHON) "$(CONTROLLER)" $(JSON)\
  118 + && echo "$(DONE)" || { echo "$(FAIL)"; exit $$?; }
41 119  
42 120 recv:
43   - $(CLEAR)
44   - @echo "Baixando atualizacao de @(URL)..."
45   - @exit
  121 + @input="";\
  122 + while [ "$$input" != "s" ] && [ "$$input" != "n" ];\
  123 + do\
  124 + echo -n "$(GREEN)Receber dados alterados?$(NONE) (s/n): ";\
  125 + read input;\
  126 + input="`echo $$input | tr [:upper:] [:lower:]`";\
  127 + done;\
  128 + if [ "$$input" = "s" ];\
  129 + then\
  130 + git pull;\
  131 + else\
  132 + exit 0;\
  133 + fi\
  134 + && echo "$(DONE)" || { echo "$(FAIL)"; exit $$?; }
46 135  
47 136 send:
48   - $(CLEAR)
49   - @echo "Baixando atualizacao do repositorio @(URL)..."
50   - @exit
51   - @git pull "$(DONE)" || { echo " $(FAIL)"; exit 1; }
  137 + @input="";\
  138 + while [ "$$input" != "s" ] && [ "$$input" != "n" ];\
  139 + do\
  140 + echo -n "$(GREEN)Enviar alteracoes realizadas?$(NONE) (s/n): ";\
  141 + read input;\
  142 + input="`echo $$input | tr [:upper:] [:lower:]`";\
  143 + done;\
  144 + if [ "$$input" = "s" ];\
  145 + then\
  146 + comment="";\
  147 + while [ -z "$$comment" ];\
  148 + do\
  149 + echo -n "$(GREEN)Digite o comentario das alteracoes:$(NONE) ";\
  150 + read comment;\
  151 + done;\
  152 + input="";\
  153 + while [ "$$input" != "s" ] && [ "$$input" != "n" ];\
  154 + do\
  155 + echo -n "$(GREEN)Enviar dados?$(NONE) (s/n): ";\
  156 + read input;\
  157 + input="`echo $$input | tr [:upper:] [:lower:]`";\
  158 + done;\
  159 + if [ "$$input" = "s" ];\
  160 + then\
  161 + git add .;\
  162 + git commit -m "$$comment";\
  163 + git push;\
  164 + else\
  165 + exit 0;\
  166 + fi;\
  167 + else\
  168 + exit 0;\
  169 + fi\
  170 + && echo "$(DONE)" || { echo "$(FAIL)"; exit $$?; }
... ...