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
16
17
18
19
20
21
# File 'lib/fontcustom/generator/template.rb', line 12

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

  @pseudo_element = ':before';
  if @options[:css3]
    @pseudo_element = '::before';
  end

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



23
24
25
26
27
28
29
30
31
# File 'lib/fontcustom/generator/template.rb', line 23

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