lib/fontcustom/options.rb in fontcustom-1.1.1 vs lib/fontcustom/options.rb in fontcustom-1.2.0
- old
+ new
@@ -6,11 +6,11 @@
module Fontcustom
class Options
include Util
- attr_reader :project_root, :input, :output, :config, :templates, :font_name, :css_prefix, :data_cache, :preprocessor_path, :no_hash, :debug, :quiet, :skip_first
+ attr_reader :project_root, :input, :output, :config, :templates, :font_name, :css_prefix, :manifest, :preprocessor_path, :autowidth, :no_hash, :debug, :quiet, :skip_first
def initialize(options = {})
check_fontforge
options = symbolize_hash(options)
@@ -89,27 +89,27 @@
@cli_options.delete_if { |key, val| val == DEFAULT_OPTIONS[key] }
options = DEFAULT_OPTIONS.dup
options = options.merge @config_options
options = options.merge symbolize_hash(@cli_options)
- remove_instance_variable :@config_options
- remove_instance_variable :@cli_options
+ send :remove_instance_variable, :@config_options
+ send :remove_instance_variable, :@cli_options
# :config is excluded since it's already been set
- keys = %w|project_root input output data_cache templates font_name css_prefix preprocessor_path skip_first no_hash debug quiet|
+ keys = %w|project_root input output manifest templates font_name css_prefix preprocessor_path skip_first autowidth no_hash debug quiet|
keys.each { |key| instance_variable_set("@#{key}", options[key.to_sym]) }
@font_name = @font_name.strip.gsub(/\W/, "-")
end
def set_data_path
- @data_cache = if ! @data_cache.nil?
- expand_path @data_cache
+ @manifest = if ! @manifest.nil?
+ expand_path @manifest
elsif @config
- File.join File.dirname(@config), ".fontcustom-data"
+ File.join File.dirname(@config), ".fontcustom-manifest.json"
else
- File.join @project_root, ".fontcustom-data"
+ File.join @project_root, ".fontcustom-manifest.json"
end
end
def set_input_paths
if @input.is_a? Hash
@@ -137,11 +137,11 @@
raise Fontcustom::Error, "INPUT (as a string) should be a directory. Check `#{relative_to_root(input)}` and try again."
end
@input = { :vectors => input, :templates => input }
end
- if Dir[File.join(@input[:vectors], "*.{svg,eps}")].empty?
- raise Fontcustom::Error, "`#{relative_to_root(@input[:vectors])}` doesn't contain any vectors (*.svg or *.eps files)."
+ if Dir[File.join(@input[:vectors], "*.svg")].empty?
+ raise Fontcustom::Error, "`#{relative_to_root(@input[:vectors])}` doesn't contain any SVGs."
end
end
def set_output_paths
if @output.is_a? Hash