Skip to content

Commit

Permalink
atualizando dependências #184 e #183
Browse files Browse the repository at this point in the history
  • Loading branch information
cauachagas committed Jun 15, 2020
1 parent 9cad2a3 commit 472ed7d
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 12 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- bin/instalador.sh -dp
before_script:
- pandoc -v
- git clone https://github.com/abntex/trabalho-academico-limarka.git modelo-oficial
- git clone --depth=1 https://github.com/abntex/trabalho-academico-limarka.git modelo-oficial
script:
- bundle exec rake spec:ruby
- bundle exec rake cucumber:ruby
Expand All @@ -26,14 +26,14 @@ jobs:
- $HOME/.TinyTeX
before_install:
- sudo apt-get update -qq
- export PATH=$PATH:~/.TinyTeX2/bin/x86_64-linux
- export PATH=$PATH:~/.TinyTeX/bin/x86_64-linux
- bin/instalador.sh -dptc
before_script:
- latexmk -v
- xelatex -v
- pdftotext -v
- pandoc -v
- git clone https://github.com/abntex/trabalho-academico-limarka.git modelo-oficial
- git clone --depth=1 https://github.com/abntex/trabalho-academico-limarka.git modelo-oficial
script:
- bundle exec rspec spec/dependencias/latex_spec.rb
- bundle exec rspec spec/simples_spec.rb
Expand Down
30 changes: 23 additions & 7 deletions bin/instalador.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,21 @@ done
if [ "$codename" = "bionic" ]; then

if [ -n "$dependencias" ]; then
$dry sudo apt-get install -y -qq \
$dry sudo apt-get install -y -qq --no-install-recommends \
language-pack-pt \
locales \
pdfgrep \
poppler-utils \
ruby-full \
ruby-bundler \
ruby-json \
ruby-ffi \
libffi-dev \
unzip \
xclip
xclip \
wget \
perl \
luajit \
python
fi

if [ -n "$tex" ]; then
Expand All @@ -80,33 +87,42 @@ if [ "$codename" = "bionic" ]; then
abntex2 \
babel-portuges \
bookmark \
caption \
enumitem \
epstopdf-pkg \
ifetex \
lastpage \
lipsum \
listings \
ltcaption \
memoir \
microtype \
pdflscape \
pdfpages \
psnfss \
shipunov \
texliveonfly \
textcase \
xcolor

tlmgr option -- autobackup 0
else
$dry wget -qO- "https://yihui.name/gh/tinytex/tools/install-unx.sh" \| sh
$dry tlmgr install abntex2 \
$dry tlmgr install \
abntex2 \
babel-portuges \
bookmark \
caption \
enumitem \
ifetex \
epstopdf-pkg \
lastpage \
lipsum \
listings \
memoir \
microtype \
pdflscape \
pdfpages \
psnfss \
shipunov \
texliveonfly \
textcase \
xcolor
$dry tlmgr option -- autobackup 0
Expand Down
11 changes: 9 additions & 2 deletions bin/instaladores/tinytex_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,23 @@ if [ $tex_em_cache -eq 1 ]; then
: #echo TinyTeX não será instalado.
else
wget -qO- "https://yihui.name/gh/tinytex/tools/install-unx.sh" | sh
tlmgr install abntex2 \
tlmgr install \
abntex2 \
babel-portuges \
bookmark \
caption \
enumitem \
ifetex \
epstopdf-pkg \
lastpage \
lipsum \
listings \
memoir \
microtype \
pdflscape \
pdfpages \
psnfss \
shipunov \
texliveonfly \
textcase \
xcolor
tlmgr option -- autobackup 0
Expand Down
3 changes: 3 additions & 0 deletions lib/limarka/conversor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ def convert()
def compila
Dir.chdir(options[:output_dir]) do
basename = File.basename(texto_tex_file, '.tex')
if system ("whereis texliveonfly")
system "texliveonfly -c xelatex -f #{basename}", :out=>'xxx-texliveonfly-std.txt'
end
system "latexmk --quiet --xelatex -f #{basename}", :out=>'xxx-latexmk-std.txt', :err=>'xxx-latexmk-erros.txt'
if (usa_pdftotext) then
system "pdftotext -enc UTF-8 #{basename}.pdf"
Expand Down

5 comments on commit 472ed7d

@edusantana
Copy link
Member

Choose a reason for hiding this comment

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

@cauachagas você adicionou o if, talvez seria interessante colocar um else:

if system ("whereis texliveonfly")
  system "texliveonfly -c xelatex -f #{basename}",  :out=>'xxx-texliveonfly-std.txt'
else
  system "latexmk --quiet --xelatex -f #{basename}",  :out=>'xxx-latexmk-std.txt', :err=>'xxx-latexmk-erros.txt'
end

E também, perceba que você deixou de redirecionar os erros também, então recomendo adicionar os erros e unificar os nomes:

latex_commando = system ("whereis texliveonfly") ? "texliveonfly" : "latexmk"
system "#{latex_commando} --quiet --xelatex -f #{basename}",  :out=>'xxx-latex-std.txt', :err=>'xxx-latex-erros.txt'

@edusantana
Copy link
Member

Choose a reason for hiding this comment

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

@cauachagas quanto menos códigos duplicados melhor, diminui probabilidade de erros.

@cauachagas
Copy link
Collaborator

Choose a reason for hiding this comment

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

Eu tentei fazer algo parecido, mas sem sucesso. Se usar

latex_commando = system ("whereis texliveonfly") ? "texliveonfly" : "latexmk"

o latex_commando retorna falso. Então não funcionará.

A ideia era verificar se "latexliveonfly" existe no sistema e, se existir, compilar primeiro com ele e depois com o comando padrão do Limarka (latexmk --xelatex). Somente usar o latexliveonfly não funciona. Ele ignora as referências bibliográficas.

O commit funciona em Unix, mas não tenho certeza se o whereis funciona no Windows. Aliás, não sei se para Windows é viável porque teria que instalar o Python. Então talvez possamos limitar essa funcionalidade limitada aos sistemas Unix, @edusantana ?

@edusantana
Copy link
Member

Choose a reason for hiding this comment

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

Verdade, o texliveonfly precisa ser chamado uma vez antes.

Penso que talvez ele seja uma aplicação para ser adicionada na imagem customizada. Pois o limarka não precisa dele, daí a imagem aumenta com instalação do python. Temos que avaliar isso.

@cauachagas
Copy link
Collaborator

Choose a reason for hiding this comment

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

Comparando aqui https://github.com/abntex/limarka/blob/master/containers/ruby-latex-pandoc.dockerfile . O com tag latest é o que o Limarka usa atualmente. Não sei se dá pra otimizar o Alpine, que deu até maior que a versão do Ubuntu. Na minha versão do Ubuntu do texliveonfly, acho que redução do tamanho é por conta do --no-install-recommends. E o Python no Ubuntu não é uma dependência extensa.

image

Please sign in to comment.