lib/fontcustom.rb in fontcustom-1.1.0.pre2 vs lib/fontcustom.rb in fontcustom-1.1.0

- old
+ new

@@ -1,22 +1,21 @@ require "fontcustom/version" require "fontcustom/error" -require "fontcustom/options" require "fontcustom/util" +require "fontcustom/options" require "fontcustom/generator/font" require "fontcustom/generator/template" -require "thor/core_ext/hash_with_indifferent_access" module Fontcustom ## # Clean Ruby API to workaround Thor def compile(options) - opts = Fontcustom::Options.new options - Fontcustom::Generator::Font.start [opts] - Fontcustom::Generator::Template.start [opts] + opts = Options.new options + Generator::Font.start [opts] + Generator::Template.start [opts] rescue Fontcustom::Error => e - puts "ERROR: #{e.message}" + opts.say_message :error, e.message, :red end def gem_lib File.expand_path(File.join(File.dirname(__FILE__), "fontcustom")) end @@ -25,35 +24,32 @@ ## # These are used in Thor CLI but overridden when the Options class is built EXAMPLE_OPTIONS = { :project_root => "`pwd`", - :output => "PROJECT_ROOT/FONT_NAME" + :output => "PROJECT_ROOT/FONT_NAME", + :config => "PROJECT_ROOT/fontcustom.yml OR PROJECT_ROOT/config/fontcustom.yml", + :templates => "css preview", + :data_cache => "CONFIG_DIR/.fontcustom-data OR at PROJECT_ROOT/.fontcustom-data" } - ## - # - DEFAULT_OPTIONS = Thor::CoreExt::HashWithIndifferentAccess.new({ + DEFAULT_OPTIONS = { :project_root => Dir.pwd, :input => nil, :output => nil, :config => nil, - :data_cache => nil, :templates => %w|css preview|, :font_name => "fontcustom", - :file_hash => true, :css_prefix => "icon-", - :preprocessor_path => "", + :data_cache => nil, + :preprocessor_path => nil, + :no_hash => false, :debug => false, - :verbose => true - }) + :quiet => false + } - DATA_MODEL = Thor::CoreExt::HashWithIndifferentAccess.new({ + DATA_MODEL = { :fonts => [], :templates => [], - :glyphs => [], - :paths => { - :css_to_fonts => "", - :preprocessor_to_fonts => "" - } - }) + :glyphs => [] + } end