resme 0.4.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,7 +10,7 @@ def clean string
10
10
  end
11
11
 
12
12
  def full_name data
13
- [data.basics["first_name"], data.basics["middle_name"], data.basics["last_name"]].join(" ")
13
+ [data["basics"]["first_name"], data["basics"]["middle_name"], data["basics"]["last_name"]].join(" ")
14
14
  end
15
15
 
16
16
  # break a string into substrings of length chars breaking at spaces
@@ -59,13 +59,13 @@ end
59
59
  # abstract dates at the year level, taking care of periods if from and
60
60
  # till are in two different years
61
61
  def period entry
62
- if entry["date"] then
63
- "#{year entry.date}"
62
+ if entry["date"]
63
+ "#{year entry["date"]}"
64
64
  else
65
- from_year = entry["from"] ? year(entry.from.to_s) : nil
66
- till_year = entry["till"] ? year(entry.till.to_s) : nil
65
+ from_year = entry["from"] ? year(entry["from"].to_s) : nil
66
+ till_year = entry["till"] ? year(entry["till"].to_s) : nil
67
67
 
68
- if from_year and till_year and from_year == till_year then
68
+ if from_year && till_year && from_year == till_year
69
69
  from_year
70
70
  else
71
71
  "#{from_year} -- #{till_year ? till_year : "today"}"
@@ -132,49 +132,3 @@ def has_day input
132
132
  input.size == 10
133
133
  end
134
134
  end
135
-
136
- # Access hash keys like they were class methods (hash["key"] -> hash.key) and
137
- # report errors if key is missing
138
- class Hash
139
- def method_missing(m)
140
- key = m.to_s
141
-
142
- # we put a bit of info about the top level structure of a resume to avoid
143
- # extra-long error messages I don't want to print detailed information
144
- # about top-level entries missing in the resume
145
- top_level_entries = %w[
146
- contacts addresses web_presence summary work teaching projects other
147
- committees volunteer visits education publications talks awards
148
- achievements software skills languages driving interests references
149
- ]
150
-
151
- # error: nil value
152
- if self.has_key? key and self[key] == nil
153
- $stderr.puts "[W] The value of key '#{key}' is nil in the following entry:"
154
-
155
- unless top_level_entries.include?(key)
156
- # $stderr.puts self.to_s
157
- self.keys.each do |k|
158
- $stderr.puts " #{k}: #{self[k]}"
159
- end
160
- $stderr.puts ""
161
- end
162
- end
163
-
164
- return self[key] if self.has_key? key
165
-
166
- # we get here if the key is not found we report an error, return
167
- # "" and continue the actual mileage might vary
168
-
169
- $stderr.puts "[E] Key '#{key}' not found in the following entry:"
170
- unless top_level_entries.include?(key)
171
- self.keys.each do |k|
172
- $stderr.puts " #{k}: #{self[k]}"
173
- end
174
- $stderr.puts ""
175
- end
176
-
177
- return ""
178
- end
179
- end
180
-
@@ -1,137 +1,155 @@
1
1
  {
2
- "basics": {
3
- "name": "<%= full_name(data).to_json %>",
4
- "label": "<%= data.basics.title.to_json %>",
5
- "picture": "<%= data.basics.picture %>",
6
- "email": "<%= e = data.contacts.select { |x| x.label == "email" }.first; e.value if e %>",
7
- "phone": "<%= p = data.contacts.select { |x| x.label == "mobile" }.first; p.value if p %>",
8
- "website": "<%= w = data.web_presence.select { |x| x.label == "website" }.first; w.value if w %>",
9
- "summary": "<%= data.summary.to_json %>",
10
- "location": {
11
- "address": "<%= data.addresses[0].street.to_json %>",
12
- "postalCode": "<%= data.addresses[0].zip_code %>",
13
- "city": "<%= data.addresses[0].city %>",
14
- "countryCode": "<%= data.addresses[0].country %>",
15
- "region": "<%= data.addresses[0].region %>"
16
- },
17
- "profiles": [
18
- <% sequence = data.web_presence || []; sequence.each_with_index do |profile, index| %>
19
- {
20
- "network": "<%= profile.label %>",
21
- <%# "username": "", %>
22
- "url": "<%= profile.value %>"
23
- }
24
- <%= "," unless index == sequence.size - 1 %>
25
- <% end %>
26
- ]
27
- },
28
- "work": [
29
- <% sequence = data.work || []; sequence.each_with_index do |job, index| %>
30
- {
31
- "company": "<%= job.who.to_json %>",
32
- "position": "<%= job.role.to_json %>",
33
- "website": "<%= job.website %>",
34
- "startDate": "<%= job.from %>",
35
- "endDate": "<%= job.till %>",
36
- "summary": "<%= job.summary.to_json %>"
37
- <%# "highlights": [ "Started the company" ] %>
38
- }
39
- <%= "," unless index == sequence.size - 1 %>
40
- <% end %>
41
- ],
42
- "volunteer": [
43
- <% sequence = data.volunteer || []; sequence.each_with_index do |job, index| %>
44
- {
45
- "organization": "<%= job.who.to_json %>",
46
- "position": "<%= job.role.to_json %>",
47
- "website": "<%= job.website %>",
48
- "startDate": "<%= job.from %>",
49
- "endDate": "<%= job.till %>",
50
- "summary": "<%= job.summary.to_json %>"
51
- <%# "highlights": [ "Started the company" ] %>
52
- }
53
- <%= "," unless index == sequence.size - 1 %>
54
- <% end %>
55
- ],
56
- "education": [
57
- <% sequence = data.education.select { |x| x.publish }; sequence.each_with_index do |edu, index| %>
2
+ "basics": {
3
+ "name": <%= full_name(data).to_json %>,
4
+ "label": <%= data["basics"]["title"].to_json %>,
5
+ <% if data["basics"]["picture"] -%>
6
+ "picture": <%= data["basics"]["picture"] %>,
7
+ <% end -%>
8
+ <% if data["contacts"] -%>
9
+ "email": "<%= ((data["contacts"] || []).select { |x| x["label"] == "email" }.first || {})["value"] %>",
10
+ "phone": "<%= ((data["contacts"] || []).select { |x| x["label"] == "mobile" }.first || {})["value"] %>",
11
+ <% end %>
12
+ <% if data["web_presence"] -%>
13
+ "website": "<%= ((data["web_presence"] || []).select { |x| x["label"] == "website" }.first || {})["value"] %>",
14
+ <% end -%>
15
+ <% if data["summary"] -%>
16
+ "summary": <%= data["summary"].to_json %>,
17
+ <% end -%>
18
+ <% if data["addresses"] -%>
19
+ "location": {
20
+ "address": <%= data["addresses"][0]["street"].to_json %>,
21
+ "postalCode": "<%= data["addresses"][0]["zip_code"] %>",
22
+ "city": "<%= data["addresses"][0]["city"] %>",
23
+ "countryCode": "<%= data["addresses"][0]["country"] %>",
24
+ "region": "<%= data["addresses"][0]["region"] %>"
25
+ },
26
+ <% end -%>
27
+ <% if data["web_presence"] -%>
28
+ "profiles": [
29
+ <% (data["web_presence"] || []).each do |profile| -%>
30
+ {
31
+ "network": "<%= profile["label"] %>",
32
+ "url": "<%= profile["value"] %>"
33
+ },
34
+ <% end -%>
35
+ ]
36
+ <% end -%>
37
+ },
38
+ <% if data["work"] -%>
39
+ "work": [
40
+ <% (data["work"] || []).each do |job| -%>
58
41
  {
59
- "institution": "<%= edu.school.to_json %>",
60
- "area": "<%= edu.topic.to_json %>",
61
- "studyType": "<%= edu.degree.to_json %>",
62
- "startDate": "<%= edu.from %>",
63
- "endDate": "<%= edu.till %>",
64
- "gpa": "<%= edu.score %>"
65
- <%# "courses": [ "DB1101 - Basic SQL" ] %>
66
- }
67
- <%= "," unless index == sequence.size - 1 %>
68
- <% end %>
69
- ],
70
- "awards": [
71
- <% sequence = data.awards || []; sequence.each_with_index do |award, index| %>
72
- {
73
- "title": "<%= award.title.to_json %>",
74
- "date": "<%= award.date %>",
75
- "awarder": "<%= award.who.to_json %>"
76
- "summary": "<%= award.summary.to_json %>"
77
- }
78
- <%= "," unless index == sequence.size - 1 %>
79
- <% end %>
80
- ],
81
- "publications": [
82
- <% squence = data.publications || []; sequence.each_with_index do |pub, index| %>
83
- {
84
- "name": "<%= pub.title.to_json %>",
85
- "publisher": "<%= pub.publisher.to_json %>",
86
- "releaseDate": "<%= pub.date %>",
87
- "website": "<%= pub.url %>",
88
- "summary": "<%= pub.summary.to_json %>"
89
- }
90
- <%= "," unless index == sequence.size - 1 %>
91
- <% end %>
92
- ],
93
- "skills": [
94
- <% sequence = data.skills || []; sequence.each_with_index do |skill, index| %>
95
- {
96
- "name": "<%= skill.name.to_json %>",
97
- "level": "<%= skill.level.to_json %>"
98
- <%# "keywords": [...] %>
99
- }
100
- <%= "," unless index == sequence.size - 1 %>
101
- <% end %>
102
- ],
103
- "languages": [
104
- <% data.languages.mother_tongues.each do |mt| %>
42
+ "company": <%= job["who"].to_json %>,
43
+ "position": <%= job["role"].to_json %>,
44
+ "website": "<%= job["website"] %>",
45
+ "startDate": "<%= job["from"] %>",
46
+ "endDate": "<%= job["till"] %>",
47
+ "summary": <%= job["summary"].to_json %>
48
+ <%# "highlights": [ "Started the company" ] %>
49
+ },
50
+ <% end -%>
51
+ ],
52
+ <% end -%>
53
+ <% if data["volunteer"] -%>
54
+ "volunteer": [
55
+ <% (data["volunteer"] || []).each do |job| -%>
105
56
  {
106
- "name": "<%= mt.language.to_json %>",
107
- "level": "Native speaker"
108
- }
109
- <%= "," unless data.languages.foreign == nil %>
110
- <% end %>
111
- <% sequence = data.languages.foreign || []; sequence.each_with_index do |lang, index| %>
57
+ "organization": <%= job["who"].to_json %>,
58
+ "position": <%= job["role"].to_json %>,
59
+ "website": "<%= job["website"] %>",
60
+ "startDate": "<%= job["from"] %>",
61
+ "endDate": "<%= job["till"] %>",
62
+ "summary": <%= job["summary"].to_json %>
63
+ <%# "highlights": [ "Started the company" ] %>
64
+ },
65
+ <% end -%>
66
+ ],
67
+ <% end %>
68
+ <% if data["education"] %>
69
+ "education": [
70
+ <% data["education"].select { |x| x["publish"] }.each do |edu| -%>
71
+ {
72
+ "institution": <%= edu["school"].to_json %>,
73
+ "area": <%= edu["topic"].to_json %>,
74
+ "studyType": <%= edu["degree"].to_json %>,
75
+ "startDate": "<%= edu["from"] %>",
76
+ "endDate": "<%= edu["till"] %>",
77
+ "gpa": "<%= edu["score"] %>"
78
+ <%# "courses": [ "DB1101 - Basic SQL" ] %>
79
+ },
80
+ <% end -%>
81
+ ],
82
+ <% end -%>
83
+ <% if data["awards"] -%>
84
+ "awards": [
85
+ <% (data["awards"] || []).each do |award| -%>
112
86
  {
113
- "name": "<%= lang.language.to_json %>",
114
- "level": "<%= lang.level.to_json %>"
115
- }
116
- <%= "," unless index == sequence.size - 1 %>
117
- <% end %>
118
- ],
119
- "interests": [
120
- <% sequence = data.interests || []; sequence.each_with_index do |interest, index| %>
87
+ "title": <%= award["title"].to_json %>,
88
+ "date": <%= award["date"] %>,
89
+ "awarder": <%= award["who"].to_json %>,
90
+ "summary": <%= award["summary"].to_json %>
91
+ },
92
+ <% end -%>
93
+ ],
94
+ <% end -%>
95
+ <% if data["publications"] -%>
96
+ "publications": [
97
+ <% (data["publications"] || []).each do |pub| -%>
121
98
  {
122
- "name": "<%= interest.name.to_json %>",
123
- <%# "keywords": [...] %>
99
+ "name": <%= pub["title"].to_json %>,
100
+ "publisher": <%= pub["publisher"].to_json %>,
101
+ "releaseDate": "<%= pub["date"] %>",
102
+ "website": "<%= pub["url"] %>",
103
+ "summary": <%= pub["summary"].to_json %>
124
104
  },
125
- <%= "," unless index == sequence.size - 1 %>
126
- <% end %>
127
- ],
128
- "references": [
129
- <% sequence = data.references || []; sequence.each_with_index do |reference, index| %>
130
- {
131
- "name": "<%= reference.name.to_json %>",
132
- "reference": "<%= reference.reference.to_json %>"
133
- }
134
- <%= "," unless index == sequence.size - 1 %>
135
- <% end %>
136
- ]
105
+ <% end -%>
106
+ ],
107
+ <% end -%>
108
+ <% if data["skills"] -%>
109
+ "skills": [
110
+ <% (data["skills"] || []).each do |skill| -%>
111
+ {
112
+ "name": <%= skill["name"].to_json %>,
113
+ "level": <%= skill["level"].to_json %>
114
+ <%# "keywords": [...] -%>
115
+ },
116
+ <% end -%>
117
+ ],
118
+ <% end -%>
119
+ <% if data["languages"] -%>
120
+ "languages": [
121
+ <% data["languages"]["mother_tongues"].each do |mt| -%>
122
+ {
123
+ "name": <%= mt["language"].to_json %>,
124
+ "level": "Native speaker"
125
+ },
126
+ <% end -%>
127
+ <% (data["languages"]["foreign"] || []).each do |lang| -%>
128
+ {
129
+ "name": <%= lang["language"].to_json %>,
130
+ "level": <%= lang["level"].to_json %>
131
+ },
132
+ <% end -%>
133
+ ],
134
+ <% end -%>
135
+ <% if data["interests"] -%>
136
+ "interests": [
137
+ <% (data["interests"] || []).each do |interest| -%>
138
+ {
139
+ "name": <%= interest["name"].to_json %>,
140
+ <%# "keywords": [...] -%>
141
+ },
142
+ <% end -%>
143
+ ],
144
+ <% end -%>
145
+ <% if data["references"] -%>
146
+ "references": [
147
+ <% (data["references"] || []).each do |reference| -%>
148
+ {
149
+ "name": <%= reference["name"].to_json %>,
150
+ "reference": <%= reference["reference"].to_json %>
151
+ },
152
+ <% end -%>
153
+ ]
154
+ <% end %>
137
155
  }
@@ -1,8 +1,8 @@
1
- # <%= full_name data %>, <%= data.basics&.title %>
1
+ # <%= full_name data %>, <%= data["basics"]["title"] %>
2
2
 
3
3
  <%
4
- addresses = (data["addresses"] || []).map { |x| "**#{x.label}**: #{x.street}, #{x.zip_code} #{x.city}" }
5
- presence = (data["contacts"] || []).map { |x| "**#{x.label}:** #{x.value}" } + (data["web_presence"] || []).map { |x| "<" + x.value + ">" }
4
+ addresses = (data["addresses"] || []).map { |x| "**#{x['label']}**: #{x['street']}, #{x['zip_code']} #{x['city']}" }
5
+ presence = (data["contacts"] || []).map { |x| "**#{x['label']}:** #{x['value']}" } + (data["web_presence"] || []).map { |x| "<" + x["value"] + ">" }
6
6
  -%>
7
7
  <%= presence.map { |x| "* #{x}" }.join("\n") %>
8
8
  <%= addresses.map { |x| "* #{x}" }.join("\n") %>
@@ -10,21 +10,21 @@ presence = (data["contacts"] || []).map { |x| "**#{x.label}:** #{x.value}" } + (
10
10
  <% if data["summary"] -%>
11
11
  ## Summary
12
12
 
13
- <%= reflow_to_string data.summary, 78 -%>
13
+ <%= reflow_to_string data["summary"], 78 -%>
14
14
  <% end -%>
15
15
 
16
16
  <% if data["skills"] -%>
17
17
  ## Skills
18
18
 
19
- <% (data.skills || []).each do |item| -%>
20
- - **<%= item.name %>:** <%= item.level %>
19
+ <% (data["skills"] || []).each do |item| -%>
20
+ - **<%= item["name"] %>:** <%= item["level"] %>
21
21
  <% end -%>
22
22
  <% end -%>
23
23
 
24
24
  <% if data["work"] -%>
25
25
  ## Work Experience
26
26
 
27
- <% (data.work || []).each do |item| -%>
27
+ <% (data["work"] || []).each do |item| -%>
28
28
  <%= itemize item -%>
29
29
  <% end -%>
30
30
  <% end -%>
@@ -32,7 +32,7 @@ presence = (data["contacts"] || []).map { |x| "**#{x.label}:** #{x.value}" } + (
32
32
  <% if data["teaching"] -%>
33
33
  ## Teaching
34
34
 
35
- <% (data.teaching || []).each do |item| -%>
35
+ <% (data["teaching"] || []).each do |item| -%>
36
36
  <%= itemize item, ["subject", "role"] -%>
37
37
  <% end -%>
38
38
  <% end -%>
@@ -40,7 +40,7 @@ presence = (data["contacts"] || []).map { |x| "**#{x.label}:** #{x.value}" } + (
40
40
  <% if data["projects"] -%>
41
41
  ## Projects
42
42
 
43
- <% (data.projects || []).each do |item| -%>
43
+ <% (data["projects"] || []).each do |item| -%>
44
44
  <%= itemize item, ["name", "role"] -%>
45
45
  <% end -%>
46
46
  <% end -%>
@@ -48,7 +48,7 @@ presence = (data["contacts"] || []).map { |x| "**#{x.label}:** #{x.value}" } + (
48
48
  <% if data["other"] -%>
49
49
  ## Other Initiatives
50
50
 
51
- <% (data.other || []).each do |item| -%>
51
+ <% (data["other"] || []).each do |item| -%>
52
52
  <%= itemize item -%>
53
53
  <% end -%>
54
54
  <% end -%>
@@ -56,16 +56,16 @@ presence = (data["contacts"] || []).map { |x| "**#{x.label}:** #{x.value}" } + (
56
56
  <% if data["committees"] -%>
57
57
  ## Committees
58
58
 
59
- <% (data.committees || []).each do |item| -%>
60
- - <%= item.role %> (<%= item.url %>)
61
- <%= item.editions %>
59
+ <% (data["committees"] || []).each do |item| -%>
60
+ - <%= item["role"] %> (<%= item["url"] %>)
61
+ <%= item["editions"] %>
62
62
  <% end -%>
63
63
  <% end -%>
64
64
 
65
65
  <% if data["volunteer"] -%>
66
66
  ## Volunteer
67
67
 
68
- <% (data.volunteer || []).each do |item| -%>
68
+ <% (data["volunteer"] || []).each do |item| -%>
69
69
  <%= itemize item -%>
70
70
  <% end -%>
71
71
  <% end -%>
@@ -73,24 +73,24 @@ presence = (data["contacts"] || []).map { |x| "**#{x.label}:** #{x.value}" } + (
73
73
  <% if data["publications"] -%>
74
74
  ## Publications
75
75
 
76
- <% (data.publications || []).each do |item| -%>
77
- - <%= item.authors %>, *"<%= item.title %>"* <%= item.publisher %>, <%= item.date %>
76
+ <% (data["publications"] || []).each do |item| -%>
77
+ - <%= item["authors"] %>, *"<%= item["title"] %>"* <%= item["publisher"] %>, <%= item["date"] %>
78
78
  <% end -%>
79
79
  <% end -%>
80
80
 
81
81
  <% if data["talks"] -%>
82
82
  ## Talks
83
83
 
84
- <% (data.talks || []).each do |item| -%>
85
- - *<%= item.title %>*
86
- <%= item.venue %>, <%= item.date %>
84
+ <% (data["talks"] || []).each do |item| -%>
85
+ - *<%= item["title"] %>*
86
+ <%= item["venue"] %>, <%= item["date"] %>
87
87
  <% end -%>
88
88
  <% end -%>
89
89
 
90
90
  <% if data["visits"] -%>
91
91
  ## Visits
92
92
 
93
- <% (data.visits || []).each do |item| -%>
93
+ <% (data["visits"] || []).each do |item| -%>
94
94
  <%= itemize item -%>
95
95
  <% end -%>
96
96
  <% end -%>
@@ -98,10 +98,10 @@ presence = (data["contacts"] || []).map { |x| "**#{x.label}:** #{x.value}" } + (
98
98
  <% if data["education"] -%>
99
99
  ## Education
100
100
 
101
- <% data.education.select { |x| x.publish }.each do |school| -%>
101
+ <% data["education"].select { |x| x["publish"] }.each do |school| -%>
102
102
  <%= year(school["till"]) %>
103
- : <%= [school["degree"], school.school].join(", ") %>
104
- <%= school.address if school.address %>
103
+ : <%= [school["degree"], school["school"]].join(", ") %>
104
+ <%= school["address"] if school["address"] %>
105
105
  <% end -%>
106
106
  <% end -%>
107
107
 
@@ -119,31 +119,31 @@ presence = (data["contacts"] || []).map { |x| "**#{x.label}:** #{x.value}" } + (
119
119
  <% if data["software"] %>
120
120
  ## Software
121
121
 
122
- <% (data.software || []).each do |item| -%>
123
- - <%= item.title %> (<%= item.role %>)
124
- <%= item.url %>
122
+ <% (data["software"] || []).each do |item| -%>
123
+ - <%= item["title"] %> (<%= item["role"] %>)
124
+ <%= item["url"] %>
125
125
  <% end -%>
126
126
  <% end -%>
127
127
 
128
128
  <% if data["interests"] -%>
129
129
  ## Interests
130
130
 
131
- <% (data.interests || []).each do |item| -%>
132
- - <%= item.name %> <%= reflow_to_string item.summary, 72, " " %>
131
+ <% (data["interests"] || []).each do |item| -%>
132
+ - <%= item["name"] %> <%= reflow_to_string item["summary"], 72, " " %>
133
133
  <% end -%>
134
134
  <% end -%>
135
135
 
136
136
  <% if data["languages"] %>
137
137
  ## Languages
138
138
 
139
- <% if data["languages"] and data.languages["mother_tongues"] -%>
140
- Mother Tongue(s): <%= data.languages.mother_tongues.map { |x| x.language }.join(",") %>
139
+ <% if data["languages"] and data["languages"]["mother_tongues"] -%>
140
+ Mother Tongue(s): <%= data["languages"]["mother_tongues"].map { |x| x["language"] }.join(",") %>
141
141
  <% end -%>
142
142
 
143
- <% if data["languages"] and data.languages["foreign"] -%>
143
+ <% if data["languages"] and data["languages"]["foreign"] -%>
144
144
  Other Language(s):
145
- <% data.languages.foreign.each do |x| -%>
146
- - <%= x.language %>: <%= x.level %>
145
+ <% data["languages"]["foreign"].each do |x| -%>
146
+ - <%= x["language"] %>: <%= x["level"] %>
147
147
  <% end -%>
148
148
  <% end -%>
149
149
  <% end -%>
@@ -151,9 +151,9 @@ Other Language(s):
151
151
  <% if data["references"] %>
152
152
  ## References
153
153
 
154
- <% (data.references || []).each do |item| -%>
155
- <%= item.name %>:
156
- <%= reflow_to_string item.reference, 72, " " %>
154
+ <% (data["references"] || []).each do |item| -%>
155
+ <%= item["name"] %>:
156
+ <%= reflow_to_string item["reference"], 72, " " %>
157
157
  <% end -%>
158
158
  <% end -%>
159
159