rodolfo 2.1.1 → 2.2.0

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: db84b5d9995c4be2546f9c4c591a2aee42821739
4
- data.tar.gz: 5577eaff691dd2750cf7a8c0ee02b1cb5599e995
3
+ metadata.gz: 3c39364ba9b0c1e111f3ce32ae5f2f4974478d17
4
+ data.tar.gz: b42944e1fc8fbb8250c28d1a0a6b2c800ba6c6d0
5
5
  SHA512:
6
- metadata.gz: cfb0f7cf4b4c785bf344966904b07d815c3dde9f7fe76d92ea9ef79cd0c77df9ab1ea95c377fb110fee92186253d6df8b8fca696afcb53af380ad2b1e6b8456f
7
- data.tar.gz: f39703a8b65d14afb2f7be1229733bb385370fef15e21ba40a5f6c1a6ba716c1e19b691c8b9ed5c12b0dd6cf7e0abc21b089c74de07d94b1bb5cccf6234afdc7
6
+ metadata.gz: 5ef3bf526ba56c1011a941f6efa32b6600e3e10d92983667a199842447e1e68a8e8ab367a14c5aad67335901bcd6109c2f55db051b70473051a6ba3e6a3d6408
7
+ data.tar.gz: 76843c9f0e61ef04a5d2437eeb0c12ce69840084101bb0cdfeb5c803a04ef2684ca00f5453f62240e79b2b2861f3e78089a1b255d4d7d34e27a802dfb683b089
data/lib/rodolfo/cli.rb CHANGED
@@ -26,7 +26,7 @@ module Rodolfo
26
26
  end
27
27
 
28
28
  def three
29
- copy_file('template.tt', "#{folder}/template.rb")
29
+ template('template.tt', "#{folder}/template.rb")
30
30
  end
31
31
 
32
32
  def four
@@ -36,7 +36,8 @@ module Rodolfo
36
36
  def five
37
37
  puts
38
38
  puts 'Recipe ready! Try it with:'
39
- puts "cat #{folder}/data.json | rodolfo render #{folder} --save-to #{folder}.pdf"
39
+ puts "cat #{folder}/data.json | rodolfo render #{folder}" \
40
+ " --save-to #{folder}.pdf"
40
41
  end
41
42
  end
42
43
 
data/lib/rodolfo/meta.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # Create PDFs from the CLI using Prawn
2
2
  module Rodolfo
3
- VERSION = '2.1.1'.freeze
3
+ VERSION = '2.2.0'.freeze
4
4
  end
@@ -51,8 +51,7 @@ module Rodolfo
51
51
  # Render the template
52
52
  def render
53
53
  require File.join @path, 'template'
54
- t = Rodolfo::Template.new(validated_data)
55
- Prawn::Document.new(info: pdf_meta, **t.config, &t).render
54
+ Rodolfo::Template.new(validated_data, info: pdf_meta).render
56
55
  rescue NoMethodError
57
56
  msg = 'Missing or incorrect data, template can\'t be rendered'
58
57
  raise RenderError, [msg]
@@ -1,21 +1,15 @@
1
1
  module Rodolfo
2
- # A Rodolfo Prawn pdf generator
3
- class Template
4
- def initialize(data)
2
+ # <%= folder %>
3
+ # <%= description %>
4
+ class Template < Prawn::Document
5
+ def initialize(data, options = {})
5
6
  @data = data
7
+ super page_size: 'A4', page_layout: :portrait, **options
6
8
  end
7
9
 
8
- # Prawn config
9
- def config
10
- { page_layout: :portrait }
11
- end
12
-
13
- def to_proc
14
- data = @data
15
-
16
- proc do
17
- text data[:msg]
18
- end
10
+ def render
11
+ text @data[:msg]
12
+ super
19
13
  end
20
14
  end
21
15
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rodolfo
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Initios
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-19 00:00:00.000000000 Z
11
+ date: 2016-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json-schema