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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: babbb7a46fb07890d25da6d226c81a6572bfecd8
4
- data.tar.gz: a3f93192540634f36fb28fd23584a2dd9a00a51d
3
+ metadata.gz: 5dddd1b935075fa0f24eab62db385f281e7e578e
4
+ data.tar.gz: c6cf282a4db9bedb8a259358ca463754317cdd08
5
5
  SHA512:
6
- metadata.gz: 6db2c48744ea0389ff6e4aca0794e03b15ac3834aa296c306010d27aacc49f144555a6dc26e6ee91e72967b7440e55f3c239edb673ed73ba4a4735571612b18e
7
- data.tar.gz: 3871a7af40bb3f7d37959634689eac21971a1bb5201bd69de4d1697eb2ce8ac7d6ce3679950216bbcf3944d604f808abf0dbff44cc268c5c639f8ad62e493b78
6
+ metadata.gz: 044b9c98494935f9ad214774012347e6257ab8a53095380c0fb647ded9982d41e1d124221e19377ac5731abc5fe2114f0e2afaa30bd38f990bf988b6ecfa9c2b
7
+ data.tar.gz: 4e43255e9d899cb6d419a74b6cd2124e7117d570fc36172d55915135afb2490a2cba31dc1fb4783b0256042cbd80599114e2ecc7b3058f8a55ae229eac55dc3d
@@ -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)
@@ -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
 
@@ -5,12 +5,20 @@ module Formatafacil
5
5
  ARTIGO_PDF = "artigo.pdf"
6
6
 
7
7
  class Compila < Tarefa
8
- def compila_artigo
9
- raise "Erro ao tentar compilar um arquivo que não existe: #{ARTIGO_LATEX}" unless File.exist?(ARTIGO_LATEX)
10
- Kernel::system("latexmk -pdf -time -silent #{ARTIGO_LATEX}")
11
- raise "Erro durante a criação do PDF, provavelmente existe erro no arquivo #{ARTIGO_LATEX}" unless File.exist?(ARTIGO_PDF)
12
- logger.info "Arquivo compilado com sucesso." unless logger.nil?
13
- end
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 otimiza
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
-
@@ -1,3 +1,3 @@
1
1
  module Formatafacil
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: formatafacil
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eduardo de Santana Medeiros Alexandre