rodolfo 2.4.2 → 2.5.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: ebd4fa30450adc2268539bb7c36fd359714689c3
4
- data.tar.gz: e5dd078fc2dae3cc03a9a339c102687669137e73
3
+ metadata.gz: 691a8094831258613f5c600b4d5a831b6163ad03
4
+ data.tar.gz: 1275b60e9a8863de0ced79d6e7ff593691c399b4
5
5
  SHA512:
6
- metadata.gz: b71c97573be62ca0b7e055b5002ce84874ffa02984a4ab7d069da136f41fb8de68d151f753bb7ba7f275911d189d51f2bfb02c13c2ade474ee3256515e9a81dc
7
- data.tar.gz: 82c9d81d4028ad35ce0d2f07cd36f40a263852f8c7983557eec6ae10e8fbca9f511ab62919d39982d4f3f38dffdd29242e013e6f8ba6bcea6c713fc6ff3e99b0
6
+ metadata.gz: 28e4e2e006ff217b493ee8cc60b97c4810b3c9b624c3940e338037db2570e85c4118b34eb7ff494e755590005db66b2e0b8a1665ffcbc114cdc62adb9bb86480
7
+ data.tar.gz: df2e8e8b38b144ec390f1d7e2d5b6cd02453121c33f895810ae0c259d0b918563daaf909d519b7477ad78c0695ea4a5236c00c55f82a393878ea814493b72ba1
@@ -64,13 +64,17 @@ module Rodolfo
64
64
  puts Rodolfo::Reader.new(pdf).to_json
65
65
  end
66
66
 
67
- desc 'render RECIPE PATH [--save-to file.pdf]', 'render a rodolfo recipe'
67
+ desc 'render RECIPE PATH [--save-to file.pdf] [--strict]',
68
+ 'render a rodolfo recipe'
68
69
  method_option 'save-to', type: :string, aliases: '-s'
70
+ method_option 'strict', type: :boolean, default: false, aliases: '-t'
69
71
  def render(recipe_path)
72
+ file_name = options['save-to']
73
+ strict = options['strict']
74
+
70
75
  data = $stdin.tty? ? {} : JSON.parse($stdin.read, symbolize_names: true)
71
- content = Rodolfo::Renderer.new(recipe_path, data).render
76
+ content = Rodolfo::Renderer.new(recipe_path, data, strict).render
72
77
 
73
- file_name = options['save-to']
74
78
  file_name ? File.write(file_name, content) : STDOUT.write(content)
75
79
  exit 0
76
80
  rescue RenderError, SchemaValidationError => error
@@ -6,14 +6,15 @@ require_relative 'exceptions'
6
6
  module Rodolfo
7
7
  # Rodolfo Recipe JSON Schema
8
8
  class JSONSchema
9
- def initialize(path)
9
+ def initialize(path, strict = false)
10
10
  @path = path
11
+ @strict = strict
11
12
  end
12
13
 
13
14
  # Validate the json schema
14
15
  # May raise a SchemaValidationError
15
16
  def validate(data)
16
- opts = { insert_defaults: true, strict: true }
17
+ opts = { insert_defaults: true, strict: @strict }
17
18
  errors = JSON::Validator.fully_validate json, data, opts
18
19
  raise SchemaValidationError, errors unless errors.empty?
19
20
  data
@@ -1,4 +1,4 @@
1
1
  # Create PDFs from the CLI using Prawn
2
2
  module Rodolfo
3
- VERSION = '2.4.2'.freeze
3
+ VERSION = '2.5.0'.freeze
4
4
  end
@@ -20,10 +20,11 @@ module Rodolfo
20
20
  class Renderer
21
21
  attr_reader :data, :validation_errors
22
22
 
23
- def initialize(path, data)
23
+ def initialize(path, data, strict = false)
24
24
  @path = Pathname.new(path).absolute? ? path : File.join(Dir.pwd, path)
25
25
  @data = data
26
- @schema = JSONSchema.new File.join(@path, 'schema.json')
26
+ schema_path = File.join(@path, 'schema.json')
27
+ @schema = JSONSchema.new schema_path, strict
27
28
  end
28
29
 
29
30
  # Get the recipe json schema
metadata CHANGED
@@ -1,235 +1,235 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rodolfo
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.2
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Initios
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-13 00:00:00.000000000 Z
11
+ date: 2017-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json-schema
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '2.7'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.7'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: pdf-reader
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
33
  version: 1.4.0
34
- - - ">="
34
+ - - '>='
35
35
  - !ruby/object:Gem::Version
36
36
  version: 1.4.0
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
- - - "~>"
41
+ - - ~>
42
42
  - !ruby/object:Gem::Version
43
43
  version: 1.4.0
44
- - - ">="
44
+ - - '>='
45
45
  - !ruby/object:Gem::Version
46
46
  version: 1.4.0
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: prawn
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - "~>"
51
+ - - ~>
52
52
  - !ruby/object:Gem::Version
53
53
  version: 2.1.0
54
- - - ">="
54
+ - - '>='
55
55
  - !ruby/object:Gem::Version
56
56
  version: 2.1.0
57
57
  type: :runtime
58
58
  prerelease: false
59
59
  version_requirements: !ruby/object:Gem::Requirement
60
60
  requirements:
61
- - - "~>"
61
+ - - ~>
62
62
  - !ruby/object:Gem::Version
63
63
  version: 2.1.0
64
- - - ">="
64
+ - - '>='
65
65
  - !ruby/object:Gem::Version
66
66
  version: 2.1.0
67
67
  - !ruby/object:Gem::Dependency
68
68
  name: prawn-table
69
69
  requirement: !ruby/object:Gem::Requirement
70
70
  requirements:
71
- - - "~>"
71
+ - - ~>
72
72
  - !ruby/object:Gem::Version
73
73
  version: 0.2.2
74
74
  type: :runtime
75
75
  prerelease: false
76
76
  version_requirements: !ruby/object:Gem::Requirement
77
77
  requirements:
78
- - - "~>"
78
+ - - ~>
79
79
  - !ruby/object:Gem::Version
80
80
  version: 0.2.2
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: thor
83
83
  requirement: !ruby/object:Gem::Requirement
84
84
  requirements:
85
- - - "~>"
85
+ - - ~>
86
86
  - !ruby/object:Gem::Version
87
87
  version: 0.19.1
88
88
  type: :runtime
89
89
  prerelease: false
90
90
  version_requirements: !ruby/object:Gem::Requirement
91
91
  requirements:
92
- - - "~>"
92
+ - - ~>
93
93
  - !ruby/object:Gem::Version
94
94
  version: 0.19.1
95
95
  - !ruby/object:Gem::Dependency
96
96
  name: aruba
97
97
  requirement: !ruby/object:Gem::Requirement
98
98
  requirements:
99
- - - "~>"
99
+ - - ~>
100
100
  - !ruby/object:Gem::Version
101
101
  version: 0.14.2
102
- - - ">="
102
+ - - '>='
103
103
  - !ruby/object:Gem::Version
104
104
  version: 0.14.2
105
105
  type: :development
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
- - - "~>"
109
+ - - ~>
110
110
  - !ruby/object:Gem::Version
111
111
  version: 0.14.2
112
- - - ">="
112
+ - - '>='
113
113
  - !ruby/object:Gem::Version
114
114
  version: 0.14.2
115
115
  - !ruby/object:Gem::Dependency
116
116
  name: cucumber
117
117
  requirement: !ruby/object:Gem::Requirement
118
118
  requirements:
119
- - - "~>"
119
+ - - ~>
120
120
  - !ruby/object:Gem::Version
121
121
  version: 2.4.0
122
- - - ">="
122
+ - - '>='
123
123
  - !ruby/object:Gem::Version
124
124
  version: 2.4.0
125
125
  type: :development
126
126
  prerelease: false
127
127
  version_requirements: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - "~>"
129
+ - - ~>
130
130
  - !ruby/object:Gem::Version
131
131
  version: 2.4.0
132
- - - ">="
132
+ - - '>='
133
133
  - !ruby/object:Gem::Version
134
134
  version: 2.4.0
135
135
  - !ruby/object:Gem::Dependency
136
136
  name: rake
137
137
  requirement: !ruby/object:Gem::Requirement
138
138
  requirements:
139
- - - "~>"
139
+ - - ~>
140
140
  - !ruby/object:Gem::Version
141
141
  version: 11.3.0
142
- - - ">="
142
+ - - '>='
143
143
  - !ruby/object:Gem::Version
144
144
  version: 11.3.0
145
145
  type: :development
146
146
  prerelease: false
147
147
  version_requirements: !ruby/object:Gem::Requirement
148
148
  requirements:
149
- - - "~>"
149
+ - - ~>
150
150
  - !ruby/object:Gem::Version
151
151
  version: 11.3.0
152
- - - ">="
152
+ - - '>='
153
153
  - !ruby/object:Gem::Version
154
154
  version: 11.3.0
155
155
  - !ruby/object:Gem::Dependency
156
156
  name: rspec
157
157
  requirement: !ruby/object:Gem::Requirement
158
158
  requirements:
159
- - - "~>"
159
+ - - ~>
160
160
  - !ruby/object:Gem::Version
161
161
  version: '3.5'
162
- - - ">="
162
+ - - '>='
163
163
  - !ruby/object:Gem::Version
164
164
  version: '3.5'
165
165
  type: :development
166
166
  prerelease: false
167
167
  version_requirements: !ruby/object:Gem::Requirement
168
168
  requirements:
169
- - - "~>"
169
+ - - ~>
170
170
  - !ruby/object:Gem::Version
171
171
  version: '3.5'
172
- - - ">="
172
+ - - '>='
173
173
  - !ruby/object:Gem::Version
174
174
  version: '3.5'
175
175
  - !ruby/object:Gem::Dependency
176
176
  name: rspec_junit_formatter
177
177
  requirement: !ruby/object:Gem::Requirement
178
178
  requirements:
179
- - - "~>"
179
+ - - ~>
180
180
  - !ruby/object:Gem::Version
181
181
  version: 0.2.3
182
- - - ">="
182
+ - - '>='
183
183
  - !ruby/object:Gem::Version
184
184
  version: 0.2.3
185
185
  type: :development
186
186
  prerelease: false
187
187
  version_requirements: !ruby/object:Gem::Requirement
188
188
  requirements:
189
- - - "~>"
189
+ - - ~>
190
190
  - !ruby/object:Gem::Version
191
191
  version: 0.2.3
192
- - - ">="
192
+ - - '>='
193
193
  - !ruby/object:Gem::Version
194
194
  version: 0.2.3
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: rspec-json_expectations
197
197
  requirement: !ruby/object:Gem::Requirement
198
198
  requirements:
199
- - - "~>"
199
+ - - ~>
200
200
  - !ruby/object:Gem::Version
201
201
  version: '1.4'
202
- - - ">="
202
+ - - '>='
203
203
  - !ruby/object:Gem::Version
204
204
  version: '1.4'
205
205
  type: :development
206
206
  prerelease: false
207
207
  version_requirements: !ruby/object:Gem::Requirement
208
208
  requirements:
209
- - - "~>"
209
+ - - ~>
210
210
  - !ruby/object:Gem::Version
211
211
  version: '1.4'
212
- - - ">="
212
+ - - '>='
213
213
  - !ruby/object:Gem::Version
214
214
  version: '1.4'
215
215
  - !ruby/object:Gem::Dependency
216
216
  name: rubocop
217
217
  requirement: !ruby/object:Gem::Requirement
218
218
  requirements:
219
- - - "~>"
219
+ - - ~>
220
220
  - !ruby/object:Gem::Version
221
221
  version: 0.43.0
222
- - - ">="
222
+ - - '>='
223
223
  - !ruby/object:Gem::Version
224
224
  version: 0.43.0
225
225
  type: :development
226
226
  prerelease: false
227
227
  version_requirements: !ruby/object:Gem::Requirement
228
228
  requirements:
229
- - - "~>"
229
+ - - ~>
230
230
  - !ruby/object:Gem::Version
231
231
  version: 0.43.0
232
- - - ">="
232
+ - - '>='
233
233
  - !ruby/object:Gem::Version
234
234
  version: 0.43.0
235
235
  description: Create pdfs with Prawn
@@ -239,7 +239,6 @@ executables:
239
239
  extensions: []
240
240
  extra_rdoc_files: []
241
241
  files:
242
- - bin/rodolfo
243
242
  - lib/rodolfo/cli.rb
244
243
  - lib/rodolfo/exceptions.rb
245
244
  - lib/rodolfo/json_schema.rb
@@ -249,6 +248,7 @@ files:
249
248
  - lib/rodolfo/templates/data.tt
250
249
  - lib/rodolfo/templates/schema.tt
251
250
  - lib/rodolfo/templates/template.tt
251
+ - bin/rodolfo
252
252
  homepage: https://github.com/initios/rodolfo
253
253
  licenses:
254
254
  - MIT
@@ -259,19 +259,18 @@ require_paths:
259
259
  - lib
260
260
  required_ruby_version: !ruby/object:Gem::Requirement
261
261
  requirements:
262
- - - ">="
262
+ - - '>='
263
263
  - !ruby/object:Gem::Version
264
264
  version: '2.0'
265
265
  required_rubygems_version: !ruby/object:Gem::Requirement
266
266
  requirements:
267
- - - ">="
267
+ - - '>='
268
268
  - !ruby/object:Gem::Version
269
269
  version: '0'
270
270
  requirements: []
271
271
  rubyforge_project:
272
- rubygems_version: 2.5.1
272
+ rubygems_version: 2.0.14.1
273
273
  signing_key:
274
274
  specification_version: 4
275
275
  summary: rodolfo
276
276
  test_files: []
277
- has_rdoc: