resume_exporter 0.0.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/bin/resume_exporter +4 -2
  3. data/lib/exporters/html.rb +33 -0
  4. data/lib/exporters/pdf.rb +13 -0
  5. data/lib/extractors/html/linkedin.rb +145 -169
  6. data/lib/extractors/html/stackoverflow.rb +60 -72
  7. data/lib/extractors/html/xing.rb +46 -60
  8. data/lib/extractors/html.rb +1 -1
  9. data/lib/extractors/json/fresh.rb +196 -233
  10. data/lib/extractors/json/json_resume.rb +107 -127
  11. data/lib/extractors/json/prtflio.rb +20 -24
  12. data/lib/extractors/json.rb +7 -6
  13. data/lib/resume_exporter.rb +6 -0
  14. data/lib/templates/default.json.jbuilder +162 -229
  15. data/lib/templates/default.md.erb +99 -244
  16. data/lib/templates/default.txt.erb +99 -224
  17. data/lib/templates/default.xml.builder +162 -227
  18. data/lib/templates/fresh.json.jbuilder +149 -155
  19. data/lib/templates/html/_affiliation.liquid +53 -0
  20. data/lib/templates/html/_basics.liquid +19 -0
  21. data/lib/templates/html/_contact.liquid +27 -0
  22. data/lib/templates/html/_css.liquid +324 -0
  23. data/lib/templates/html/_disposition.liquid +13 -0
  24. data/lib/templates/html/_education.liquid +56 -0
  25. data/lib/templates/html/_employment.liquid +67 -0
  26. data/lib/templates/html/_extracurricular.liquid +53 -0
  27. data/lib/templates/html/_footer.liquid +1 -0
  28. data/lib/templates/html/_governance.liquid +52 -0
  29. data/lib/templates/html/_image.liquid +7 -0
  30. data/lib/templates/html/_interests.liquid +23 -0
  31. data/lib/templates/html/_languages.liquid +22 -0
  32. data/lib/templates/html/_open_source.liquid +53 -0
  33. data/lib/templates/html/_patents.liquid +50 -0
  34. data/lib/templates/html/_projects.liquid +53 -0
  35. data/lib/templates/html/_qualifications.liquid +53 -0
  36. data/lib/templates/html/_reading.liquid +52 -0
  37. data/lib/templates/html/_recognition.liquid +54 -0
  38. data/lib/templates/html/_references.liquid +28 -0
  39. data/lib/templates/html/_resume.liquid +49 -0
  40. data/lib/templates/html/_service.liquid +53 -0
  41. data/lib/templates/html/_skills.liquid +35 -0
  42. data/lib/templates/html/_social.liquid +25 -0
  43. data/lib/templates/html/_speaking.liquid +53 -0
  44. data/lib/templates/html/_writing.liquid +52 -0
  45. data/lib/templates/html/default.liquid +1 -0
  46. data/lib/templates/json_resume.json.jbuilder +72 -72
  47. metadata +119 -20
@@ -6,27 +6,27 @@ module Extractor
6
6
 
7
7
  def meta
8
8
  {
9
- version: @doc.dig(:meta, :version)
9
+ "version" => @doc.dig("meta", "version")
10
10
  }
11
11
  end
12
12
 
13
13
  def basics
14
14
  {
15
- name: @doc.dig(:basics, :name),
16
- label: @doc.dig(:basics, :label),
17
- image: @doc.dig(:basics, :image),
18
- summary: @doc.dig(:basics, :summary),
19
- location: @doc.dig(:basics, :location),
20
- contact: {
21
- email: @doc.dig(:basics, :email),
22
- phone: @doc.dig(:basics, :phone),
23
- website: @doc.dig(:basics, :url),
24
- location: @doc.dig(:basics, :location, :address),
25
- social: @doc.dig(:basics, :profiles).map do |p|
15
+ "name" => @doc.dig("basics", "name"),
16
+ "label" => @doc.dig("basics", "label"),
17
+ "image" => @doc.dig("basics", "image"),
18
+ "summary" => @doc.dig("basics", "summary"),
19
+ "location" => @doc.dig("basics", "location"),
20
+ "contact" => {
21
+ "email" => @doc.dig("basics", "email"),
22
+ "phone" => @doc.dig("basics", "phone"),
23
+ "website" => @doc.dig("basics", "url"),
24
+ "location" => @doc.dig("basics", "location", "address"),
25
+ "social" => @doc.dig("basics", "profiles").map do |p|
26
26
  {
27
- network: p[:network],
28
- user: p[:username],
29
- url: p[:url]
27
+ "network" => p["network"],
28
+ "user" => p["username"],
29
+ "url" => p["url"]
30
30
  }
31
31
  end
32
32
  }
@@ -34,145 +34,125 @@ module Extractor
34
34
  end
35
35
 
36
36
  def employment
37
- {
38
- history: @doc.dig(:work).map do |job|
39
- {
40
- employer: job[:name],
41
- position: job[:position],
42
- description: job[:description],
43
- url: job[:url],
44
- startDate: job[:startDate],
45
- endDate: job[:endDate],
46
- summary: job[:summary],
47
- highlights: job[:highlights]
48
- }
49
- end
50
- }
37
+ @doc.dig("work").map do |job|
38
+ {
39
+ "employer" => job["name"],
40
+ "position" => job["position"],
41
+ "description" => job["description"],
42
+ "url" => job["url"],
43
+ "startDate" => job["startDate"],
44
+ "endDate" => job["endDate"],
45
+ "summary" => job["summary"],
46
+ "highlights" => job["highlights"]
47
+ }
48
+ end
51
49
  end
52
50
 
53
51
  def education
54
- {
55
- history: @doc.dig(:education).map do |education|
56
- {
57
- institution: education[:institution],
58
- fieldOfStudy: education[:area],
59
- degree: education[:studyType],
60
- startDate: education[:startDate],
61
- endDate: education[:endDate],
62
- grade: education[:gpa],
63
- curriculum: education[:courses]
64
- }
65
- end
66
- }
52
+ @doc.dig("education").map do |education|
53
+ {
54
+ "institution" => education["institution"],
55
+ "fieldOfStudy" => education["area"],
56
+ "degree" => education["studyType"],
57
+ "startDate" => education["startDate"],
58
+ "endDate" => education["endDate"],
59
+ "grade" => education["gpa"],
60
+ "curriculum" => education["courses"]
61
+ }
62
+ end
67
63
  end
68
64
 
69
65
  def projects
70
- {
71
- history: @doc.dig(:projects).map do |project|
72
- {
73
- title: project[:name],
74
- description: project[:description],
75
- url: project[:url],
76
- startDate: project[:startDate],
77
- endDate: project[:endDate],
78
- roles: project[:roles],
79
- category: project[:type],
80
- entity: project[:entity],
81
- highlights: project[:highlights],
82
- keywords: project[:keywords]
83
- }
84
- end
85
- }
66
+ @doc.dig("projects").map do |project|
67
+ {
68
+ "title" => project["name"],
69
+ "summary" => project["description"],
70
+ "url" => project["url"],
71
+ "startDate" => project["startDate"],
72
+ "endDate" => project["endDate"],
73
+ "roles" => project["roles"],
74
+ "category" => project["type"],
75
+ "entity" => project["entity"],
76
+ "highlights" => project["highlights"],
77
+ "keywords" => project["keywords"]
78
+ }
79
+ end
86
80
  end
87
81
 
88
82
  def skills
89
- {
90
- sets: @doc.dig(:skills).map do |skill|
91
- {
92
- name: skill[:name],
93
- level: skill[:level],
94
- keywords: skill[:keywords]
95
- }
96
- end
97
- }
83
+ @doc.dig("skills").map do |skill|
84
+ {
85
+ "name" => skill["name"],
86
+ "level" => skill["level"],
87
+ "keywords" => skill["keywords"]
88
+ }
89
+ end
98
90
  end
99
91
 
100
92
  def recognition
101
- {
102
- history: @doc.dig(:awards).map do |award|
103
- {
104
- title: award[:title],
105
- category: "Award",
106
- startDate: award[:date],
107
- from: award[:awarder],
108
- summary: award[:summary]
109
- }
110
- end
111
- }
93
+ @doc.dig("awards").map do |award|
94
+ {
95
+ "title" => award["title"],
96
+ "category" => "Award",
97
+ "startDate" => award["date"],
98
+ "from" => award["awarder"],
99
+ "summary" => award["summary"]
100
+ }
101
+ end
112
102
  end
113
103
 
114
104
  def writing
115
- {
116
- history: @doc.dig(:publications).map do |publication|
117
- {
118
- title: publication[:name],
119
- publisher: publication[:publisher],
120
- date: publication[:releaseDate],
121
- url: publication[:url],
122
- summary: publication[:summary]
123
- }
124
- end
125
- }
105
+ @doc.dig("publications").map do |publication|
106
+ {
107
+ "title" => publication["name"],
108
+ "publisher" => publication["publisher"],
109
+ "date" => publication["releaseDate"],
110
+ "url" => publication["url"],
111
+ "summary" => publication["summary"]
112
+ }
113
+ end
126
114
  end
127
115
 
128
116
  def languages
129
- {
130
- list: @doc.dig(:languages).map do |language|
131
- {
132
- language: language[:language],
133
- level: language[:fluency]
134
- }
135
- end
136
- }
117
+ @doc.dig("languages").map do |language|
118
+ {
119
+ "language" => language["language"],
120
+ "level" => language["fluency"]
121
+ }
122
+ end
137
123
  end
138
124
 
139
125
  def interests
140
- {
141
- list: @doc.dig(:interests).map do |interest|
142
- {
143
- name: interest[:name],
144
- keywords: interest[:keywords]
145
- }
146
- end
147
- }
126
+ @doc.dig("interests").map do |interest|
127
+ {
128
+ "name" => interest["name"],
129
+ "keywords" => interest["keywords"]
130
+ }
131
+ end
148
132
  end
149
133
 
150
134
  def service
151
- {
152
- history: @doc.dig(:volunteer).map do |volunteer|
153
- {
154
- category: "Volunteer Work",
155
- organization: volunteer[:organization],
156
- roles: [volunteer[:position]],
157
- url: volunteer[:url],
158
- startDate: volunteer[:startDate],
159
- endDate: volunteer[:endDate],
160
- summary: volunteer[:summary],
161
- highlights: volunteer[:highlights]
162
- }
163
- end
164
- }
135
+ @doc.dig("volunteer").map do |volunteer|
136
+ {
137
+ "category" => "Volunteer Work",
138
+ "organization" => volunteer["organization"],
139
+ "roles" => [volunteer["position"]],
140
+ "url" => volunteer["url"],
141
+ "startDate" => volunteer["startDate"],
142
+ "endDate" => volunteer["endDate"],
143
+ "summary" => volunteer["summary"],
144
+ "highlights" => volunteer["highlights"]
145
+ }
146
+ end
165
147
  end
166
148
 
167
149
  def references
168
- {
169
- history: @doc.dig(:references).map do |reference|
170
- {
171
- name: reference[:name],
172
- summary: reference[:reference]
173
- }
174
- end
175
- }
150
+ @doc.dig("references").map do |reference|
151
+ {
152
+ "name" => reference["name"],
153
+ "summary" => reference["reference"]
154
+ }
155
+ end
176
156
  end
177
157
  end
178
158
  end
@@ -5,87 +5,83 @@ module Extractor
5
5
  end
6
6
 
7
7
  def meta
8
- @doc.dig(:meta)
8
+ @doc.dig("meta")
9
9
  end
10
10
 
11
11
  def basics
12
- @doc.dig(:basics)
12
+ @doc.dig("basics")
13
13
  end
14
14
 
15
15
  def employment
16
- @doc.dig(:employment)
16
+ @doc.dig("employment")
17
17
  end
18
18
 
19
19
  def education
20
- @doc.dig(:education)
20
+ @doc.dig("education")
21
21
  end
22
22
 
23
23
  def projects
24
- @doc.dig(:projects)
24
+ @doc.dig("projects")
25
25
  end
26
26
 
27
27
  def openSource
28
- @doc.dig(:openSource)
28
+ @doc.dig("openSource")
29
29
  end
30
30
 
31
31
  def skills
32
- @doc.dig(:skills)
32
+ @doc.dig("skills")
33
33
  end
34
34
 
35
35
  def qualifications
36
- @doc.dig(:qualifications)
36
+ @doc.dig("qualifications")
37
37
  end
38
38
 
39
39
  def recognition
40
- @doc.dig(:recognition)
40
+ @doc.dig("recognition")
41
41
  end
42
42
 
43
43
  def writing
44
- @doc.dig(:writing)
44
+ @doc.dig("writing")
45
45
  end
46
46
 
47
47
  def reading
48
- @doc.dig(:reading)
48
+ @doc.dig("reading")
49
49
  end
50
50
 
51
51
  def speaking
52
- @doc.dig(:speaking)
52
+ @doc.dig("speaking")
53
53
  end
54
54
 
55
55
  def patents
56
- @doc.dig(:patents)
56
+ @doc.dig("patents")
57
57
  end
58
58
 
59
59
  def languages
60
- @doc.dig(:languages)
60
+ @doc.dig("languages")
61
61
  end
62
62
 
63
63
  def interests
64
- @doc.dig(:interests)
64
+ @doc.dig("interests")
65
65
  end
66
66
 
67
67
  def extracurriculars
68
- @doc.dig(:extracurriculars)
68
+ @doc.dig("extracurriculars")
69
69
  end
70
70
 
71
71
  def affiliations
72
- @doc.dig(:affiliations)
72
+ @doc.dig("affiliations")
73
73
  end
74
74
 
75
75
  def governance
76
- @doc.dig(:governance)
76
+ @doc.dig("governance")
77
77
  end
78
78
 
79
79
  def service
80
- @doc.dig(:service)
80
+ @doc.dig("service")
81
81
  end
82
82
 
83
83
  def references
84
- @doc.dig(:references)
85
- end
86
-
87
- def disposition
88
- @doc.dig(:disposition)
84
+ @doc.dig("references")
89
85
  end
90
86
  end
91
87
  end
@@ -1,4 +1,5 @@
1
1
  require "json"
2
+ require "safe_yaml"
2
3
  require "extractors/base"
3
4
  require "extractors/json/json_resume"
4
5
  require "extractors/json/fresh"
@@ -7,7 +8,7 @@ require "extractors/json/prtflio"
7
8
  module Extractor
8
9
  class Json < Base
9
10
  def initialize(file_path)
10
- @doc = File.open(file_path) { |f| JSON.parse(f.read, symbolize_names: true) }
11
+ @doc = File.open(file_path) { |f| SafeYAML.load(f.read) }
11
12
  end
12
13
 
13
14
  def extract
@@ -20,19 +21,19 @@ module Extractor
20
21
  end
21
22
 
22
23
  attributes.reduce({}) do |hash, attr|
23
- hash[attr.to_sym] = extractor.send(attr.to_sym) if extractor.respond_to?(attr.to_sym)
24
+ hash[attr] = extractor.send(attr) if extractor.respond_to?(attr)
24
25
  hash
25
26
  end
26
27
  end
27
28
 
28
29
  def is_prtflio?
29
- @doc.dig(:meta, :format) &&
30
- @doc.dig(:meta, :format).downcase.include?("prtflio")
30
+ @doc.dig("meta", "format") &&
31
+ @doc.dig("meta", "format").downcase.include?("prtflio")
31
32
  end
32
33
 
33
34
  def is_fresh?
34
- @doc.dig(:meta, :format) &&
35
- @doc.dig(:meta, :format).downcase.include?("fresh")
35
+ @doc.dig("meta", "format") &&
36
+ @doc.dig("meta", "format").downcase.include?("fresh")
36
37
  end
37
38
  end
38
39
  end
@@ -2,6 +2,8 @@ require "extractors/factory"
2
2
  require "exporters/json"
3
3
  require "exporters/xml"
4
4
  require "exporters/md"
5
+ require "exporters/html"
6
+ require "exporters/pdf"
5
7
  require "exporters/txt"
6
8
  require "exporters/yaml"
7
9
 
@@ -27,6 +29,10 @@ class ResumeExporter
27
29
  Exporter::Json.export(data: @data, template: "json_resume")
28
30
  when "xml"
29
31
  Exporter::Xml.export(data: @data)
32
+ when "html"
33
+ Exporter::Html.export(data: @data)
34
+ when "pdf"
35
+ Exporter::Pdf.export(data: @data)
30
36
  when "md"
31
37
  Exporter::Md.export(data: @data)
32
38
  when "yaml"