lib/hyla/configuration.rb in hyla-1.0.2 vs lib/hyla/configuration.rb in hyla-1.0.3
- old
+ new
@@ -6,16 +6,20 @@
:templates, :samples, :resources, :styles, :backends
DEFAULTS = {
'source' => Dir.pwd,
'destination' => File.join(Dir.pwd, 'generated_content'),
+ 'watch_dir' => '.',
+ 'watch_ext' => %w(ad adoc asc asciidoc txt index),
# Asciidoctor
'backend' => 'html5',
'eruby' => 'erb',
'doctype' => 'article',
'compact' => false,
+ 'to_dir' => '.',
+ 'to_file' => '',
'attributes' => {
'source-highlighter' => 'coderay',
'linkcss!' => 'true',
'data-uri' => 'true',
'stylesheet' => 'asciidoctor.css',
@@ -62,11 +66,11 @@
STYLES = '../../lib/resources/styles'
BACKENDS = '../../lib/resources/backends'
- YAML_CONFIG_FILE_NAME = '_config.yml'
+ YAML_CONFIG_FILE_NAME = '_config.yaml'
#
# Templates Location
#
def self.templates
@@ -100,30 +104,30 @@
def self.samples
File.expand_path(SAMPLES, File.dirname(__FILE__))
end
# Public: Generate a Hyla configuration Hash by merging the default
- # options with anything in _config.yml, and adding the given options on top.
+ # options with anything in _config.yaml, and adding the given options on top.
#
# override - A Hash of options that override any options in both
# the defaults and the config file. See Hyla::Configuration::DEFAULTS for a
# list of option names and their defaults.
#
# Returns the final configuration Hash.
def self.parse(override)
- # Extract Asciidoctor attributes received from hyla command line '--a key=value,key=value'
+ # Extract Asciidoctor attributes received from hyla command line '-a key=value,key=value'
# Convert them to a Hash of attributes 'attributes' => { 'backend' => html5 ... }
# Assign hash to override[:attributes]
extracted_attributes = self.extract_attributes(override[:attributes]) if override[:attributes]
override[:attributes] = extracted_attributes if extracted_attributes
extracted_email_attributes = self.extract_attributes(override[:email_attributes]) if override[:email_attributes]
override[:email_attributes] = extracted_email_attributes if extracted_email_attributes
- # Stringify keys of the hash what we receive from Hyla as override
+ # Stringify keys of the hash that we receive from Hyla
override = Configuration[override].stringify_keys
Hyla::logger.debug("OVERRIDE Keys: #{override.inspect}")
# Clone DEFAULTS
config = DEFAULTS
@@ -133,10 +137,10 @@
# Merge content with DEFAULT config
new_config = read_config_file(YAML_CONFIG_FILE_NAME)
Hyla::logger.debug("OVERRIDE Keys: #{new_config.inspect}") if !new_config.nil?
config = config.deep_merge(new_config) if !new_config.nil?
- # Merge DEFAULTS < _config.yml < override
+ # Merge DEFAULTS < _config.yaml < override
config = config.deep_merge(override)
# Convert String Keys to Symbols Keys
config = Configuration[].transform_keys_to_symbols(config)
Hyla::logger.debug("Merged Keys: #{config.inspect}")
return config
\ No newline at end of file