formatafacil 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/exe/formatafacil +4 -29
- data/lib/formatafacil/compila.rb +14 -6
- data/lib/formatafacil/otimizador_para_web.rb +5 -6
- data/lib/formatafacil/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5dddd1b935075fa0f24eab62db385f281e7e578e
|
4
|
+
data.tar.gz: c6cf282a4db9bedb8a259358ca463754317cdd08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 044b9c98494935f9ad214774012347e6257ab8a53095380c0fb647ded9982d41e1d124221e19377ac5731abc5fe2114f0e2afaa30bd38f990bf988b6ecfa9c2b
|
7
|
+
data.tar.gz: 4e43255e9d899cb6d419a74b6cd2124e7117d570fc36172d55915135afb2490a2cba31dc1fb4783b0256042cbd80599114e2ecc7b3058f8a55ae229eac55dc3d
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
# formatafacil Change Log
|
2
2
|
|
3
3
|
|
4
|
+
## 0.2.4
|
5
|
+
|
6
|
+
- Otimização do pdf para web [#8](https://github.com/formatafacil/formatafacil/issues/8)
|
7
|
+
- Remoção do comando `auto` [#7](https://github.com/formatafacil/formatafacil/issues/7)
|
8
|
+
|
4
9
|
## 0.2.3
|
5
10
|
|
6
11
|
- Compilação do pdf após geração do artigo em latex [#5](https://github.com/formatafacil/formatafacil/issues/5)
|
data/exe/formatafacil
CHANGED
@@ -33,7 +33,7 @@ command :artigo do |c|
|
|
33
33
|
c.switch [:w, 'otimiza-para-web'], :default_value => false
|
34
34
|
|
35
35
|
c.desc 'Diretório para execução'
|
36
|
-
c.flag [:dir]
|
36
|
+
c.flag [:d, :dir]
|
37
37
|
|
38
38
|
|
39
39
|
c.action do |global,options,args|
|
@@ -49,6 +49,9 @@ command :artigo do |c|
|
|
49
49
|
|
50
50
|
if (options['pdf'])
|
51
51
|
compilador = Formatafacil::Compila.new()
|
52
|
+
if (options['otimiza-para-web']) then
|
53
|
+
compilador.otimizador = Formatafacil::OtimizadorParaWeb.new('artigo.pdf')
|
54
|
+
end
|
52
55
|
end
|
53
56
|
|
54
57
|
tarefa = Formatafacil::ArtigoTarefa.new(:compilador => compilador)
|
@@ -99,36 +102,8 @@ command :compila do |c|
|
|
99
102
|
end
|
100
103
|
|
101
104
|
end
|
102
|
-
|
103
|
-
end
|
104
|
-
|
105
|
-
desc 'Auto detecta o comando com base no arquivo de configuração'
|
106
|
-
command :auto do |c|
|
107
|
-
|
108
|
-
|
109
|
-
c.action do |global,options,args|
|
110
|
-
|
111
|
-
if (global['logfile'])
|
112
|
-
logger = Logger.new('formatafacil.log')
|
113
|
-
else
|
114
|
-
logger = Logger.new(STDERR)
|
115
|
-
end
|
116
|
-
logger.level = Logger::WARN
|
117
|
-
|
118
|
-
begin
|
119
|
-
tarefa = Formatafacil::TarefaChooser.new().escolhe_tarefa
|
120
|
-
tarefa.logger = logger
|
121
|
-
tarefa.executa
|
122
|
-
rescue Exception => e
|
123
|
-
logger.error {e.message}
|
124
|
-
end
|
125
|
-
|
126
|
-
end
|
127
|
-
|
128
105
|
end
|
129
106
|
|
130
|
-
|
131
|
-
|
132
107
|
desc 'Lista modelos disponíveis'
|
133
108
|
command :modelos do |c|
|
134
109
|
|
data/lib/formatafacil/compila.rb
CHANGED
@@ -5,12 +5,20 @@ module Formatafacil
|
|
5
5
|
ARTIGO_PDF = "artigo.pdf"
|
6
6
|
|
7
7
|
class Compila < Tarefa
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
8
|
+
attr_accessor 'otimizador'
|
9
|
+
|
10
|
+
def compila_artigo
|
11
|
+
|
12
|
+
|
13
|
+
raise "Erro ao tentar compilar um arquivo que não existe: #{ARTIGO_LATEX}" unless File.exist?(ARTIGO_LATEX)
|
14
|
+
Kernel::system("latexmk -pdf -time -silent #{ARTIGO_LATEX}")
|
15
|
+
raise "Erro durante a criação do PDF, provavelmente existe erro no arquivo #{ARTIGO_LATEX}" unless File.exist?(ARTIGO_PDF)
|
16
|
+
|
17
|
+
@otimizador.otimiza_pdf unless @otimizador.nil?
|
18
|
+
|
19
|
+
logger.info "Arquivo compilado com sucesso." unless logger.nil?
|
20
|
+
|
21
|
+
end
|
14
22
|
|
15
23
|
end
|
16
24
|
end
|
@@ -7,17 +7,16 @@ module Formatafacil
|
|
7
7
|
def initialize(arquivo)
|
8
8
|
@arquivo=arquivo
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
def bkp_prefix(arquivo)
|
12
12
|
"bkp-#{arquivo}"
|
13
13
|
end
|
14
|
-
|
15
|
-
def
|
14
|
+
|
15
|
+
def otimiza_pdf
|
16
16
|
File.rename(@arquivo, bkp_prefix(@arquivo))
|
17
|
-
system("qpdf --linearize #{bkp_prefix(@arquivo)} #{@arquivo}")
|
17
|
+
Kernel::system("qpdf --linearize #{bkp_prefix(@arquivo)} #{@arquivo}")
|
18
18
|
File.delete(bkp_prefix(@arquivo))
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
end
|
22
22
|
end
|
23
|
-
|
data/lib/formatafacil/version.rb
CHANGED