Class: Fontcustom::Generator::Template

Inherits:
Object
  • Object
show all
Includes:
Utility
Defined in:
lib/fontcustom/generator/template.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utility

#behavior, #destination_root, #line_break, #methodize_hash, #options, #project_root, #say_changed, #say_message, #say_status, #shell, shell, #source_paths, #symbolize_hash, #write_file

Constructor Details

#initialize(manifest) ⇒ Template

Returns a new instance of Template.



12
13
14
15
# File 'lib/fontcustom/generator/template.rb', line 12

def initialize(manifest)
  @manifest = Fontcustom::Manifest.new manifest
  @options = @manifest.get :options
end

Instance Attribute Details

#manifestObject (readonly)

Returns the value of attribute manifest.



10
11
12
# File 'lib/fontcustom/generator/template.rb', line 10

def manifest
  @manifest
end

Instance Method Details

#generateObject



17
18
19
20
21
22
23
24
25
# File 'lib/fontcustom/generator/template.rb', line 17

def generate
  if ! @manifest.get(:fonts).empty?
    delete_old_templates
    set_relative_paths
    create_files
  else
    raise Fontcustom::Error, "No generated fonts were detected - aborting template generation."
  end
end