Class: Fontcustom::Base

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

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(raw_options) ⇒ Base

Returns a new instance of Base.



7
8
9
10
11
12
13
14
# File 'lib/fontcustom/base.rb', line 7

def initialize(raw_options)
  check_fontforge
  check_woff2
  manifest = '.fontcustom-manifest.json'
  raw_options[:manifest] = manifest
  @options = Fontcustom::Options.new(raw_options).options
  @manifest = Fontcustom::Manifest.new(manifest, @options)
end

Instance Method Details

#compileObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/fontcustom/base.rb', line 16

def compile
  current = checksum
  previous = @manifest.get(:checksum)[:previous]

  say_message :status, "Forcing compile." if @options[:force]
  if @options[:force] || current != previous
    @manifest.set :checksum, {:previous => previous, :current => current}
    start_generators
    @manifest.reload
    @manifest.set :checksum, {:previous => current, :current => current}
  else
    say_message :status, "No changes detected. Skipping compile."
  end
end