formatafacil 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f0c096c752a0a20eb444229017b59b49407a1210
4
- data.tar.gz: e2faf09f89169c392d85e53970e5fe076ca0bdfb
3
+ metadata.gz: 997c01de8ab8d3795da92b79e7b4325bb353f1dd
4
+ data.tar.gz: 025449718a9842bf2f739d565607a0dbf79454bf
5
5
  SHA512:
6
- metadata.gz: 5646799638b07ae838c50dfe1c3d711197725cd4416b9195779cb43d4533eb210bcab6202c75b059529ac991ef96fae0a1a4075a53c5f60b8de1be627f0e8509
7
- data.tar.gz: e34642c90598f4528495cb2b1513f5d72cb143097c374c744665a8666c809b965713db058f8dcbb74369b75b98b9b4fa99a594eeadb15c2fc569fca1664d46ef
6
+ metadata.gz: c1695d8d5fc59571dbb5ab2a9fbf96ce791de6f4406186afefe1348cc0cc673122f27d0a40b86827becca12d0182c59daacda609852e28206a01f3366e9913aa
7
+ data.tar.gz: 917928f215aa70c9eedee8a7901865a1aacf310db0c673ae5542ba1dc8b006433f7a814c6e360fd00fcb1898394dbf4636061e687dea8e319056620566f59ab6
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # formatafacil Change Log
2
2
 
3
+
4
+ ## 0.2.1
5
+
6
+ - tratamento de erros: falta de arquivos, problemas nos metadados #2
7
+
3
8
  ## 0.1.5
4
9
 
5
10
  - fix bug: otimizar pdfs para a WEB
data/README.md CHANGED
@@ -1,19 +1,7 @@
1
1
  # Formatafacil
2
2
 
3
3
 
4
- ## Installation
5
-
6
- Add this line to your application's Gemfile:
7
-
8
- ```ruby
9
- gem 'formatafacil'
10
- ```
11
-
12
- And then execute:
13
-
14
- $ bundle
15
-
16
- Or install it yourself as:
4
+ ## Instalação
17
5
 
18
6
  $ gem install formatafacil
19
7
 
@@ -22,11 +10,28 @@ Or install it yourself as:
22
10
  - `pandoc` para gerar os códigos latex
23
11
  - `pdflatex` - para compilar texto em pdf
24
12
  - `qpdf` se deseja compilar pdf otimizados para web
13
+ - [formatafacil-templates](http://github.com/formatafacil/formatafacil-templates) (instalado automaticamente através do gem)
25
14
 
26
15
  ## Usage
27
16
 
28
- TODO: Write usage instructions here
17
+ ### Se instalou com gem
18
+
19
+ formatafacil --help
29
20
 
21
+ ### Se baixou diretamente do github
22
+
23
+ bundle update
24
+ bundle exec ./exe/formatafacil --help
25
+
26
+ ### Em desenvolvimento
27
+
28
+ Muitas das funcionalidades ainda estão em desenvolvimento, **execute os testes**
29
+ para verificar o que está funcionando corretamente.
30
+
31
+ bundle update
32
+ bundle exec rspec
33
+
34
+ **TODO**: Write usage instructions here
30
35
 
31
36
  # A command line app
32
37
  As [David said], a cli command utility should:
@@ -38,27 +43,29 @@ necessita.
38
43
 
39
44
  ## be easy to use
40
45
 
41
- Para gerar um artigo no [formato sbc (Sociedade brasileira de computação)](http://www.sbc.org.br/en/index.php?option=com_jdownloads&task=view.download&catid=32&cid=38&Itemid=195):
46
+ Para gerar um artigo no [formato abnt](https://github.com/abntex/abntex2/blob/master/doc/latex/abntex2/examples/abntex2-modelo-artigo.tex):
42
47
 
43
- formatafacil artigo -t sbc
48
+ git clone git@github.com:formatafacil/artigo-abnt.git
49
+ cd artigo-abnt
50
+ formatafacil artigo
44
51
 
45
52
  ## be helpful
46
53
 
47
54
  Com esta aplicação você poderá gerar artigos para o SBC, monografia, dissertação, tese, etc.
48
55
 
49
- ## play well with others
56
+ ## play well with others (pending)
50
57
 
51
- formatafacil artigo -t sbc --log log.txt --input artigo.md --output meu-artigo-sbc.pdf
58
+ formatafacil artigo -m artigo-abnt --log log.txt --input artigo.md --output meu-artigo-sbc.pdf
52
59
 
53
60
  ## delight casual users
54
61
 
55
62
  Lista templates:
56
63
 
57
- formatafacil templates
64
+ formatafacil modelos
58
65
 
59
66
  Cria um diretório e estrutura de um artigo no formato do sbc:
60
67
 
61
- formatafacil cria --template=artigo-sbc
68
+ formatafacil cria --template=artigo-abnt
62
69
 
63
70
  ## make configuration easy for advanced users
64
71
 
@@ -70,7 +77,7 @@ TODO
70
77
 
71
78
  ## be well-tested and as bug free as possible
72
79
 
73
- TODO
80
+ bundle exec rspec
74
81
 
75
82
  ## be easy to maintain
76
83
 
@@ -8,6 +8,13 @@ require 'json'
8
8
 
9
9
  module Formatafacil
10
10
 
11
+ ##
12
+ # Indica que um arquivo não foi encontrado.
13
+ class ArquivoNaoEncontradoError < StandardError
14
+ end
15
+ class MetadadosError < StandardError
16
+ end
17
+
11
18
  class ArtigoTarefa < Tarefa
12
19
  attr_accessor 'modelo'
13
20
  attr_accessor 'metadados'
@@ -143,10 +150,29 @@ module Formatafacil
143
150
  def verifica_conteudos
144
151
  identifica_modelo
145
152
  File.open(@arquivo_texto, 'r') {|f| @texto = f.read} if @texto.nil?
146
- File.open(@arquivo_resumo, 'r') {|f| @resumo = f.read} if @resumo.nil?
147
- File.open(@arquivo_abstract, 'r') {|f| @abstract = f.read} if @abstract.nil?
148
- File.open(@arquivo_bibliografia, 'r') {|f| @bibliografia = f.read} if @bibliografia.nil?
149
- File.open(@arquivo_metadados, 'r') {|f| @metadados = YAML.load(f.read)} if @metadados.empty?
153
+
154
+ begin
155
+ File.open(@arquivo_resumo, 'r') {|f| @resumo = f.read } if @resumo.nil?
156
+ rescue Errno::ENOENT => e
157
+ raise Formatafacil::ArquivoNaoEncontradoError, "Não possível encontrar o arquivo 'resumo.md'. Crie o arquivo com o nome apropriado e tente novamente."
158
+ end
159
+ begin
160
+ File.open(@arquivo_abstract, 'r') { |f| @abstract = f.read } if @abstract.nil?
161
+ rescue Errno::ENOENT => e
162
+ raise Formatafacil::ArquivoNaoEncontradoError, "Não possível encontrar o arquivo 'abstract.md'. Crie o arquivo com o nome apropriado e tente novamente."
163
+ end
164
+ begin
165
+ File.open(@arquivo_bibliografia, 'r') {|f| @bibliografia = f.read} if @bibliografia.nil?
166
+ rescue Errno::ENOENT
167
+ raise Formatafacil::ArquivoNaoEncontradoError, "Não possível encontrar o arquivo 'bibliografia.md'. Crie o arquivo com o nome apropriado e tente novamente."
168
+ end
169
+ begin
170
+ File.open(@arquivo_metadados, 'r') {|f| @metadados = YAML.load(f.read)} if @metadados.empty?
171
+ rescue Errno::ENOENT
172
+ raise Formatafacil::ArquivoNaoEncontradoError, "Não possível encontrar o arquivo '#{@arquivo_metadados}'. Crie o arquivo com o nome apropriado e tente novamente."
173
+ rescue Psych::SyntaxError
174
+ raise Formatafacil::MetadadosError, "Erro no arquivo 'metadados.yaml'. Atualize o arquivo e tente novamente."
175
+ end
150
176
  end
151
177
 
152
178
  def identifica_modelo
@@ -154,7 +180,9 @@ module Formatafacil
154
180
  t = Formatafacil::Template.new()
155
181
  @modelo = t.procura_modelo_de_artigo
156
182
  if (@modelo.nil?) then
157
- raise "Modelo não encontrado. Modelos disponíveis: #{t.list_names}"
183
+ #raise "Modelo não encontrado. Modelos disponíveis: #{t.list_names}"
184
+ nomes_dos_arquivos = t.list_names.map { |n| "#{n}.md" }
185
+ raise ArquivoNaoEncontradoError, "Não possível encontrar um arquivo de artigo: #{nomes_dos_arquivos}. Crie o arquivo com o nome do modelo apropriado e tente novamente."
158
186
  end
159
187
  end
160
188
  @arquivo_texto = "#{@modelo}.md"
@@ -1,3 +1,3 @@
1
1
  module Formatafacil
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: formatafacil
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eduardo de Santana Medeiros Alexandre
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-11-27 00:00:00.000000000 Z
11
+ date: 2015-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler