kamisaku 0.4.0 → 0.4.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
  SHA256:
3
- metadata.gz: '0307528fa9400ae092638a768482af0a290b9f7e65f0ca8fcccfa501493eeb92'
4
- data.tar.gz: bec81b49d0f9a635ad59dcfde08f718a5f8ab5471fa5d9c23eaf37dd2a3789e5
3
+ metadata.gz: 60a3dc3cc7212e2e7f161aaac32c7ff2ed0480a6e9282d38580a4a179df387d5
4
+ data.tar.gz: 475477cd26f0190e240133ead67e367f1a64539e2bdd21574c76d8e3284b4821
5
5
  SHA512:
6
- metadata.gz: '0738241ce36d4fb6e43439a35e39614ac935e922247cfb91e87dc3e236b6897f105feee6d827e3341f19286344935e7c37ea19e4705b6c7eb5187c6758049c6f'
7
- data.tar.gz: 0525b51569873f87984eadd9c779b3ac0254250c541e3fbf6cb37e0f14a746ac3866e2024911f94727f6af40f58afd0758ef6c5faddb915534328e638fa0b27f
6
+ metadata.gz: 9c376919d7dde1c68506dceb3f9aec9e447edbd4dec8211e0e49fbcea00c809f8752f04ec908a517fec2016c50646a85472d26fe1f5d7c49d80d4f8d948d4e65
7
+ data.tar.gz: efd056f25b356c0cb2ca24a9f75d0c760db7d2d51f9e0d5cf27749e7d144c81f85c17c7e4814f98813781e30b874facff8402f8fbd8ead50cf235f3e83cbc063
data/CHANGELOG.md CHANGED
@@ -13,6 +13,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
13
13
 
14
14
  ### Removed
15
15
 
16
+ ## [0.4.1] - 2025.06.09
17
+
18
+ ### Changed
19
+ - Fix `Kamisaku::BirthdayInvitationContentValidator` template listing
20
+
16
21
  ## [0.4.0] - 2025.06.09
17
22
 
18
23
  ### Added
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kamisaku (0.4.0)
4
+ kamisaku (0.4.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1,8 +1,8 @@
1
1
  module Kamisaku
2
2
  class BirthdayInvitationContentValidator < BaseContentValidator
3
- TEMPLATES = %(
3
+ TEMPLATES = %w[
4
4
  dino
5
- ).freeze
5
+ ].freeze
6
6
 
7
7
  def validate!
8
8
  validate_party_details
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kamisaku
4
- VERSION = "0.4.0"
4
+ VERSION = "0.4.1"
5
5
  end
@@ -15,31 +15,41 @@ OptionParser.new do |opts|
15
15
  options[:write_to_html_file] = true
16
16
  end
17
17
 
18
+ opts.on("-k", "--category") do |category|
19
+ options[:category] = category
20
+ end
21
+
18
22
  opts.on("-h", "--help", "Show this help message") do
19
23
  puts opts
20
24
  exit
21
25
  end
22
26
  end.parse!
23
27
 
24
- example_yaml_fie = File.expand_path("../lib/schema/example.yml", __dir__)
25
- yaml_str = File.read(example_yaml_fie)
28
+ categories = options[:category] ? [options[:category]] : Kamisaku::PDF::CONTENT_VALIDATOR_MAP.keys
29
+
30
+ Kamisaku::PDF::CONTENT_VALIDATOR_MAP.select {|key, value| categories.include? key }.each do | category, klass |
31
+ templates = klass::TEMPLATES
32
+
33
+ # Use specified template or all templates
34
+ templates = options[:template] ? templates.select {|t| t == options[:template] } : templates
26
35
 
27
- # Use specified template or all templates
28
- templates = options[:template] ? [options[:template]] : Kamisaku::TemplateHelpers::TEMPLATES
36
+ templates.each do |template|
37
+ template_dir = File.expand_path("../examples/#{category}/#{template}", __dir__)
38
+ FileUtils.mkdir_p(template_dir)
29
39
 
30
- templates.each do |template|
31
- template_dir = File.expand_path("../examples/#{template}", __dir__)
32
- FileUtils.mkdir_p(template_dir)
40
+ pdf_file_path = File.expand_path("../examples/#{category}/#{template}/example.pdf", __dir__)
33
41
 
34
- pdf_file_path = File.expand_path("../examples/#{template}/example.pdf", __dir__)
42
+ example_yaml_fie = File.expand_path("../lib/schema/#{category}/example.yml", __dir__)
43
+ yaml_str = File.read(example_yaml_fie)
35
44
 
36
- content_hash = Kamisaku::Helpers.yaml_str_to_content_hash(yaml_str)
37
- pdf = Kamisaku::PDF.new(content_hash:, template:)
38
- puts "Building template #{template}"
39
- pdf.write_to(pdf_file_path)
45
+ content_hash = Kamisaku::Helpers.yaml_str_to_content_hash(yaml_str)
46
+ pdf = Kamisaku::PDF.new(content_hash:, category:, template:)
47
+ puts "Building template #{template}"
48
+ pdf.write_to(pdf_file_path)
40
49
 
41
- if options[:write_to_html_file]
42
- html_location = File.expand_path("../examples/#{template}/example.html", __dir__)
43
- pdf.write_to_html_file(html_location)
50
+ if options[:write_to_html_file]
51
+ html_location = File.expand_path("../examples/#{category}/#{template}/example.html", __dir__)
52
+ pdf.write_to_html_file(html_location)
53
+ end
44
54
  end
45
55
  end
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.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sinaru Gunawardena
@@ -25,7 +25,7 @@ files:
25
25
  - LICENSE.txt
26
26
  - README.md
27
27
  - Rakefile
28
- - examples/birthday_invitation/dino/invitation.pdf
28
+ - examples/birthday_invitation/dino/example.pdf
29
29
  - examples/resume/chromatic/example.pdf
30
30
  - examples/resume/gradient/example.pdf
31
31
  - examples/resume/meridian/example.pdf