Class: Rubbr::Options
Class Method Summary collapse
- .defaults ⇒ Object
-
.setup ⇒ Object
Fetching options from a config file if present and merges it with the defaults.
Methods included from Cli
color?, disable_stderr, disable_stdinn, disable_stdout, error, executable?, notice, valid_executable, warning
Class Method Details
.defaults ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/rubbr/options.rb', line 5 def defaults root_dir = Dir.pwd source_dir = 'src' @defaults ||= { :root_dir => root_dir, :source_dir => source_dir, :build_dir => 'tmp', :distribution_dir => 'dist', :base_file => 'base', :vendor_dir => source_dir + '/vendor', :graphics_dir => source_dir + '/graphics', :spell_dir => source_dir, :spell_file => 'dictionary.ispell', :inventory_file => '.inventory', :distribution_name => distribution_name(root_dir), :verbose => false, :verboser => false, :color => false, :format => :dvi, :engine => :latex, :loop_delay => 0.5 } end |
.setup ⇒ Object
Fetching options from a config file if present and merges it with the defaults.
32 33 34 35 36 37 38 39 40 |
# File 'lib/rubbr/options.rb', line 32 def setup preference_file = "#{defaults[:root_dir]}/config.yml" preferences = {} if File.exists? preference_file require 'yaml' File.open(preference_file) { |file| preferences = YAML.load(file) } end base_file_variations(absolute_paths(defaults.merge(preferences))) end |