multiformat-cv 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/multiformatcv.rb +20 -11
- data/lib/multiformatcv/contact.rb +1 -1
- data/lib/multiformatcv/job.rb +4 -2
- data/lib/multiformatcv/resume.rb +18 -0
- data/lib/multiformatcv/version.rb +4 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 46029dcec4bbd91c576ad53361d1738902b2d50bbc2161797bbae740cc5ca9c7
|
4
|
+
data.tar.gz: f737b5ac82aadd2f0b8ba8e28d3b4fd2e1800a9caf4aca194282890f947dec21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4b4ba02dbfe90c2140817ab79053eb5935b279e8810794d20ce4db45d928d6b3f3b1fedce58203fdbcd21c7487018bf1212e21c42797f0bce6e0fdb67509076
|
7
|
+
data.tar.gz: 61962fc1806b742df3bb5caa09cf57fdd06cc41ebb06919cebf3af6aceab304f8ccd7e7f3b2b9623c062ad92895af6195fa7f004ecc61129dbbf51273eb0d048
|
data/lib/multiformatcv.rb
CHANGED
@@ -9,19 +9,21 @@ module MultiformatCV
|
|
9
9
|
# Parse yaml files located at data directory
|
10
10
|
#
|
11
11
|
# @param [Hash] opts Options to specify format and templates source
|
12
|
-
# @option opts [String]
|
13
|
-
# @option opts [Symbol]
|
14
|
-
# @option opts [
|
12
|
+
# @option opts [String] 'data_dir' Directory where the YAML files are located.
|
13
|
+
# @option opts [Symbol] 'format' One of [ :html, :tex ]
|
14
|
+
# @option opts [Symbol] 'output' Output file
|
15
|
+
# @option opts [String] 'templates' Directory where templates are located,
|
15
16
|
# expected template files are `cv.#{ format }.erb`
|
16
17
|
#
|
17
|
-
# @return [
|
18
|
+
# @return [MultiformatCV::Resume] Resume with parsed data
|
18
19
|
# @see https://www.rubydoc.info/gems/erubi/1.8.0 Erubi documentation
|
19
20
|
# @see Erubi::Engine
|
21
|
+
|
20
22
|
def self.generate(opts = {})
|
21
23
|
opts['format'] ||= 'html'
|
22
24
|
opts['data_dir'] ||= 'data'
|
23
|
-
opts['templates'] ||=
|
24
|
-
opts['output'] ||=
|
25
|
+
opts['templates'] ||= default_template_path
|
26
|
+
opts['output'] ||= nil
|
25
27
|
|
26
28
|
template = File.read("#{ opts['templates'] }/cv.#{ opts['format'] }.erb")
|
27
29
|
resume = Resume.new
|
@@ -34,12 +36,19 @@ module MultiformatCV
|
|
34
36
|
end
|
35
37
|
end
|
36
38
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
File.open(opts['output'], "w") { |f| f.write(result) }
|
39
|
+
resume.rendered = eval Erubi::Engine.new(template).src
|
40
|
+
|
41
|
+
if opts['output'] then
|
42
|
+
File.open(opts['output'], 'w') { |f| f.write(resume.rendered) }
|
42
43
|
end
|
44
|
+
|
45
|
+
resume
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def self.default_template_path
|
51
|
+
File.expand_path('../../sample/onepager', __FILE__)
|
43
52
|
end
|
44
53
|
end
|
45
54
|
|
data/lib/multiformatcv/job.rb
CHANGED
@@ -33,8 +33,10 @@ class MultiformatCV::Job
|
|
33
33
|
@summary = h['summary']
|
34
34
|
@projects = []
|
35
35
|
|
36
|
-
h['projects']
|
37
|
-
|
36
|
+
if h['projects']
|
37
|
+
h['projects'].each do |p|
|
38
|
+
@projects << MultiformatCV::Project.new(p)
|
39
|
+
end
|
38
40
|
end
|
39
41
|
end
|
40
42
|
end
|
data/lib/multiformatcv/resume.rb
CHANGED
@@ -11,13 +11,29 @@ class MultiformatCV::Resume
|
|
11
11
|
# @return [MultiformatCV::Personal]
|
12
12
|
attr_accessor :personal
|
13
13
|
|
14
|
+
# Rendered templates with CV data
|
15
|
+
# @return [String]
|
16
|
+
attr_accessor :rendered
|
17
|
+
|
18
|
+
# Initialize Resume
|
19
|
+
#
|
20
|
+
# @param [Hash] h Options
|
21
|
+
# @option h [Array<MultiformatCV::Contact>] 'contact' Contact information
|
22
|
+
# @option h [Array<MultiformatCV::Job>] 'jobs' Jobs list
|
23
|
+
# @option h [Array<MultiformatCV::Personal>] 'personal' Personal information
|
24
|
+
|
14
25
|
def initialize(h = {})
|
26
|
+
@contact = MultiformatCV::Contact.new(h['contact'] || []) if h['contact']
|
15
27
|
@jobs = []
|
28
|
+
@personal = MultiformatCV::Personal.new(h['personal'] || []) if h['personal']
|
29
|
+
|
30
|
+
h['jobs'].each { |j| @jobs << MultiformatCV::Job.new(j) } if h['jobs']
|
16
31
|
end
|
17
32
|
|
18
33
|
# Set contact information
|
19
34
|
# @param [Hash] h Hash used to initialize new MultiformatCV::Contact
|
20
35
|
# @see MultiformatCV::Contact
|
36
|
+
|
21
37
|
def add_contact(h = {})
|
22
38
|
@contact = MultiformatCV::Contact.new(h)
|
23
39
|
end
|
@@ -28,6 +44,7 @@ class MultiformatCV::Resume
|
|
28
44
|
# MultiformatCV::Job entries
|
29
45
|
#
|
30
46
|
# @see MultiformatCV::Job
|
47
|
+
|
31
48
|
def add_jobs(arr = [])
|
32
49
|
arr.each { |j| @jobs << MultiformatCV::Job.new(j) }
|
33
50
|
end
|
@@ -35,6 +52,7 @@ class MultiformatCV::Resume
|
|
35
52
|
# Set personal information
|
36
53
|
# @param [Hash] h Hash used to initialize new MultiformatCV::Personal
|
37
54
|
# @see MultiformatCV::Personal
|
55
|
+
|
38
56
|
def add_personal(h = {})
|
39
57
|
@personal = MultiformatCV::Personal.new(h)
|
40
58
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: multiformat-cv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JuanKman94
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: erubi
|
@@ -77,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
77
|
version: '0'
|
78
78
|
requirements: []
|
79
79
|
rubyforge_project:
|
80
|
-
rubygems_version: 2.6.
|
80
|
+
rubygems_version: 2.7.6.2
|
81
81
|
signing_key:
|
82
82
|
specification_version: 4
|
83
83
|
summary: Generate your CV in different formats
|