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 +4 -4
- data/lib/rodolfo/cli.rb +3 -2
- data/lib/rodolfo/meta.rb +1 -1
- data/lib/rodolfo/renderer.rb +1 -2
- data/lib/rodolfo/templates/template.tt +8 -14
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c39364ba9b0c1e111f3ce32ae5f2f4974478d17
|
4
|
+
data.tar.gz: b42944e1fc8fbb8250c28d1a0a6b2c800ba6c6d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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}
|
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
data/lib/rodolfo/renderer.rb
CHANGED
@@ -51,8 +51,7 @@ module Rodolfo
|
|
51
51
|
# Render the template
|
52
52
|
def render
|
53
53
|
require File.join @path, 'template'
|
54
|
-
|
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
|
-
#
|
3
|
-
|
4
|
-
|
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
|
-
|
9
|
-
|
10
|
-
|
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.
|
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-
|
11
|
+
date: 2016-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json-schema
|