Sha256: 0c4db80ee5eef6353d412d69796b30e1b1be2b97e4ddf56dbd80cfabb5c1b7dd

Contents?: true

Size: 1.38 KB

Versions: 1

Compression:

Stored size: 1.38 KB

Contents

require "fontcustom/version"
require "fontcustom/error"
require "fontcustom/util"
require "fontcustom/options"
require "fontcustom/generator/font"
require "fontcustom/generator/template"

module Fontcustom
  ##
  # Clean Ruby API to workaround Thor
  def compile(options)
    opts = Options.new options
    Generator::Font.start [opts]
    Generator::Template.start [opts]
  rescue Fontcustom::Error => e
    opts.say_message :error, e.message, :red
  end

  def gem_lib
    File.expand_path(File.join(File.dirname(__FILE__), "fontcustom"))
  end

  module_function :compile, :gem_lib

  ##
  # These are used in Thor CLI but overridden when the Options class is built
  EXAMPLE_OPTIONS = {
    :project_root => "`pwd`",
    :output => "PROJECT_ROOT/FONT_NAME",
    :config => "PROJECT_ROOT/fontcustom.yml OR PROJECT_ROOT/config/fontcustom.yml",
    :templates => "css preview",
    :manifest => "CONFIG_DIR/.fontcustom-manifest.json OR PROJECT_ROOT/.fontcustom-manifest.json"
  }

  DEFAULT_OPTIONS = {
    :project_root => Dir.pwd,
    :input => nil,
    :output => nil,
    :config => nil,
    :templates => %w|css preview|,
    :font_name => "fontcustom",
    :css_prefix => "icon-",
    :manifest => nil,
    :preprocessor_path => nil,
    :autowidth => false,
    :no_hash => false,
    :debug => false,
    :quiet => false
  }

  DATA_MODEL = {
    :fonts => [],
    :templates => [],
    :glyphs => []
  }
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fontcustom-1.2.0 lib/fontcustom.rb