rodolfo 1.0.0 → 1.0.1.pre.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/rodolfo +7 -2
- data/lib/meta.rb +1 -1
- data/lib/rodolfo.rb +8 -11
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68773cd4b01068d325a4be05c192b943fdbf6c5a
|
4
|
+
data.tar.gz: 7927974f44f4e4cd7065efa3e3984f9163310a7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1054b5eebdb65342242d126f24e73493bb0818b407e2aa98cdb465a2fba07d9b288263cb4e5d0d978152ac89472d5ced1501454b45eb01e293a252a68cfe92e5
|
7
|
+
data.tar.gz: acd180749aba6c8d747d422aa690c9fbbbffbe6ecb6fb17c30bb875cdbdc7c16b3f5175cc54cced180be982a65c3199f094d15fde97adb87fcb6fcba9a97632c
|
data/bin/rodolfo
CHANGED
@@ -35,5 +35,10 @@ unless opts.skip_validation? || package.valid?
|
|
35
35
|
exit 2
|
36
36
|
end
|
37
37
|
|
38
|
-
|
39
|
-
|
38
|
+
begin
|
39
|
+
STDOUT.write package.make
|
40
|
+
exit 0
|
41
|
+
rescue NoMethodError
|
42
|
+
STDOUT.write 'Missing or incorrect data, template can\'t be rendered'
|
43
|
+
exit 2
|
44
|
+
end
|
data/lib/meta.rb
CHANGED
data/lib/rodolfo.rb
CHANGED
@@ -17,30 +17,27 @@ module Rodolfo
|
|
17
17
|
#
|
18
18
|
# It handles methods for manipulate those files and the pdf generation
|
19
19
|
class Package
|
20
|
+
attr_reader :data, :validation_errors
|
21
|
+
|
20
22
|
def initialize(path, data)
|
21
23
|
@path = Pathname.new(path).absolute? ? path : File.join(Dir.pwd, path)
|
24
|
+
opts = { errors_as_objects: true, insert_defaults: true }
|
25
|
+
@validation_errors = JSON::Validator.fully_validate(schema, data, opts)
|
22
26
|
@data = data
|
23
|
-
@json_file_path = File.join @path, 'schema.json'
|
24
|
-
@template_file_path = File.join @path, 'template'
|
25
27
|
end
|
26
28
|
|
27
29
|
def schema
|
28
|
-
|
30
|
+
json_file_path = File.join @path, 'schema.json'
|
31
|
+
File.read json_file_path
|
29
32
|
end
|
30
33
|
|
31
34
|
def valid?
|
32
|
-
args = schema, @data, { errors_as_objects: true }
|
33
|
-
@validation_errors = JSON::Validator.fully_validate(*args)
|
34
35
|
@validation_errors.empty?
|
35
36
|
end
|
36
37
|
|
37
|
-
def validation_errors
|
38
|
-
valid? unless @validation_errors
|
39
|
-
@validation_errors
|
40
|
-
end
|
41
|
-
|
42
38
|
def make
|
43
|
-
|
39
|
+
template_file_path = File.join @path, 'template'
|
40
|
+
require template_file_path
|
44
41
|
Rodolfo::Template.new(@data).render
|
45
42
|
end
|
46
43
|
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: 1.0.
|
4
|
+
version: 1.0.1.pre.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Initios
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10
|
11
|
+
date: 2016-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json-schema
|
@@ -263,9 +263,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
263
263
|
version: '2.0'
|
264
264
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
265
265
|
requirements:
|
266
|
-
- - "
|
266
|
+
- - ">"
|
267
267
|
- !ruby/object:Gem::Version
|
268
|
-
version:
|
268
|
+
version: 1.3.1
|
269
269
|
requirements: []
|
270
270
|
rubyforge_project:
|
271
271
|
rubygems_version: 2.5.1
|