resuby 0.0.1 → 0.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9fd599e4cbec4923371bc76965fc672c7d7a8fa3
4
- data.tar.gz: ce42045b330c1f7b9ce6560b9ab4371a6b94977c
3
+ metadata.gz: a39bc8b678cb2e72c5f51779ab719482b98ff0f0
4
+ data.tar.gz: 382c006dd90706b9a6a13c373c5563bc229590ca
5
5
  SHA512:
6
- metadata.gz: 1b7c7e4171a359fe0c7bd8096a166ba27257cd242d11a48277523db91f952215d889961e6c821d1b2a1c8448f247263aa06cd18b6006cd5964fda95241444ff8
7
- data.tar.gz: 495ec1437faca54af1073b34081d7b2ebce477b6deb75382da61c02373c9ab67e578d29a59710c7b9084ef8a8d0eb03a3623dbfbc23751dc7149c8fcd77a9ee9
6
+ metadata.gz: 2ef5d314c79fa1b3bc35c056634b73e35825d17c44cd56e691ed5beeaac1aa7b7d832ee656f7387f53ceae9357f867d889c61624e47eb7e7e6de08f41b4bc61d
7
+ data.tar.gz: 42164fcc704bac4ced41a739d575db4d965cfb3c9e6c5a0d3b3780bea360c618e3709b5b31bc61fe00ce2f686de0b339d98be3804606a626a9ed70d15d1ad6f8
data/README.md CHANGED
@@ -6,11 +6,14 @@
6
6
 
7
7
  ## Overview
8
8
 
9
- Resuby is a gem that takes a `yaml` configuration file that contains all of your
10
- resume information, and turns it into a resume you can actually use to find your
11
- next job. After you generate your resume, you will have an HTML file that you
12
- can open in your favorite browser (as long as yor favorite browser is Chrome or
13
- Safari), and view the end result.
9
+ Resuby is a gem that takes a `YAML` or `JSON` configuration file that contains all of your resume information, and turns
10
+ it into a resume you can actually use to find your next job. The data file is converted into an HTML file, and the
11
+ accompanying CSS styles, which you can then view in a browser. From there, you can print your resume, save it as a PDF,
12
+ or do anything else you can do to a web page.
13
+
14
+ This project was inpired by my need to get away from awkward tables in Word, and my desire to be able to version control
15
+ my resume. With Resuby, you only need to store the `JSON`, or `YAML` file, as the HTML and CSS can easily be generated
16
+ again (although you could certainly save that too).
14
17
 
15
18
  ## Table of Contents
16
19
 
@@ -21,7 +24,9 @@ Safari), and view the end result.
21
24
  - [Table of Contents](#table-of-contents)
22
25
  - [Installation](#installation)
23
26
  - [Usage](#usage)
24
- - [Generating Resume](#generating-resume)
27
+ - [CLI](#cli)
28
+ - [Generating Resume](#generating-resume)
29
+ - [Generating Resume Data Template](#generating-resume-data-template)
25
30
  - [Compatibility](#compatibility)
26
31
 
27
32
  <!-- /TOC -->
@@ -30,53 +35,65 @@ Safari), and view the end result.
30
35
 
31
36
  To install, simply run `gem install resuby`.
32
37
 
33
- In addition to resuby, it will install SASS, which is a common CSS pre-compiler
34
- that is used by resuby to generate the CSS file for your resume.
38
+ In addition to resuby, it will install SASS, which is a common CSS pre-compiler that is used by resuby to generate the
39
+ CSS file for your resume, and Optimist, which is used to handle CLI interactions.
35
40
 
36
41
  ## Usage
37
42
 
38
- In order for the script to work, you will first need to create a file in the
39
- root directory of the project called `resume.yaml`. This file should contain
40
- your name, contact information, and any other information that you want in your
41
- resume. Below are the keywords that are expected in the yaml file.
43
+ ### CLI
44
+
45
+ By default, the `resuby` executable will look for a file called `resume.yaml` in your current working directory (you can
46
+ pass it a different path). The `YAML` or `JSON` file needs to contain all of the information you want in your resume.
47
+ The table below summarizes the keys that `resuby` expects to find in the data file.
42
48
 
43
49
  |Key|Class|Required|Description|
44
50
  |---|-----|--------|-----------|
45
- |`name`|String|True|Your name|
46
- |`contact`|Array|True|Any contact information (i.e. phone, email)|
47
- |`profile`|String|False|A small paragraph that describes you|
48
- |Any other key|Array|False|These will become the headers for your other resume sections (i.e. education -> Education, projects_&_experience -> Projects & Experience|
51
+ |`name`|String|*|Your name|
52
+ |`contact`|Array|*|Any contact information (i.e. phone, email)|
53
+ |`profile`|String||A small paragraph that describes you|
54
+ |Any other key|Array||These will become the headers for your other resume sections (i.e. `education` -> `Education`, `projects_&_experience` -> `Projects & Experience`|
49
55
 
50
- Each array element under the headers you create is expected to be a hash. All of
51
- the array elements under those sections will become a new row under that header.
52
- Below are the expected key values for each array element under your headers.
56
+ Each array element under the headers you create is expected to be a hash. All of the array elements under those sections
57
+ will become a new row under that header. Below are the expected key values for each array element.
53
58
 
54
59
  |Key|Class|Required|Description|
55
60
  |---|-----|--------|-----------|
56
- |`title`|String|False|Main point for that row, will have slightly larger font than the rest of the values|
57
- |`desc`|String|True|Description for that section (i.e. dates), will be displayed to the left of that section|
58
- |`subtitle`|String|False|Will be displayed right under the title, will be in italics|
59
- |`data`|Array|True|Any other info, such as accomplishments, each array element will be a new bullet|
61
+ |`desc`|String|*|Description for that section (i.e. dates), will be displayed to the left of that section|
62
+ |`title`|String||Main point for that row, will have slightly larger font than the rest of the values|
63
+ |`subtitle`|String||Will be displayed right under the title, will be in italics|
64
+ |`data`|Array|*|Any other info, such as accomplishments, each array element will be a new bullet|
60
65
 
61
- [`default.yaml`](/examples/default.yaml) contains a sample structure.
66
+ [`default.yaml`](/examples/default.yaml) contains a sample `YAML` structure. [`default.json`](/examples/default.json)
67
+ contains a sample `JSON` structure.
62
68
 
63
- ## Generating Resume
69
+ #### Generating Resume
64
70
 
65
- Once you have created a `resume.yaml` file, you can run the following command
66
- from the same directoy:
71
+ Once you have a data file, you can run the following command from the same directoy:
67
72
 
68
73
  ```
69
74
  resuby generate
70
75
  ```
71
76
 
72
- Running this command will generate a file called `resume.html` in your current
73
- directory. Now you can simply open this in a browser, and print it (__make sure
74
- that the printed page has no margins, as the HTML generated will have its
75
- own margins set__).
77
+ Running this command will generate a file called `resume.html`, and a `css/` directory in your current workspace. Now
78
+ you can simply open this in a browser, and print it (__make sure that the printed page has no margins, as the HTML
79
+ generated will have its own margins set__).
80
+
81
+ #### Generating Resume Data Template
82
+
83
+ Think converting your resume to `YAML` or `JSON` will take too long? Well, the `resuby` CLI can help take some of that
84
+ burden off of your shoulders by generating a data template. Once you have the template, simply fill in the file with
85
+ your information, and you should be ready to go. To create a template just do:
86
+
87
+ ```
88
+ resuby generate -o <path/to/template> -y
89
+ ```
90
+
91
+ This will generate the template in `YAML` format, however, you can make it output `JSON` just as easily if that's more
92
+ your style.
76
93
 
94
+ You can run `resuby generate --help` to get additional information about the executable.
77
95
 
78
96
  ## Compatibility
79
97
 
80
- The generated HTML and styling has only been tested in Chrome and Safari.
81
- This doesn't mean it won't work on other browsers, but it is not guaranteed to
82
- look as designed.
98
+ The generated HTML and styling has only been tested in Chrome and Safari. This doesn't mean it won't work on other
99
+ browsers, but it is not guaranteed to look as designed.
data/bin/resuby CHANGED
@@ -2,16 +2,9 @@
2
2
 
3
3
  require 'resuby'
4
4
 
5
- options = ARGV
6
-
7
- if options.first == 'generate'
8
- new_resume = Resuby.new
9
- resume_data = File.join(Dir.pwd, 'resume.yaml')
10
- resume = File.join(Dir.pwd, 'resume.html')
11
- new_resume.read_source(resume_data)
12
- new_resume.save_resume(resume)
13
- new_resume.compile_styles
14
- else
15
- puts 'Specify an action to create your resume'
5
+ begin
6
+ Resuby::CLI.run
7
+ rescue Interrupt
8
+ warn 'Aborted'
16
9
  exit 1
17
10
  end
@@ -1,44 +1,5 @@
1
- require 'erb'
2
- require 'yaml'
3
- require 'sass'
1
+ require 'resuby/resume/resume'
2
+ require 'resuby/cli/cli'
3
+ require 'resuby/version'
4
4
 
5
- class Resuby
6
- attr_reader :name, :contact_info, :sections, :template, :profile
7
-
8
- def initialize
9
- @template = File.read(File.join(File.dirname(__FILE__), 'resuby/templates/resume.erb'))
10
- end
11
-
12
- def read_source(source)
13
- puts "Reading in data from #{source}"
14
- resume_data = YAML.load_file(source)
15
- @name = resume_data['name']
16
- @contact_info = resume_data['contact']
17
- @profile = resume_data['profile']
18
- @sections = resume_data.reject { |key, value| ['name', 'contact', 'profile'].include?(key) }
19
- end
20
-
21
- def render
22
- ERB.new(self.template).result( binding )
23
- end
24
-
25
- def save_resume(file)
26
- puts "Saving your resume at #{file}"
27
- File.open(file, "w+") do |f|
28
- f.write(render)
29
- end
30
- end
31
-
32
- def compile_styles
33
- options = {
34
- cache: true,
35
- syntax: :scss,
36
- style: :compressed,
37
- }
38
-
39
- scss_file = File.join(File.dirname(__FILE__), 'resuby/css/main.scss')
40
- render = Sass::Engine.new(File.read(scss_file), options).render
41
- Dir.mkdir(File.join(Dir.pwd, 'css'), 0755) unless File.directory?(File.join(Dir.pwd, 'css'))
42
- File.write(File.join(Dir.pwd, 'css/main.css'), render)
43
- end
44
- end
5
+ module Resuby; end
@@ -0,0 +1,30 @@
1
+ module Resuby::CLI
2
+ RESUBY_BANNER = <<-EOT
3
+ Create an HTML resume from a YAML file.
4
+
5
+ Usage: resuby <options> [command] [<args>]
6
+
7
+ Commands:
8
+ generate Generate an HTML resume
9
+ init Initialize project by creating a resume data template
10
+
11
+ Options:
12
+ EOT
13
+
14
+ GENERATE_BANNER = <<-EOT
15
+ Generate an HTML file that contains your resume. This will also generate the
16
+ required CSS styles for the HTML template.
17
+
18
+ Usage: resuby generate <options>
19
+
20
+ Options:
21
+ EOT
22
+
23
+ INIT_BANNER = <<-EOT
24
+ Creates a template for the resume data file.
25
+
26
+ Usage: resuby init <options>
27
+
28
+ Options:
29
+ EOT
30
+ end
@@ -0,0 +1,61 @@
1
+ require 'resuby/cli/banners'
2
+ require 'resuby/cli/exe'
3
+ require 'optimist'
4
+
5
+ module Resuby::CLI
6
+ def self.run
7
+ Resuby::CLI.options
8
+ end
9
+
10
+ def self.options
11
+ Resuby::CLI.global_options
12
+ @subcommand = ARGV.shift
13
+ Resuby::CLI.subcommand_options
14
+ Resuby::CLI.execute
15
+ end
16
+
17
+ def self.global_options
18
+ @global_opts = Optimist::options do
19
+ banner Resuby::CLI::RESUBY_BANNER
20
+ version "resuby version #{Resuby::VERSION}"
21
+ stop_on %w(generate init)
22
+ end
23
+ end
24
+
25
+ def self.subcommand_options
26
+ case @subcommand
27
+ when 'generate'
28
+ @opts = Optimist::options do
29
+ banner Resuby::CLI::GENERATE_BANNER
30
+ opt :data, 'Path to file containing data for the resume', default: File.join(Dir.pwd, 'resume.yaml')
31
+ opt :json, 'Read in data file as a JSON formatted file'
32
+ opt :output, 'Output file for generated HTML', default: File.join(Dir.pwd, 'resume.html')
33
+ opt :yaml, 'Read in data file as a YAML formatted file'
34
+ end
35
+ Optimist::die 'Data file connot be JSON and YAML' if @opts[:json] && @opts[:yaml]
36
+ when 'init'
37
+ @opts = Optimist::options do
38
+ banner Resuby::CLI::INIT_BANNER
39
+ opt :force, 'Force overwrite of data file if already present'
40
+ opt :json, 'Outputs data template in JSON format'
41
+ opt :output, 'Path to file where data template should be placed', required: true, type: :string
42
+ opt :yaml, 'Outputs data template in YAML format'
43
+ end
44
+ Optimist::die 'Cannot output two different formats at the same time' if @opts[:json] && @opts[:yaml]
45
+ Optimist::die 'You must specify an output format' unless @opts[:json] || @opts[:yaml]
46
+ else
47
+ Optimist::die "Unknonwn subcommand #{@subcommand.inspect}"
48
+ end
49
+ end
50
+
51
+ def self.execute
52
+ case @subcommand
53
+ when 'generate'
54
+ Resuby::CLI.generate
55
+ when 'init'
56
+ Resuby::CLI.init
57
+ else
58
+ Optimist::die "Unknonwn subcommand #{@subcommand.inspect}"
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,112 @@
1
+ module Resuby::CLI
2
+ def self.generate
3
+ resume = Resuby::Resume.new
4
+ ext =
5
+ if @opts[:yaml]
6
+ '.yaml'
7
+ elsif @opts[:json]
8
+ '.json'
9
+ else
10
+ nil
11
+ end
12
+ resume.read_source(@opts[:data], ext)
13
+ resume.save_resume(@opts[:output])
14
+ resume.compile_styles
15
+ end
16
+
17
+ def self.init
18
+ unless @opts[:force]
19
+ if File.file?(@opts[:output]) && File.size?(@opts[:output])
20
+ print "#{@opts[:output]} already exists, would you like to proceed (Y/N)? "
21
+ proceed = gets.chomp
22
+ unless proceed == 'Y'
23
+ warn 'Aborted!'
24
+ exit 1
25
+ end
26
+ end
27
+ end
28
+ template = {
29
+ 'name'=> 'Bob Smith',
30
+ 'contact'=> [
31
+ '(321) 321-4321',
32
+ 'bob.smith@resuby.com',
33
+ ],
34
+ 'profile'=> 'This section is optional, but it is a good place to write a short paragraph about yourself.',
35
+ 'experience'=> [
36
+ {
37
+ 'title'=> 'Position 1',
38
+ 'subtitle'=> 'Company 1',
39
+ 'desc'=> 'Jan 2018 - present',
40
+ 'data'=> [
41
+ 'Responsibility/accomplishment 1',
42
+ 'Responsibility/accomplishment 2',
43
+ 'Responsibility/accomplishment 3',
44
+ ],
45
+ },{
46
+ 'title'=> 'Position 2',
47
+ 'subtitle'=> 'Company 2',
48
+ 'desc'=> 'Jan 2017 - Jan 2018',
49
+ 'data'=> [
50
+ 'Responsibility/accomplishment 1',
51
+ 'Responsibility/accomplishment 2',
52
+ 'Responsibility/accomplishment 3',
53
+ ],
54
+ }
55
+ ],
56
+ 'projects'=> [
57
+ {
58
+ 'title'=> 'Project 1',
59
+ 'subtitle'=> 'Company 1',
60
+ 'desc'=> 'Aug 2018 - present',
61
+ 'data'=> [
62
+ 'Responsibility/accomplishment 1',
63
+ 'Responsibility/accomplishment 2',
64
+ 'Responsibility/accomplishment 3',
65
+ ]
66
+ },{
67
+ 'title'=> 'Project 2',
68
+ 'subtitle'=> 'Company 2',
69
+ 'desc'=> 'Mar 2017 - Jan 2018',
70
+ 'data'=> [
71
+ 'Responsibility/accomplishment 1',
72
+ 'Responsibility/accomplishment 2',
73
+ 'Responsibility/accomplishment 3',
74
+ ],
75
+ }
76
+ ],
77
+ 'education'=> [
78
+ {
79
+ 'title' => 'Some University',
80
+ 'desc' => 'Aug 2010 - May 2014',
81
+ 'data' => [
82
+ 'Degree, GPA',
83
+ ],
84
+ }
85
+ ],
86
+ 'skills'=> [
87
+ {
88
+ 'desc' => 'Languages',
89
+ 'data' => [
90
+ 'Ruby, Python',
91
+ 'HTML, CSS, Javascript',
92
+ ],
93
+ },{
94
+ 'desc' => 'Tools',
95
+ 'data' => [
96
+ 'Tool 1, Tool 2',
97
+ 'Tool 3, Tool 4',
98
+ ],
99
+ },
100
+ ],
101
+ }
102
+ puts "Storing template at #{@opts[:output]}"
103
+ if @opts[:yaml]
104
+ File.open(@opts[:output], 'w') { |f| f.puts template.to_yaml }
105
+ elsif @opts[:json]
106
+ File.open(@opts[:output], 'w') { |f| f.puts JSON.pretty_generate(template) }
107
+ else
108
+ puts 'Template format is not supported'
109
+ exit 1
110
+ end
111
+ end
112
+ end
@@ -75,7 +75,7 @@ body {
75
75
  padding: 0;
76
76
  font-size: 10pt;
77
77
 
78
- .info-title, .info-subtitle {
78
+ .info-title {
79
79
  font-size: 11pt;
80
80
  }
81
81
 
@@ -0,0 +1,60 @@
1
+ require 'erb'
2
+ require 'json'
3
+ require 'yaml'
4
+ require 'sass'
5
+ require 'resuby/version'
6
+
7
+ class Resuby::Resume
8
+ attr_reader :name, :contact_info, :sections, :template, :profile
9
+
10
+ def initialize
11
+ @template = File.read(File.join(__dir__, '../templates/resume.erb'))
12
+ end
13
+
14
+ def read_source(source, extension = nil)
15
+ puts "Reading in data from #{source}"
16
+ ext = extension || File.extname(source)
17
+ resume_data =
18
+ case ext
19
+ when '.yaml', '.yml'
20
+ YAML.load_file(source)
21
+ when '.json'
22
+ JSON.parse(File.read(source))
23
+ else
24
+ puts 'File type not supported'
25
+ exit 1
26
+ end
27
+ store_data(resume_data)
28
+ end
29
+
30
+ def store_data(data)
31
+ @name = data['name']
32
+ @contact_info = data['contact']
33
+ @profile = data['profile']
34
+ @sections = data.reject { |key, value| ['name', 'contact', 'profile'].include?(key) }
35
+ end
36
+
37
+ def render
38
+ ERB.new(self.template, nil, '-').result( binding )
39
+ end
40
+
41
+ def save_resume(file)
42
+ puts "Saving your resume at #{file}"
43
+ File.open(file, "w+") do |f|
44
+ f.write(render)
45
+ end
46
+ end
47
+
48
+ def compile_styles
49
+ options = {
50
+ cache: true,
51
+ syntax: :scss,
52
+ style: :compressed,
53
+ }
54
+
55
+ scss_file = File.join(__dir__, '../css/main.scss')
56
+ render = Sass::Engine.new(File.read(scss_file), options).render
57
+ Dir.mkdir(File.join(Dir.pwd, 'css'), 0755) unless File.directory?(File.join(Dir.pwd, 'css'))
58
+ File.write(File.join(Dir.pwd, 'css/main.css'), render)
59
+ end
60
+ end
@@ -12,45 +12,46 @@
12
12
  <div class="header">
13
13
  <h1 class="name"><%=@name%></h1>
14
14
  <ul>
15
- <% for @info in @contact_info %>
15
+ <%- for @info in @contact_info -%>
16
16
  <li class="contact-info"><%=@info%></li>
17
- <% end %>
17
+ <%- end -%>
18
18
  </ul>
19
19
  </div>
20
20
 
21
21
  <div>
22
- <% if @profile %>
22
+ <%- if @profile -%>
23
23
  <h2 class="section-header">Profile</h2>
24
24
  <span class="hr"></span>
25
25
  <p class="section-profile">
26
26
  <%=@profile%>
27
27
  </p>
28
- <% end %>
28
+ <%- end -%>
29
29
 
30
- <% for @section in @sections.keys %>
30
+ <%- for @section in @sections.keys -%>
31
31
  <h2 class="section-header"><%=@section.split('_').map { |word| word.capitalize }.join(' ')%></h2>
32
32
  <span class="hr"></span>
33
- <% for @row in @sections[@section] %>
33
+ <%- for @row in @sections[@section] -%>
34
34
  <div class="section-row">
35
35
  <div class="section-desc">
36
36
  <%=@row['desc']%>
37
37
  </div>
38
38
  <div class="section-info">
39
39
  <ul>
40
- <% if @row['title'] %>
40
+ <%- if @row['title'] -%>
41
41
  <li class="info-title"><%=@row['title']%></li>
42
- <% end %>
43
- <% if @row['subtitle'] %>
42
+ <%- end -%>
43
+ <%- if @row['subtitle'] -%>
44
44
  <li class="info-subtitle"><%=@row['subtitle']%></li>
45
- <% end %>
46
- <% for @data in @row['data'] %>
45
+ <%- end -%>
46
+ <%- for @data in @row['data'] -%>
47
47
  <li><%=@data%></li>
48
- <% end %>
48
+ <%- end -%>
49
49
  </ul>
50
50
  </div>
51
51
  </div>
52
- <% end %>
53
- <% end %>
52
+
53
+ <%- end -%>
54
+ <%- end -%>
54
55
  </div>
55
56
  </body>
56
57
  </html>
@@ -1,3 +1,3 @@
1
- class Resuby
2
- VERSION = '0.0.1'.freeze
1
+ module Resuby
2
+ VERSION = '0.1.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resuby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mario Lopez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-13 00:00:00.000000000 Z
11
+ date: 2018-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sass
@@ -30,6 +30,26 @@ dependencies:
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: 4.0.0
33
+ - !ruby/object:Gem::Dependency
34
+ name: optimist
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: 3.0.0
40
+ - - "<"
41
+ - !ruby/object:Gem::Version
42
+ version: 4.0.0
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: 3.0.0
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: 4.0.0
33
53
  description: |-
34
54
  Resuby generates an HTML and CSS resume that you can access with your
35
55
  browser. You simply define the content of your resume in a YAML file, and
@@ -44,7 +64,11 @@ files:
44
64
  - README.md
45
65
  - bin/resuby
46
66
  - lib/resuby.rb
67
+ - lib/resuby/cli/banners.rb
68
+ - lib/resuby/cli/cli.rb
69
+ - lib/resuby/cli/exe.rb
47
70
  - lib/resuby/css/main.scss
71
+ - lib/resuby/resume/resume.rb
48
72
  - lib/resuby/templates/resume.erb
49
73
  - lib/resuby/version.rb
50
74
  homepage: https://github.com/mardotio/resuby