virgild-resumetools 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +0 -0
- data/LICENSE +22 -0
- data/README.md +203 -0
- data/Rakefile +38 -0
- data/examples/sample.pdf +1751 -0
- data/examples/sample.resume +150 -0
- data/lib/grammars/resume.treetop +389 -0
- data/lib/resume/pdf.rb +158 -0
- data/lib/resume/resume.rb +231 -0
- data/lib/resume/text_reader.rb +107 -0
- data/lib/resumetools/version.rb +35 -0
- data/lib/resumetools.rb +34 -0
- data/spec/grammar_spec.rb +93 -0
- data/spec/read_resume_spec.rb +61 -0
- data/spec/rendering_pdf_spec.rb +37 -0
- data/spec/resume_spec.rb +213 -0
- data/spec/spec.opts +2 -0
- data/spec/spec_helper.rb +39 -0
- data/tasks/default.rake +1 -0
- data/tasks/gem.rake +77 -0
- data/tasks/package.rake +9 -0
- data/tasks/rdoc.rake +29 -0
- data/tasks/rspec.rake +16 -0
- metadata +128 -0
@@ -0,0 +1,150 @@
|
|
1
|
+
#N Thomas B. Seeker
|
2
|
+
#A 1234 Northern Star Circle
|
3
|
+
#A Baltimore, MD 12345
|
4
|
+
#T (410) 555-1212
|
5
|
+
#E seeker@nettcom.com
|
6
|
+
#U http://nettcom.com/tseeker
|
7
|
+
|
8
|
+
= Career Goal
|
9
|
+
---
|
10
|
+
Client Server Systems Architect for a high technology firm
|
11
|
+
---
|
12
|
+
|
13
|
+
= Qualifications Summary
|
14
|
+
---
|
15
|
+
Nine years of experience in designing, installing, and troubleshooting
|
16
|
+
computing systems; a proven track record in identifying problems and
|
17
|
+
developing innovative solutions.
|
18
|
+
---
|
19
|
+
|
20
|
+
= Technical Skills
|
21
|
+
|
22
|
+
- PROGRAMMING: C, C++, Visual BASIC, FORTRAN, Pascal, SQL, OSF/Motif,
|
23
|
+
UNIX Shell Script (sh, ksh, csh), BASIC, Clipper, Algol 68, and 80X86 Assembler.
|
24
|
+
|
25
|
+
- OPERATING SYSTEMS: UNIX (bsd & SVr3/r4), MS Windows, MS DOS, MS Windows NT,
|
26
|
+
Solaris, HP-UX, Ultrix, AIX, VAX/VMS, and Macintosh System 7.
|
27
|
+
|
28
|
+
- NETWORKING: TCP/IP, OSI, Microsoft LAN Manager, Novell Netware, DDN, Internet,
|
29
|
+
Ethernet, Token Ring, SNA, X.25, LAN-WAN interconnection.
|
30
|
+
|
31
|
+
- APPLICATIONS: Microsoft Office, Microsoft Access, Microsoft Visual C++,
|
32
|
+
Microsoft Project, Microsoft Publisher, Lotus 123, Lotus Freelance,
|
33
|
+
System Architect, and others.
|
34
|
+
|
35
|
+
= Professional Experience
|
36
|
+
|
37
|
+
+ Systems Engineer
|
38
|
+
>O Computer Engineering Corporation
|
39
|
+
>L Los Angeles, CA
|
40
|
+
>D 1993 to Present
|
41
|
+
- Provide systems engineering, software engineering, technical consulting, and
|
42
|
+
marketing services as a member of the Systems Integration Division of a
|
43
|
+
software engineering consulting company.
|
44
|
+
|
45
|
+
- Designed and managed the development of an enterprise-level client/server
|
46
|
+
automated auditing application for a major financial management company
|
47
|
+
migrating from mainframe computers, db2, and FOCUS to a workgroup
|
48
|
+
oriented, client/server architecture involving Windows for Workgroups,
|
49
|
+
Windows NT Advanced Server, Microsoft SQL Server, Oracle7, and UNIX.
|
50
|
+
|
51
|
+
- Designed an enterprise level, high performance, mission-critical,
|
52
|
+
client/server database system incorporating symmetric multiprocessing
|
53
|
+
computers (SMP), Oracle7's Parallel Server, Tuxedo's on-line transaction
|
54
|
+
processing (OLTP) monitor, and redundant array of inexpensive disks
|
55
|
+
(RAID) technology.
|
56
|
+
|
57
|
+
- Conducted extensive trade studies of a large number of vendors that offer
|
58
|
+
leading-edge technologies; these studies identified proven (low-risk)
|
59
|
+
implementations of SMP and RDBMS systems that met stringent performance
|
60
|
+
and availability criteria.
|
61
|
+
|
62
|
+
+ Systems Analyst
|
63
|
+
>O Business Consultants, Inc.
|
64
|
+
>L Washington, DC
|
65
|
+
>D 1990 to 1993
|
66
|
+
- Provided technical consulting services to the Smithsonian Institute's
|
67
|
+
Information Technology Services Group, Amnesty International, and
|
68
|
+
internal research and development initiatives.
|
69
|
+
|
70
|
+
- Consolidated and documented the Smithsonian Laboratory's Testing,
|
71
|
+
Demonstration, and Training databases onto a single server, maximizing
|
72
|
+
the use of the laboratory's computing resources.
|
73
|
+
|
74
|
+
- Brought the Smithsonian Laboratory on-line with the Internet.
|
75
|
+
|
76
|
+
- Successfully integrated and delivered to Amnesty International an
|
77
|
+
$80,000 HP 9000/750 Server consisting of 8 Gigabytes of disk space
|
78
|
+
and 9 software systems that required extensive porting work and
|
79
|
+
documentation.
|
80
|
+
|
81
|
+
+ Automated Data Processor
|
82
|
+
>O US Army Infantry
|
83
|
+
>L Germany
|
84
|
+
>D 1986 to 1990
|
85
|
+
- Analyzed problems and ADP processes; designed, tested, and implemented
|
86
|
+
software and hardware systems for an organizational operations center.
|
87
|
+
|
88
|
+
- Supervised the maintenance, deployment, installation, and operation of
|
89
|
+
a battalion's personnel system that monitored and controlled up to 12
|
90
|
+
platoons in a fast-paced, technically demanding environment.
|
91
|
+
|
92
|
+
- Designed a maintenance reporting program that converted the labor
|
93
|
+
intensive task of producing weekly status reports from a 4-day to a
|
94
|
+
2-hour process.
|
95
|
+
|
96
|
+
- Developed a departmental computer literacy training program, teaching
|
97
|
+
classes on microcomputer operating systems, office automation software,
|
98
|
+
and introductory programming.
|
99
|
+
|
100
|
+
- Taught a "Structured Programming and Problem Solving" course for the
|
101
|
+
Community Education Center after work hours.
|
102
|
+
|
103
|
+
= Education
|
104
|
+
|
105
|
+
+ Computer Systems Technology Program
|
106
|
+
>O Air Force Institute of Technology (AFIT)
|
107
|
+
|
108
|
+
+ BS, Mathematics/Computer Science
|
109
|
+
>O University of California, Los Angeles (UCLA)
|
110
|
+
|
111
|
+
= Specialized Training
|
112
|
+
|
113
|
+
- Database Administration, Performance Tuning, and Benchmarking with
|
114
|
+
Oracle7; Oracle Corporation.
|
115
|
+
|
116
|
+
- Software Requirements Engineering and Management Course;
|
117
|
+
Computer Applications International Corporation.
|
118
|
+
|
119
|
+
- X.400 Messaging and Allied Communications Procedures-123 Profile;
|
120
|
+
ComTechnologies, Inc.
|
121
|
+
|
122
|
+
- GOSIP LAN Operating System Network Administration; ETC, Inc.
|
123
|
+
|
124
|
+
- Interactive UNIX System V r4 (POSIX) System Administration; ETC, Inc.
|
125
|
+
|
126
|
+
- Effective Briefing Techniques and Technical Presentations;
|
127
|
+
William French and Associates, Inc.
|
128
|
+
|
129
|
+
- Transmission Control Protocol/Internet Protocol (TCP/IP);
|
130
|
+
Technology Systems Institute.
|
131
|
+
|
132
|
+
- LAN Interconnection Using Bridges, Routers, and Gateways;
|
133
|
+
Information Systems Institute.
|
134
|
+
|
135
|
+
- OSI X.400/X.500 Messaging and Directory Service Protocols;
|
136
|
+
Communication Technologies, Inc.
|
137
|
+
|
138
|
+
- US Army Signal Officer Advanced Course, US Army Signal Center,
|
139
|
+
Georgia; Honor Graduate.
|
140
|
+
|
141
|
+
= Certification, Honors, and Professional Affiliations
|
142
|
+
|
143
|
+
- MCP Trainer, DCS.
|
144
|
+
- MCP Trainer, SDD.
|
145
|
+
- MCP Certified Systems Engineer.
|
146
|
+
- MCP Certified Product Specialist, Networking, MS TCP/IP, and
|
147
|
+
MS Mail 3.2 for PC Networks.
|
148
|
+
- Member, Armed Forces Communications and Electronics Association (AFCEA).
|
149
|
+
- Recipient, Department of Defense Meritorious Service Medal, Defense
|
150
|
+
Information Systems Agency (DISA).
|
@@ -0,0 +1,389 @@
|
|
1
|
+
grammar Resume
|
2
|
+
|
3
|
+
rule document
|
4
|
+
((contact_data / section / period / period_data / item / para / data) / LF)*
|
5
|
+
end
|
6
|
+
|
7
|
+
rule period_data
|
8
|
+
period_org / period_loc / period_dates / period_detail
|
9
|
+
end
|
10
|
+
|
11
|
+
rule period_org
|
12
|
+
period_detail_marker "O" whitespace content:text LF+ {
|
13
|
+
def data_type
|
14
|
+
:period_organization
|
15
|
+
end
|
16
|
+
|
17
|
+
def value
|
18
|
+
content.text_value.squeeze(" ").strip
|
19
|
+
end
|
20
|
+
|
21
|
+
def inspect
|
22
|
+
"Organization: " + value
|
23
|
+
end
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
rule period_loc
|
28
|
+
period_detail_marker "L" whitespace content:text LF+ {
|
29
|
+
def data_type
|
30
|
+
:period_location
|
31
|
+
end
|
32
|
+
|
33
|
+
def value
|
34
|
+
content.text_value.squeeze(" ").strip
|
35
|
+
end
|
36
|
+
|
37
|
+
def inspect
|
38
|
+
"Location: " + value
|
39
|
+
end
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
rule period_dates
|
44
|
+
period_detail_marker "D" whitespace content:text LF+ {
|
45
|
+
def data_type
|
46
|
+
:period_dates
|
47
|
+
end
|
48
|
+
|
49
|
+
def value
|
50
|
+
content.text_value.squeeze(" ").strip
|
51
|
+
end
|
52
|
+
|
53
|
+
def inspect
|
54
|
+
"Dates: " + value
|
55
|
+
end
|
56
|
+
}
|
57
|
+
end
|
58
|
+
|
59
|
+
rule contact_data
|
60
|
+
contact_name / contact_telephone / contact_email / contact_address /
|
61
|
+
contact_url / contact_detail
|
62
|
+
end
|
63
|
+
|
64
|
+
rule contact_url
|
65
|
+
contact_marker "U" whitespace content:text LF+ {
|
66
|
+
def data_type
|
67
|
+
:contact_url
|
68
|
+
end
|
69
|
+
|
70
|
+
def value
|
71
|
+
content.text_value.squeeze(" ").strip
|
72
|
+
end
|
73
|
+
|
74
|
+
def inspect
|
75
|
+
"Contact URL: " + value
|
76
|
+
end
|
77
|
+
}
|
78
|
+
end
|
79
|
+
|
80
|
+
rule contact_address
|
81
|
+
contact_marker "A" whitespace content:text LF+ {
|
82
|
+
def data_type
|
83
|
+
:contact_address
|
84
|
+
end
|
85
|
+
|
86
|
+
def value
|
87
|
+
content.text_value.squeeze(" ").strip
|
88
|
+
end
|
89
|
+
|
90
|
+
def inspect
|
91
|
+
"Contact address: " + value
|
92
|
+
end
|
93
|
+
}
|
94
|
+
end
|
95
|
+
|
96
|
+
rule contact_telephone
|
97
|
+
contact_marker "T" whitespace content:text LF+ {
|
98
|
+
def data_type
|
99
|
+
:contact_telephone
|
100
|
+
end
|
101
|
+
|
102
|
+
def value
|
103
|
+
content.text_value.squeeze(" ").strip
|
104
|
+
end
|
105
|
+
|
106
|
+
def inspect
|
107
|
+
"Contact telephone: " + value
|
108
|
+
end
|
109
|
+
}
|
110
|
+
end
|
111
|
+
|
112
|
+
rule contact_email
|
113
|
+
contact_marker "E" whitespace content:text LF+ {
|
114
|
+
def data_type
|
115
|
+
:contact_email
|
116
|
+
end
|
117
|
+
|
118
|
+
def value
|
119
|
+
content.text_value.squeeze(" ").strip
|
120
|
+
end
|
121
|
+
|
122
|
+
def inspect
|
123
|
+
"Contact e-mail: " + value
|
124
|
+
end
|
125
|
+
}
|
126
|
+
end
|
127
|
+
|
128
|
+
rule contact_telephone
|
129
|
+
contact_marker "T" whitespace content:text LF+ {
|
130
|
+
def data_type
|
131
|
+
:contact_telephone
|
132
|
+
end
|
133
|
+
|
134
|
+
def value
|
135
|
+
content.text_value.squeeze(" ").strip
|
136
|
+
end
|
137
|
+
|
138
|
+
def inspect
|
139
|
+
"Contact telephone: " + value
|
140
|
+
end
|
141
|
+
}
|
142
|
+
end
|
143
|
+
|
144
|
+
rule contact_name
|
145
|
+
contact_marker "N" whitespace content:text LF+ {
|
146
|
+
def data_type
|
147
|
+
:contact_name
|
148
|
+
end
|
149
|
+
|
150
|
+
def value
|
151
|
+
content.text_value.squeeze(" ").strip
|
152
|
+
end
|
153
|
+
|
154
|
+
def inspect
|
155
|
+
"Contact name: " + value
|
156
|
+
end
|
157
|
+
}
|
158
|
+
end
|
159
|
+
|
160
|
+
rule item
|
161
|
+
item_marker whitespace content:(item_data+) {
|
162
|
+
def data_type
|
163
|
+
:item
|
164
|
+
end
|
165
|
+
|
166
|
+
def value
|
167
|
+
content.text_value.gsub("\n", ' ').gsub("\t", ' ').squeeze(" ").strip
|
168
|
+
end
|
169
|
+
|
170
|
+
def inspect
|
171
|
+
"Item: " + value[0..100]
|
172
|
+
end
|
173
|
+
}
|
174
|
+
end
|
175
|
+
|
176
|
+
rule item_data
|
177
|
+
continuation content:text LF+ {
|
178
|
+
def inspect
|
179
|
+
content.text_value
|
180
|
+
end
|
181
|
+
}
|
182
|
+
end
|
183
|
+
|
184
|
+
rule continuation
|
185
|
+
[^-=>#+\n]
|
186
|
+
end
|
187
|
+
|
188
|
+
rule period_detail
|
189
|
+
period_detail_marker whitespace content:text LF+ {
|
190
|
+
def data_type
|
191
|
+
:period_detail
|
192
|
+
end
|
193
|
+
|
194
|
+
def value
|
195
|
+
content.text_value.squeeze(" ").strip
|
196
|
+
end
|
197
|
+
|
198
|
+
def inspect
|
199
|
+
"Detail: " + value
|
200
|
+
end
|
201
|
+
}
|
202
|
+
end
|
203
|
+
|
204
|
+
rule period
|
205
|
+
period_marker whitespace content:text LF {
|
206
|
+
def data_type
|
207
|
+
:period
|
208
|
+
end
|
209
|
+
|
210
|
+
def value
|
211
|
+
content.text_value.squeeze(" ").strip
|
212
|
+
end
|
213
|
+
|
214
|
+
def inspect
|
215
|
+
"Period: " + value
|
216
|
+
end
|
217
|
+
}
|
218
|
+
end
|
219
|
+
|
220
|
+
rule para
|
221
|
+
para_marker LF
|
222
|
+
content:(!("---") text LF)*
|
223
|
+
para_marker LF+ {
|
224
|
+
def data_type
|
225
|
+
:paragraph
|
226
|
+
end
|
227
|
+
|
228
|
+
def value
|
229
|
+
content.text_value.gsub(/\n/, ' ').squeeze(" ").strip
|
230
|
+
end
|
231
|
+
|
232
|
+
def inspect
|
233
|
+
"Paragraph: " + value[0..100]
|
234
|
+
end
|
235
|
+
}
|
236
|
+
end
|
237
|
+
|
238
|
+
rule section
|
239
|
+
section_marker whitespace content:text LF+ {
|
240
|
+
def data_type
|
241
|
+
:section
|
242
|
+
end
|
243
|
+
|
244
|
+
def value
|
245
|
+
content.text_value.squeeze(" ").strip
|
246
|
+
end
|
247
|
+
|
248
|
+
def inspect
|
249
|
+
"Section: " + elements[2].text_value
|
250
|
+
end
|
251
|
+
}
|
252
|
+
end
|
253
|
+
|
254
|
+
rule contact_detail
|
255
|
+
contact_marker whitespace content:text LF {
|
256
|
+
def data_type
|
257
|
+
:contact_detail
|
258
|
+
end
|
259
|
+
def value
|
260
|
+
content.text_value.squeeze(" ").strip
|
261
|
+
end
|
262
|
+
|
263
|
+
def inspect
|
264
|
+
"Contact detail: " + value
|
265
|
+
end
|
266
|
+
}
|
267
|
+
end
|
268
|
+
|
269
|
+
rule data
|
270
|
+
content:(text) LF {
|
271
|
+
def data_type
|
272
|
+
:untyped
|
273
|
+
end
|
274
|
+
|
275
|
+
def value
|
276
|
+
content.text_value
|
277
|
+
end
|
278
|
+
|
279
|
+
def inspect
|
280
|
+
"Data: \"" + value[0..100] + "\""
|
281
|
+
end
|
282
|
+
}
|
283
|
+
end
|
284
|
+
|
285
|
+
rule text
|
286
|
+
([^\n])+ {
|
287
|
+
def value
|
288
|
+
text_value
|
289
|
+
end
|
290
|
+
|
291
|
+
def inspect
|
292
|
+
"Line: " + value
|
293
|
+
end
|
294
|
+
}
|
295
|
+
end
|
296
|
+
|
297
|
+
rule LF
|
298
|
+
[\n] {
|
299
|
+
def data_type
|
300
|
+
nil
|
301
|
+
end
|
302
|
+
|
303
|
+
def value
|
304
|
+
""
|
305
|
+
end
|
306
|
+
|
307
|
+
def inspect
|
308
|
+
value
|
309
|
+
end
|
310
|
+
}
|
311
|
+
end
|
312
|
+
|
313
|
+
rule whitespace
|
314
|
+
[\t ]
|
315
|
+
end
|
316
|
+
|
317
|
+
rule contact_marker
|
318
|
+
"#" {
|
319
|
+
def value
|
320
|
+
nil
|
321
|
+
end
|
322
|
+
|
323
|
+
def inspect
|
324
|
+
"#"
|
325
|
+
end
|
326
|
+
}
|
327
|
+
end
|
328
|
+
|
329
|
+
rule item_marker
|
330
|
+
"-" {
|
331
|
+
def value
|
332
|
+
nil
|
333
|
+
end
|
334
|
+
|
335
|
+
def inspect
|
336
|
+
"-"
|
337
|
+
end
|
338
|
+
}
|
339
|
+
end
|
340
|
+
|
341
|
+
rule section_marker
|
342
|
+
"=" {
|
343
|
+
def value
|
344
|
+
nil
|
345
|
+
end
|
346
|
+
|
347
|
+
def inspect
|
348
|
+
"="
|
349
|
+
end
|
350
|
+
}
|
351
|
+
end
|
352
|
+
|
353
|
+
rule period_marker
|
354
|
+
"+" {
|
355
|
+
def value
|
356
|
+
nil
|
357
|
+
end
|
358
|
+
|
359
|
+
def inspect
|
360
|
+
"+"
|
361
|
+
end
|
362
|
+
}
|
363
|
+
end
|
364
|
+
|
365
|
+
rule period_detail_marker
|
366
|
+
">" {
|
367
|
+
def value
|
368
|
+
nil
|
369
|
+
end
|
370
|
+
|
371
|
+
def inspect
|
372
|
+
">"
|
373
|
+
end
|
374
|
+
}
|
375
|
+
end
|
376
|
+
|
377
|
+
rule para_marker
|
378
|
+
"---" {
|
379
|
+
def value
|
380
|
+
nil
|
381
|
+
end
|
382
|
+
|
383
|
+
def inspect
|
384
|
+
"---"
|
385
|
+
end
|
386
|
+
}
|
387
|
+
end
|
388
|
+
|
389
|
+
end
|
data/lib/resume/pdf.rb
ADDED
@@ -0,0 +1,158 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2009 Virgil Dimaguila
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person
|
5
|
+
# obtaining a copy of this software and associated documentation
|
6
|
+
# files (the "Software"), to deal in the Software without
|
7
|
+
# restriction, including without limitation the rights to use,
|
8
|
+
# copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the
|
10
|
+
# Software is furnished to do so, subject to the following
|
11
|
+
# conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be
|
14
|
+
# included in all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
18
|
+
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
20
|
+
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
21
|
+
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
22
|
+
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
23
|
+
# OTHER DEALINGS IN THE SOFTWARE.
|
24
|
+
#++
|
25
|
+
|
26
|
+
module ResumeTools
|
27
|
+
module Renderer
|
28
|
+
module PDF
|
29
|
+
require "prawn"
|
30
|
+
require "prawn/format"
|
31
|
+
require "prawn/layout"
|
32
|
+
require "prawn/measurement_extensions"
|
33
|
+
|
34
|
+
FONT_DIR = File.join(File.dirname(__FILE__), '..', '..', 'fonts')
|
35
|
+
MARGINS = [1.0, 1.0, 1.0, 1.0]
|
36
|
+
FONT_SIZES = {
|
37
|
+
:default => 9,
|
38
|
+
:header => 14,
|
39
|
+
:contact => 9,
|
40
|
+
:section => 10,
|
41
|
+
:para => 9,
|
42
|
+
:item => 9,
|
43
|
+
:period => 12
|
44
|
+
}
|
45
|
+
DATE_FORMAT = "%B, %Y"
|
46
|
+
|
47
|
+
# Render to PDF
|
48
|
+
def render_pdf(opts={})
|
49
|
+
pdf = Prawn::Document.new(
|
50
|
+
:info => {},
|
51
|
+
:top_margin => MARGINS[0].in,
|
52
|
+
:left_margin => MARGINS[1].in,
|
53
|
+
:bottom_margin => MARGINS[2].in,
|
54
|
+
:right_margin => MARGINS[3].in
|
55
|
+
)
|
56
|
+
|
57
|
+
pdf.font_families.update(
|
58
|
+
"VeraSans" => {
|
59
|
+
:normal => File.expand_path("Vera.ttf", FONT_DIR),
|
60
|
+
:bold => File.expand_path("VeraBd.ttf", FONT_DIR),
|
61
|
+
:italic => File.expand_path("VeraIt.ttf", FONT_DIR),
|
62
|
+
:bold_italic => File.expand_path("VeraBI.ttf", FONT_DIR)
|
63
|
+
}
|
64
|
+
)
|
65
|
+
|
66
|
+
# Set default font
|
67
|
+
pdf.font("Helvetica", :style => :normal, :size => FONT_SIZES[:default], :kerning => true)
|
68
|
+
|
69
|
+
# Name
|
70
|
+
pdf.text self.full_name, :style => :bold, :size => FONT_SIZES[:header]
|
71
|
+
|
72
|
+
# Contact info
|
73
|
+
pdf.text self.telephone if self.has_telephone?
|
74
|
+
pdf.text self.email if self.has_email?
|
75
|
+
pdf.text self.address1 if self.has_address1?
|
76
|
+
pdf.text self.address2 if self.has_address2?
|
77
|
+
pdf.text self.url if self.has_url?
|
78
|
+
|
79
|
+
# Sections
|
80
|
+
self.sections.each do |section|
|
81
|
+
pdf.pad_top(20) do
|
82
|
+
# Section title
|
83
|
+
pdf.text section.title, :style => :bold, :size => FONT_SIZES[:section]
|
84
|
+
|
85
|
+
# Section paragraph
|
86
|
+
unless section.para.blank?
|
87
|
+
pdf.span(pdf.bounds.width - 10, :position => 10) do
|
88
|
+
pdf.pad_top(5) { pdf.text section.para, :size => FONT_SIZES[:para] }
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
# Section items
|
93
|
+
unless section.items.empty?
|
94
|
+
pdf.table section.items.map { |item| [" •", item.text] },
|
95
|
+
:font_size => FONT_SIZES[:item],
|
96
|
+
:column_widths => { 0 => 20, 1 => 420 },
|
97
|
+
:border_style => :none,
|
98
|
+
:border_color => "ffffff",
|
99
|
+
:vertical_padding => 4,
|
100
|
+
:horizontal_padding => 0,
|
101
|
+
:align => { 0 => :left, 1 => :left }
|
102
|
+
end
|
103
|
+
|
104
|
+
# Periods
|
105
|
+
section.periods.each do |period|
|
106
|
+
pdf.span(pdf.bounds.width - 10, :position => 10) do
|
107
|
+
pdf.pad_top(5) do
|
108
|
+
# Period title
|
109
|
+
pdf.pad_top(5) { pdf.text period.title, :style => :bold, :size => FONT_SIZES[:period] }
|
110
|
+
|
111
|
+
# Period details
|
112
|
+
detail_line = []
|
113
|
+
dates = print_date(period.dtstart, period.dtend)
|
114
|
+
detail_line << period.organization unless period.organization.blank?
|
115
|
+
detail_line << period.location unless period.location.blank?
|
116
|
+
detail_line << dates unless dates.blank?
|
117
|
+
|
118
|
+
pdf.span(pdf.bounds.width - 10, :position => 10) do
|
119
|
+
pdf.text(detail_line.join(", "), :size => FONT_SIZES[:default])
|
120
|
+
end
|
121
|
+
|
122
|
+
# Period items
|
123
|
+
unless period.items.empty?
|
124
|
+
pdf.table period.items.map { |item| [" •", item.text] },
|
125
|
+
:font_size => FONT_SIZES[:item],
|
126
|
+
:column_widths => { 0 => 20, 1 => 420 },
|
127
|
+
:border_style => :none,
|
128
|
+
:border_color => "ffffff",
|
129
|
+
:vertical_padding => 4,
|
130
|
+
:horizontal_padding => 0,
|
131
|
+
:align => { 0 => :center, 1 => :left }
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
pdf.render
|
140
|
+
end
|
141
|
+
|
142
|
+
private
|
143
|
+
def print_date(dtstart, dtend)
|
144
|
+
if dtstart && dtend
|
145
|
+
dtstart + " - " + dtend
|
146
|
+
elsif dtstart && dtend.nil?
|
147
|
+
dtstart.strftime(DATE_FORMAT)
|
148
|
+
else
|
149
|
+
""
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
Resume.class_eval do
|
156
|
+
include Renderer::PDF
|
157
|
+
end
|
158
|
+
end
|