kamisaku 0.3.1 → 0.3.3

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
  SHA256:
3
- metadata.gz: '08311183150f22bf9897f33d7ecb93616573e99b90a49455efd27747316b3a5b'
4
- data.tar.gz: b198531b11fdf5b409c1b9c39be5ca04c64a1b9174a867f38e93f7d928f534e9
3
+ metadata.gz: 82cbb110627e0fb58ce9d9dee310d46ee9339ad54728676ed0f4b010ad664c5e
4
+ data.tar.gz: e2f4b74163a6febdf4576be058a64bf051f86e59b08a2679f38251f840eda83e
5
5
  SHA512:
6
- metadata.gz: 621551dfa5fa5bf482ccccf5e8fb72a7a12b2736ed397f8a813f85274f8f33db09e1ffed4d1846dbd3dbb75f2ffc7abb53dd719229c1d00946945050949517d8
7
- data.tar.gz: 6434717f692966c901becca7a7573ee69ed69b63516bdf356ea826c7d27302255dad520e72ac86519b87213ade8319d3a064de0f9991c5cf69f3242a3918aa20
6
+ metadata.gz: 5a2c519714481d39b458e56cb1865b20fdf0c3133f856013692b6bd19c5fb43b7ede85eb1fb59d07cbcbcaccd4524933bfe92c3656e032ec27e6da6757787ba0
7
+ data.tar.gz: 02a8381a44b6f732bf86beb985fea8d9bd383c960ce640793bd23faaf1e38e57b28e887da8c0d2060f7cc51502575e3b2f1585f87a051f0b21d47ed181b1d546
data/CHANGELOG.md CHANGED
@@ -13,6 +13,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
13
13
 
14
14
  ### Removed
15
15
 
16
+ ## [0.3.3] - 2025.06.01
17
+
18
+ ### Changed
19
+ - Update validations to allow empty `contact` section
20
+
21
+ ## [0.3.2] - 2025.06.01
22
+
23
+ ### Added
24
+ - Template name validation to `Kamisaku::PDF` interface
25
+
16
26
  ## [0.3.1] - 2025-06-01
17
27
 
18
28
  ### Changed
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kamisaku (0.3.1)
4
+ kamisaku (0.3.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -2,15 +2,47 @@
2
2
 
3
3
  *Build a CV PDF from a yaml text file.*
4
4
 
5
+ 🚀 See it in action at [https://kamisaku.sinaru.com/](https://kamisaku.sinaru.com/?utm_source=github).
6
+
5
7
  [![Gem Version](https://badge.fury.io/rb/kamisaku.svg)](https://badge.fury.io/rb/kamisaku)
6
8
 
7
9
  ![Kamisaku](kamisaku.png)
8
10
 
9
11
  See [examples](/examples) directory for sample generated PDF files based of [templates](/lib/templates).
10
12
 
13
+ ## Templates
14
+ For a list of templates availble for CV generation, check the [examples](/examples) directory where each directory name is a template name.
15
+
16
+ ## Installation
17
+
18
+ This is a Ruby gem. So you can either install as a gem or clone the repo and use `bin/console` file run from terminal.
19
+
20
+ ### Dependency Requirement
21
+ - Ruby 3.4.3
22
+ - Ensure that [Google Chrome](https://www.google.com/chrome/) is installed.
23
+ - Chrome must be accessible from the terminal as `google-chrome`.
24
+ - Kamisaku uses Chrome's [headless mode](https://developer.chrome.com/docs/chromium/headless/) to generate PDF files.
25
+ - Ensure `exiftool` is installed available in command line.
26
+ - exiftool is used to soft remove metadata added by chrome in the PDF file.
27
+
28
+ Add this line to your application's Gemfile:
29
+
30
+ ```ruby
31
+ gem 'kamisaku'
32
+ ```
33
+
34
+ And then execute:
35
+ ```bash
36
+ $ bundle install
37
+ ```
38
+ Or install it yourself as:
39
+ ```bash
40
+ $ gem install kamisaku
41
+ ```
42
+
11
43
  ## Usage
12
44
 
13
- First we need to have a `yaml` file with the CV data. The yaml file supports following sections.
45
+ First we need to have a `yaml` file or a string with the CV data. The gem supports the following sections.
14
46
 
15
47
  ```yaml
16
48
  version: 1
@@ -69,36 +101,6 @@ education:
69
101
  - # Things you have achieved or did
70
102
  ```
71
103
 
72
- ## Template
73
- For a list of templates availble for CV generation, check the [examples](/examples) directory where each directory name is a template name.
74
-
75
- ## Installation
76
-
77
- This is a Ruby gem. So you can either install as a gem or clone the repo and use `bin/console` file run from terminal.
78
-
79
- ### Dependency Requirement
80
- - Ruby 3.4.3
81
- - Ensure that [Google Chrome](https://www.google.com/chrome/) is installed.
82
- - Chrome must be accessible from the terminal as `google-chrome`.
83
- - Kamisaku uses Chrome's [headless mode](https://developer.chrome.com/docs/chromium/headless/) to generate PDF files.
84
- - Ensure `exiftool` is installed available in command line.
85
- - exiftool is used to soft remove metadata added by chrome in the PDF file.
86
-
87
- Add this line to your application's Gemfile:
88
-
89
- ```ruby
90
- gem 'kamisaku'
91
- ```
92
-
93
- And then execute:
94
- ```bash
95
- $ bundle install
96
- ```
97
- Or install it yourself as:
98
- ```bash
99
- $ gem install kamisaku
100
- ```
101
-
102
104
  ## Generating PDF
103
105
 
104
106
  ### Using terminal
@@ -115,6 +117,21 @@ bin/console -c examples/paper/john_doe.yml -o examples/paper/john_doe.pdf -t pa
115
117
  - `-o` output location for the PDF file including the name
116
118
  - `-t` template to use
117
119
 
120
+ ### Using `PDF` class
121
+
122
+ ```ruby
123
+ # Have a YAML string
124
+ yaml_str = "..."
125
+ # Create a hash
126
+ content_hash = Kamisaku::Helpers.yaml_str_to_content_hash(yaml_str)
127
+ # Validate the hash is correct. If there is any issue, it will raise a ` Kamisaku::Error ` exception.
128
+ Kamisaku::ContentValidator.new(content_hash:).validate!
129
+ # create a pdf instance
130
+ pdf = Kamisaku::PDF.new(content_hash:, template: "paper")
131
+ # create the PDF at given path
132
+ pdf.write_to('/path/to/generated_file.pdf')
133
+ ```
134
+
118
135
  ## Development
119
136
 
120
137
  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.
@@ -54,10 +54,6 @@ module Kamisaku
54
54
  raise Error, "Contact contains invalid fields"
55
55
  end
56
56
 
57
- allowed_fields.each do |field|
58
- raise Error, "Contact missing required field '#{field}'" unless contact_fields.include?(field)
59
- end
60
-
61
57
  data[:contact].each do |field, value|
62
58
  if field == :location
63
59
  validate_location(value, "Contact section")
data/lib/kamisaku/pdf.rb CHANGED
@@ -6,6 +6,8 @@ module Kamisaku
6
6
  @content_hash = content_hash
7
7
  @template = template || "sleek"
8
8
  ContentValidator.new(content_hash:).validate!
9
+ raise Error, "Invalid template name '#{template}'" unless template.is_a?(String)
10
+ raise Error, "Invalid template name '#{template}'" unless TemplateHelpers::TEMPLATES.include? @template
9
11
  end
10
12
 
11
13
  def write_to(pdf_location)
@@ -2,6 +2,8 @@ require "date"
2
2
 
3
3
  module Kamisaku
4
4
  module TemplateHelpers
5
+ TEMPLATES = %w[paper sleek].freeze
6
+
5
7
  def month_name(month_int)
6
8
  return "" if month_int.nil?
7
9
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kamisaku
4
- VERSION = "0.3.1"
4
+ VERSION = "0.3.3"
5
5
  end
data/template.yml CHANGED
@@ -1,7 +1,10 @@
1
1
  # Template structure for CV. The content should be in YAML format.
2
2
  # If you are not familiar with YAML, refer: https://devhints.io/yaml
3
- # Some hints:
4
- # - comments start with "#"
3
+ #
4
+ # Tip: If you already have a sample file like an exising Resume/CV PDF and you want to convert that to a YAML file based on the structure,
5
+ # You could provide this template file and the PDF to an LLM like Claude.AI prompt to generate a new YAML file.
6
+ # Example prompt: "Based on the given template_structure.yml file, create a resume.yml for data in Profile.pdf"
7
+ #
5
8
 
6
9
  version: 1
7
10
  profile:
@@ -10,13 +13,13 @@ profile:
10
13
  about: # Some sleek details about your experience
11
14
 
12
15
  contact:
13
- github: # Github username
14
- mobile: # Mobile number
15
- email: # email address
16
- linkedin: # Linkedin username
16
+ github: # GitHub username if available, otherwise ignore
17
+ mobile: # Mobile number if available, otherwise ignore
18
+ email: # email address if available, otherwise ignore
19
+ linkedin: # LinkedIn username if available, otherwise ignore
17
20
  location:
18
- country: # country name
19
- city: # city name
21
+ country: # country name you are based at
22
+ city: # city name you are based at
20
23
 
21
24
  skills:
22
25
  - area: # specific skill area you are specialized in
@@ -37,8 +40,8 @@ experiences:
37
40
  month: # month integer number that you stopped
38
41
  year: # year integer number that you stopped
39
42
  skills:
40
- - # a short name for a specialized skilled you gained
41
- achievements:
43
+ - # a short name for a specialized skill you gained at the organization
44
+ achievements: # Optional section
42
45
  - # Things you have achieved or did as a sentence. Consider reflecting the impact it made.
43
46
 
44
47
  education:
@@ -51,9 +54,11 @@ education:
51
54
  from:
52
55
  month: # month integer number that you started
53
56
  year: # year integer number that you started
54
- # if following is not given, it is assumed you are still studying
55
- to:
57
+ to: # Optional. If you have finished studying at the institute, provide this section
56
58
  month: # month integer number that you stopped
57
59
  year: # year integer number that you stopped
58
- achievements:
59
- - # Things you have achieved or did
60
+ achievements: # Optional section
61
+ - # A list of things you have achieved or did at the institute.
62
+
63
+ interests: # optional section
64
+ - # things that are interests to you
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kamisaku
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sinaru Gunawardena