my-last-cv 0.0.2 → 0.0.4

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: 50dc7597459a46e9b9e4dc05be3ce0ad29d79f1aa8827a9286ec06b7f3c14059
4
- data.tar.gz: df0e733de4e2e514915013766daf2f2f7cf66fb6066ef7ce045b29e0a732ab98
3
+ metadata.gz: cf2509574951b9a1befe15309696db3b3dbfd5ce8196fafbd8ec48d2d4ae9d80
4
+ data.tar.gz: f0c6d142419598ce2246156320db87a98062667acd39e8ed30fbc06529745366
5
5
  SHA512:
6
- metadata.gz: b0464ac5ece152ff7a35f63d4ab4faa4701b72af57e6283bc0164301501cd331b129bcd12d43e26daccfe4f89ef10dceb71848acd7cab786e329d70443548af2
7
- data.tar.gz: b1b9b1b1faa7088385b903f0f2f02012c78813265d25a2e8c573cfc74a88a9a7d556e7a09a4bb3c30c233e47fb22067a51dfc73b3869cc7733de800a23515849
6
+ metadata.gz: 32586b06068dcc7b74e3700581634f6bf693108b87181641edf25c69084e1ad42258fd64fee58492a8fd509bf0fc1873a3d4efb5291504383fd508a2857d625a
7
+ data.tar.gz: 7ce669851940b2e5f9c1fdec663eb8d84f90b75da8ef3e927c111d58bd038c55727386e0742b6135dc184c69e09c9f06f9ad5366f9422b3329f1eab9b40c6808
@@ -19,9 +19,21 @@ module MyLastCV
19
19
 
20
20
  private
21
21
 
22
+ def resolved_fonts_dir
23
+ candidates = []
24
+ candidates << @style.fonts_dir if @style.fonts_dir
25
+ candidates << ENV["MY_LAST_CV_FONTS_DIR"] if ENV["MY_LAST_CV_FONTS_DIR"]
26
+ candidates << File.join(Dir.pwd, "fonts")
27
+
28
+ # fallback if no fonts_dir specified
29
+ candidates << File.expand_path("../../fonts", __dir__)
30
+
31
+ candidates.find { |p| p && Dir.exist?(p) }
32
+ end
33
+
22
34
  def register_fonts(pdf)
23
- fonts_dir = File.expand_path("../../fonts", __dir__)
24
- return unless Dir.exist?(fonts_dir)
35
+ fonts_dir = resolved_fonts_dir
36
+ return unless fonts_dir
25
37
 
26
38
  # Exemple : Inter (Regular / Bold)
27
39
  pdf.font_families.update(
@@ -1,6 +1,6 @@
1
1
  module MyLastCV
2
2
  class Style
3
- attr_reader :header_font, :header_size, :section_font, :section_size, :body_font, :body_size, :page_options, :accent_color
3
+ attr_reader :header_font, :header_size, :section_font, :section_size, :body_font, :body_size, :page_options, :accent_color, :fonts_dir
4
4
 
5
5
  def initialize(opts = {})
6
6
  @header_font = opts[:header_font] || 'Helvetica'
@@ -11,6 +11,7 @@ module MyLastCV
11
11
  @body_size = opts[:body_size] || 10
12
12
  @page_options = opts[:page_options] || { margin: 48 }
13
13
  @accent_color = opts[:accent_color] || '000000'
14
+ @fonts_dir = opts[:fonts_dir] # optional
14
15
  end
15
16
  end
16
17
  end
@@ -1,3 +1,3 @@
1
1
  module MyLastCV
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: my-last-cv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maxime Hanicotte