Class: Iconly::Project::FontGenerator

Inherits:
Object
  • Object
show all
Includes:
FileUtils::Verbose
Defined in:
app/models/iconly/project/font_generator.rb

Constant Summary collapse

FONT_NAME =
'iconly'.freeze

Instance Method Summary collapse

Constructor Details

#initialize(vectors_path, output_path, font_name = nil) ⇒ FontGenerator

Returns a new instance of FontGenerator.



8
9
10
11
12
# File 'app/models/iconly/project/font_generator.rb', line 8

def initialize(vectors_path, output_path, font_name = nil)
  @vectors_path = vectors_path
  @output_path  = output_path
  @font_name    = font_name || FONT_NAME
end

Instance Method Details

#callObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/models/iconly/project/font_generator.rb', line 14

def call
  input = {
    vectors:   @vectors_path,
    templates: templates_path
  }

  raw_options = {
    debug:        Rails.env.development?,
    input:        input,
    templates:    %w(iconly.css),
    font_name:    @font_name,
    css_selector: ".#{@font_name}-{{glyph}}",
    no_hash:      true,
    verbose:      true,
    manifest:     manifest_path,
    output:       {
      fonts: output_fonts_path,
      css:   @output_path
    }
  }

  run_generators raw_options
end