resume-stylist 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +4 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +40 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/data/resume-stylist/templates/resume.json +93 -0
- data/data/resume-stylist/templates/theme.html.liquid +20 -0
- data/exe/resume-stylist +137 -0
- data/lib/resume-stylist/resume/json.rb +43 -0
- data/lib/resume-stylist/resume/xml.rb +13 -0
- data/lib/resume-stylist/resume.rb +58 -0
- data/lib/resume-stylist/theme.rb +49 -0
- data/lib/resume-stylist/version.rb +3 -0
- data/lib/resume-stylist.rb +9 -0
- data/resume-stylist.gemspec +33 -0
- metadata +176 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 31ad8a2c22c71fb69b8e476894f3d9e38555f321
|
4
|
+
data.tar.gz: 1424894eccf7f0b3eff561023b742906940bbcd8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 785c11a423a56927fd6291bd174213171abada37ae7423e5d643d5aa15493ec3593e5b59b4b37105cacb5a04da3b5ab3fce9c331599f07430036e3deeba0aee1
|
7
|
+
data.tar.gz: 07433278538c665d14e132e8ce34ac46f5acb780220312785139c05a28c5ed5eab517cf312f23058590820efcbc97201430f6005e9b9db26d277e0a94d206156
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Nino Miletich
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# Resume Stylist
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/resume-stylist`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'resume-stylist'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install resume-stylist
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. Run `bundle exec resume-stylist` to use the gem in this directory, ignoring other installed copies of this gem.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/resume-stylist. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
36
|
+
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "resume-stylist"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
{
|
2
|
+
"basics": {
|
3
|
+
"name": "John Doe",
|
4
|
+
"label": "Programmer",
|
5
|
+
"picture": "",
|
6
|
+
"email": "john@gmail.com",
|
7
|
+
"phone": "(912) 555-4321",
|
8
|
+
"website": "http://johndoe.com",
|
9
|
+
"summary": "A summary of John Doe...",
|
10
|
+
"location": {
|
11
|
+
"address": "2712 Broadway St",
|
12
|
+
"postalCode": "CA 94115",
|
13
|
+
"city": "San Francisco",
|
14
|
+
"countryCode": "US",
|
15
|
+
"region": "California"
|
16
|
+
},
|
17
|
+
"profiles": [{
|
18
|
+
"network": "Twitter",
|
19
|
+
"username": "john",
|
20
|
+
"url": "http://twitter.com/john"
|
21
|
+
}]
|
22
|
+
},
|
23
|
+
"work": [{
|
24
|
+
"company": "Company",
|
25
|
+
"position": "President",
|
26
|
+
"website": "http://company.com",
|
27
|
+
"startDate": "2013-01-01",
|
28
|
+
"endDate": "2014-01-01",
|
29
|
+
"summary": "Description...",
|
30
|
+
"highlights": [
|
31
|
+
"Started the company"
|
32
|
+
]
|
33
|
+
}],
|
34
|
+
"volunteer": [{
|
35
|
+
"organization": "Organization",
|
36
|
+
"position": "Volunteer",
|
37
|
+
"website": "http://organization.com/",
|
38
|
+
"startDate": "2012-01-01",
|
39
|
+
"endDate": "2013-01-01",
|
40
|
+
"summary": "Description...",
|
41
|
+
"highlights": [
|
42
|
+
"Awarded 'Volunteer of the Month'"
|
43
|
+
]
|
44
|
+
}],
|
45
|
+
"education": [{
|
46
|
+
"institution": "University",
|
47
|
+
"area": "Software Development",
|
48
|
+
"studyType": "Bachelor",
|
49
|
+
"startDate": "2011-01-01",
|
50
|
+
"endDate": "2013-01-01",
|
51
|
+
"gpa": "4.0",
|
52
|
+
"courses": [
|
53
|
+
"DB1101 - Basic SQL"
|
54
|
+
]
|
55
|
+
}],
|
56
|
+
"awards": [{
|
57
|
+
"title": "Award",
|
58
|
+
"date": "2014-11-01",
|
59
|
+
"awarder": "Company",
|
60
|
+
"summary": "There is no spoon."
|
61
|
+
}],
|
62
|
+
"publications": [{
|
63
|
+
"name": "Publication",
|
64
|
+
"publisher": "Company",
|
65
|
+
"releaseDate": "2014-10-01",
|
66
|
+
"website": "http://publication.com",
|
67
|
+
"summary": "Description..."
|
68
|
+
}],
|
69
|
+
"skills": [{
|
70
|
+
"name": "Web Development",
|
71
|
+
"level": "Master",
|
72
|
+
"keywords": [
|
73
|
+
"HTML",
|
74
|
+
"CSS",
|
75
|
+
"Javascript"
|
76
|
+
]
|
77
|
+
}],
|
78
|
+
"languages": [{
|
79
|
+
"name": "English",
|
80
|
+
"level": "Native speaker"
|
81
|
+
}],
|
82
|
+
"interests": [{
|
83
|
+
"name": "Wildlife",
|
84
|
+
"keywords": [
|
85
|
+
"Ferrets",
|
86
|
+
"Unicorns"
|
87
|
+
]
|
88
|
+
}],
|
89
|
+
"references": [{
|
90
|
+
"name": "Jane Doe",
|
91
|
+
"reference": "Reference..."
|
92
|
+
}]
|
93
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<title>{{ name }}'s Resume</title>
|
6
|
+
|
7
|
+
<!-- or type="text/sass" -->
|
8
|
+
<style type="text/scss">
|
9
|
+
.resume {
|
10
|
+
h1 {
|
11
|
+
weight: bold;
|
12
|
+
}
|
13
|
+
}
|
14
|
+
</style>
|
15
|
+
</head>
|
16
|
+
<body class="resume">
|
17
|
+
<h1>{{ name }}'s Resume</h1>
|
18
|
+
<!-- todo -->
|
19
|
+
</body>
|
20
|
+
</html>
|
data/exe/resume-stylist
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "resume-stylist"
|
4
|
+
require "pdfkit"
|
5
|
+
require "fileutils"
|
6
|
+
require "optparse"
|
7
|
+
|
8
|
+
options = {}
|
9
|
+
def copyright
|
10
|
+
authors = Gem.loaded_specs["resume-stylist"].authors.join(",")
|
11
|
+
[
|
12
|
+
"The MIT License (MIT)",
|
13
|
+
"Copyright (c) 2016 #{authors}"
|
14
|
+
].join "\n"
|
15
|
+
end
|
16
|
+
|
17
|
+
def version
|
18
|
+
"resume-stylist #{ResumeStylist::VERSION}"
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
build_parser = OptionParser.new do |opts|
|
23
|
+
opts.banner = "Usage: resume-stylist build [options] [<input>] [<output>]"
|
24
|
+
|
25
|
+
opts.separator ""
|
26
|
+
opts.separator "Build options:"
|
27
|
+
# No argument, shows at tail. This will print an options summary.
|
28
|
+
# Try it and see!
|
29
|
+
opts.on_tail("-h", "--help", "Show this message") do
|
30
|
+
puts opts
|
31
|
+
exit
|
32
|
+
end
|
33
|
+
|
34
|
+
opts.on("-t", "--theme [FILE]", String, "Which theme file to use") {|v| options[:theme] = v }
|
35
|
+
opts.on("-i", "--input-file [FILE]", String, "Input file") {|v| options[:input] = v }
|
36
|
+
opts.on("-o", "--output-file [FILE]", String, "Output file") {|v| options[:output] = v }
|
37
|
+
opts.on("-I", "--input-type [EXT]", String, "Input file format") {|v| options[:input_type] = v }
|
38
|
+
opts.on("-O", "--output-type [EXT]", String, "Output fil formate") {|v| options[:output_type] = v }
|
39
|
+
end
|
40
|
+
|
41
|
+
default_parser = OptionParser.new do |opts|
|
42
|
+
opts.banner = "Usage: resume-stylist [build] [options]"
|
43
|
+
|
44
|
+
opts.separator ""
|
45
|
+
opts.separator "Options:"
|
46
|
+
# No argument, shows at tail. This will print an options summary.
|
47
|
+
# Try it and see!
|
48
|
+
opts.on_tail("-h", "--help", "Show this message") do
|
49
|
+
build_parser.banner = ""
|
50
|
+
puts opts
|
51
|
+
puts build_parser
|
52
|
+
exit
|
53
|
+
end
|
54
|
+
# Another typical switch to print the version.
|
55
|
+
opts.on_tail("-v", "--version", "Show version") do
|
56
|
+
puts copyright
|
57
|
+
puts version
|
58
|
+
exit
|
59
|
+
end
|
60
|
+
|
61
|
+
opts.on("-t", "--new-theme [FILE]", String, "Creates a theme template") {|v| options[:new_theme] = v }
|
62
|
+
opts.on("-r", "--new-resume [FILE]", String, "Creates a resume template") {|v| options[:new_resume] = v }
|
63
|
+
end
|
64
|
+
|
65
|
+
case ARGV[0]
|
66
|
+
when "build"
|
67
|
+
ARGV.shift
|
68
|
+
build_parser.parse!
|
69
|
+
|
70
|
+
input = if options[:input] then options[:input] else ARGV.shift end
|
71
|
+
output = if options[:output] then options[:output] else ARGV.shift end
|
72
|
+
|
73
|
+
if options[:input_type].nil?
|
74
|
+
if input =~ /\.([\w\d-]+)\z/
|
75
|
+
input_type = $1
|
76
|
+
else
|
77
|
+
raise ArgumentError, "Please specify a type using `--input-type`"
|
78
|
+
end
|
79
|
+
else
|
80
|
+
input_type = options[:input_type]
|
81
|
+
end
|
82
|
+
|
83
|
+
if options[:output_type].nil?
|
84
|
+
if output =~ /\.([\w\d-]+)\z/
|
85
|
+
output_type = $1
|
86
|
+
else
|
87
|
+
raise ArgumentError, "Please specify a type using `--output-type`"
|
88
|
+
end
|
89
|
+
else
|
90
|
+
output_type = options[:output_type]
|
91
|
+
end
|
92
|
+
|
93
|
+
if options[:theme]
|
94
|
+
theme_source = File.read(File.expand_path(options[:theme]))
|
95
|
+
else
|
96
|
+
theme_source = File.read("#{Gem.datadir("resume-stylist")}/templates/theme.html.liquid")
|
97
|
+
end
|
98
|
+
|
99
|
+
resume = ResumeStylist::Resume.new(File.read(File.expand_path(input)), input_type)
|
100
|
+
theme = ResumeStylist::Theme.new(theme_source)
|
101
|
+
|
102
|
+
html = theme.render(resume.data)
|
103
|
+
|
104
|
+
case output_type
|
105
|
+
when "html"
|
106
|
+
out = html
|
107
|
+
when "pdf"
|
108
|
+
out = PDFKit.new(html, :page_size => "Letter").to_pdf
|
109
|
+
else
|
110
|
+
raise ArgumentError, "Unknown output format `#{output_type}`. Currently the stylist only supports PDF and HTML"
|
111
|
+
end
|
112
|
+
|
113
|
+
if output == "-"
|
114
|
+
puts out
|
115
|
+
exit
|
116
|
+
else
|
117
|
+
File.open(File.expand_path(output), "w") {|f| f.write out }
|
118
|
+
end
|
119
|
+
|
120
|
+
else
|
121
|
+
default_parser.parse!
|
122
|
+
|
123
|
+
unless options[:new_theme] || options[:new_resume]
|
124
|
+
puts version
|
125
|
+
puts copyright
|
126
|
+
puts default_parser
|
127
|
+
end
|
128
|
+
|
129
|
+
if options[:new_theme]
|
130
|
+
FileUtils.cp("#{Gem.datadir("resume-stylist")}/templates/theme.html.liquid", File.expand_path(options[:new_theme]))
|
131
|
+
end
|
132
|
+
|
133
|
+
# @TODO: Add supporty for more formats
|
134
|
+
if options[:new_resume]
|
135
|
+
FileUtils.cp("#{Gem.datadir("resume-stylist")}/templates/resume.json", File.expand_path(options[:new_resume]))
|
136
|
+
end
|
137
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module ResumeStylist
|
2
|
+
module JSONResume
|
3
|
+
|
4
|
+
def self.date_helper(d)
|
5
|
+
return unless d
|
6
|
+
|
7
|
+
date ||= (Date.strptime(d, '%Y-%m-%d') rescue nil)
|
8
|
+
date ||= (Date.strptime(d, '%Y-%m') rescue nil)
|
9
|
+
date ||= (Date.strptime(d, '%Y') rescue nil)
|
10
|
+
|
11
|
+
return date
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.handles?(resume_format)
|
15
|
+
resume_format.to_s.downcase == "json"
|
16
|
+
end
|
17
|
+
|
18
|
+
def load!(input)
|
19
|
+
data = Yajl::Parser.parse(input, symbolize_keys: false)
|
20
|
+
# data = Yajl::Parser.parse(input, symbolize_keys: true)
|
21
|
+
|
22
|
+
# Copy the data data from the "basics" field into top level
|
23
|
+
# and remove the basics group from the hash
|
24
|
+
data["basics"].each_pair {|k, v| data[k] = v }
|
25
|
+
data.delete "basics"
|
26
|
+
|
27
|
+
@data = data
|
28
|
+
|
29
|
+
# Fix dates, since they're just strings now
|
30
|
+
[ @data["work"], @data["volunteer"], @data["education"] ].each do |set|
|
31
|
+
set.each do |e|
|
32
|
+
e["startDate"] = JSONResume.date_helper(e["startDate"])
|
33
|
+
e["endDate"] = JSONResume.date_helper(e["endDate"])
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
@data["publications"].each{|e| e["releaseDate"] = JSONResume.date_helper(e["releaseDate"]) }
|
38
|
+
@data["awards"].each{|e| e["date"] = JSONResume.date_helper(e["date"]) }
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
ResumeStylist::Resume.register_handler ResumeStylist::JSONResume
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module ResumeStylist
|
2
|
+
module XMLResume
|
3
|
+
def self.handles?(resume_format)
|
4
|
+
resume_format.to_s.downcase == "xml"
|
5
|
+
end
|
6
|
+
|
7
|
+
def load!(input)
|
8
|
+
raise NotImplementedError, "Feature not yet implemented!"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
ResumeStylist::Resume.register_handler ResumeStylist::XMLResume
|
@@ -0,0 +1,58 @@
|
|
1
|
+
module ResumeStylist
|
2
|
+
class UnsuportedFormatError < StandardError
|
3
|
+
# No body
|
4
|
+
end
|
5
|
+
|
6
|
+
class Resume
|
7
|
+
Handlers = []
|
8
|
+
|
9
|
+
def self.register_handler(handler)
|
10
|
+
Handlers << handler
|
11
|
+
end
|
12
|
+
|
13
|
+
attr_accessor :data
|
14
|
+
|
15
|
+
def initialize(input, resume_format)
|
16
|
+
@data = {
|
17
|
+
"name" => "",
|
18
|
+
"label" => "",
|
19
|
+
"picture" => "",
|
20
|
+
"email" => "",
|
21
|
+
"phone" => "",
|
22
|
+
"website" => "",
|
23
|
+
"summary" => "",
|
24
|
+
|
25
|
+
"location" => {
|
26
|
+
"address" => nil,
|
27
|
+
"postalCode" => nil,
|
28
|
+
"city" => nil,
|
29
|
+
"countryCode" => nil,
|
30
|
+
"region" => nil
|
31
|
+
},
|
32
|
+
|
33
|
+
"profiles" => [], # { network_name, username, url }
|
34
|
+
"work" => [], # { organisation, position, website, summary, highlights => [], startDate, endDate }
|
35
|
+
"volunteer" => [], # { organisation, position, website, summary, highlights => [], startDate, endDate }
|
36
|
+
"education" => [], # { institution, area, studyType, grade, courses => [], startDate, endDate }
|
37
|
+
"publications" => [], # { name, publisher, releaseDate, website, summary }
|
38
|
+
"skill" => [], # { name, level }
|
39
|
+
"language" => [], # { name, level }
|
40
|
+
"reference" => [], # { name, reference }
|
41
|
+
|
42
|
+
# @XXX: Remove these?
|
43
|
+
"awards" => [], # { title, date, awarder, summary }
|
44
|
+
"interests" => [] # { name, keywords }
|
45
|
+
}
|
46
|
+
|
47
|
+
if handler = Handlers.find {|h| h.handles? resume_format }
|
48
|
+
handler.instance_method(:load!).bind(self).call(input)
|
49
|
+
else
|
50
|
+
raise UnsuportedFormatError, "`#{resume_format.to_s}` is not a valid format"
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
require "resume-stylist/resume/json.rb"
|
58
|
+
require "resume-stylist/resume/xml.rb"
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module ResumeStylist
|
2
|
+
class Theme
|
3
|
+
# def intialize(theme_path)
|
4
|
+
# @source = File.read(theme_path)
|
5
|
+
def initialize(source)
|
6
|
+
@source = source
|
7
|
+
@frontmatter = {
|
8
|
+
"flags" => []
|
9
|
+
}
|
10
|
+
parse_frontmatter!
|
11
|
+
|
12
|
+
@template = Liquid::Template.parse(@source)
|
13
|
+
end
|
14
|
+
|
15
|
+
def render(resume_data)
|
16
|
+
@resume = @template.render(resume_data)
|
17
|
+
post_process!
|
18
|
+
|
19
|
+
@resume
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
def post_process!
|
24
|
+
return if @frontmatter["flags"].include? "disable_post_processing"
|
25
|
+
|
26
|
+
@document = Oga.parse_html @resume
|
27
|
+
|
28
|
+
@document.css(%q{style[type="text/scss"], style[type="text/sass"]}).each do |style|
|
29
|
+
syntax = style.get("type")[5, 4].to_sym # Going to be :scss or :sass
|
30
|
+
css = Sass::Engine.new(style.text, syntax: syntax, style: :compressed)
|
31
|
+
|
32
|
+
style.inner_text = css.render
|
33
|
+
style.set("type", "text/css")
|
34
|
+
end
|
35
|
+
|
36
|
+
@resume = @document.to_xml
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
def parse_frontmatter!
|
41
|
+
if @source =~ /\A(---\s*\n.*?\n?)^((---|\.\.\.)\s*$\n?)/m
|
42
|
+
@source = $POSTMATCH
|
43
|
+
@frontmatter.merge!(YAML.load($1) || {})
|
44
|
+
end
|
45
|
+
|
46
|
+
nil
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'resume-stylist/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "resume-stylist"
|
8
|
+
spec.version = ResumeStylist::VERSION
|
9
|
+
spec.authors = ["Nino Miletich"]
|
10
|
+
spec.email = ["nino@miletich.me"]
|
11
|
+
|
12
|
+
spec.required_ruby_version = ">= 2.0"
|
13
|
+
|
14
|
+
spec.summary = %q{Small framework for making resume themes in liquid and scss.}
|
15
|
+
spec.homepage = "https://github.com/omninonsense/resume-stylist"
|
16
|
+
spec.license = "MIT"
|
17
|
+
|
18
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
19
|
+
spec.bindir = "exe"
|
20
|
+
spec.executables = ["resume-stylist"]
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
spec.add_development_dependency "minitest"
|
26
|
+
|
27
|
+
spec.add_dependency "yajl-ruby", "~> 1.0"
|
28
|
+
spec.add_dependency "oga", "~> 2.0"
|
29
|
+
spec.add_dependency "sass", "~> 3.0"
|
30
|
+
spec.add_dependency "liquid", "~> 3.0"
|
31
|
+
spec.add_dependency "pdfkit", "~> 0.8.0"
|
32
|
+
|
33
|
+
end
|
metadata
ADDED
@@ -0,0 +1,176 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: resume-stylist
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nino Miletich
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-04-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.10'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.10'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: yajl-ruby
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: oga
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '2.0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '2.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: sass
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: liquid
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '3.0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '3.0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: pdfkit
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 0.8.0
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 0.8.0
|
125
|
+
description:
|
126
|
+
email:
|
127
|
+
- nino@miletich.me
|
128
|
+
executables:
|
129
|
+
- resume-stylist
|
130
|
+
extensions: []
|
131
|
+
extra_rdoc_files: []
|
132
|
+
files:
|
133
|
+
- ".gitignore"
|
134
|
+
- ".travis.yml"
|
135
|
+
- CODE_OF_CONDUCT.md
|
136
|
+
- Gemfile
|
137
|
+
- LICENSE.txt
|
138
|
+
- README.md
|
139
|
+
- Rakefile
|
140
|
+
- bin/console
|
141
|
+
- bin/setup
|
142
|
+
- data/resume-stylist/templates/resume.json
|
143
|
+
- data/resume-stylist/templates/theme.html.liquid
|
144
|
+
- exe/resume-stylist
|
145
|
+
- lib/resume-stylist.rb
|
146
|
+
- lib/resume-stylist/resume.rb
|
147
|
+
- lib/resume-stylist/resume/json.rb
|
148
|
+
- lib/resume-stylist/resume/xml.rb
|
149
|
+
- lib/resume-stylist/theme.rb
|
150
|
+
- lib/resume-stylist/version.rb
|
151
|
+
- resume-stylist.gemspec
|
152
|
+
homepage: https://github.com/omninonsense/resume-stylist
|
153
|
+
licenses:
|
154
|
+
- MIT
|
155
|
+
metadata: {}
|
156
|
+
post_install_message:
|
157
|
+
rdoc_options: []
|
158
|
+
require_paths:
|
159
|
+
- lib
|
160
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
161
|
+
requirements:
|
162
|
+
- - ">="
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: '2.0'
|
165
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
166
|
+
requirements:
|
167
|
+
- - ">="
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
version: '0'
|
170
|
+
requirements: []
|
171
|
+
rubyforge_project:
|
172
|
+
rubygems_version: 2.5.1
|
173
|
+
signing_key:
|
174
|
+
specification_version: 4
|
175
|
+
summary: Small framework for making resume themes in liquid and scss.
|
176
|
+
test_files: []
|